Gamepedia

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 75
What the...?
GAMEPEDIA 2.0
BY: IXFURU


INTRODUCTION

This script adds a nice little scene to your project, where-in you can display information you want the player to have access to.

USAGE
Just copy the script from below.  Make sure you place it below 'materials' and above 'main' when you paste it into your project's script editor.

You'll need the ParagraphFormatter script written by ModernAlgebra which is used to display long text strings.  Get it

http://rmrk.net/index.php/topic,25129.0.html

To call the scene in game, you need to make an event and use the third page, script command to insert this code:

$scene = Scene_Gamepedia.new

It's that simple!

FEATURES
-shows any information you want it to
-can change settings of text colors
-can change displayed title
-can use custom windowskin
-can now hide/reveal entries at runtime through script calls

SCREENSHOTS

Spoiler for:

Spoiler for:

CREDITS FOR YOUR PURPOSES
First off, you'll need to credit ModernAlgebra, as the scripts full functionality isn't possible without his Paragraph Formatter Script (Link Above)
Also, you'll need to credit me, IXFURU, somewhere in your project.  You can use it non-commercially as much as you like.  If you want to go commercial just contact me and we'll discuss it.

In addition, Cassy made the windowskin used in the demo, so if you take the demo and use the skin, you need to credit her for making it. 

***YOU'LL NEED THIS IMAGE***(Put it in your Graphics\System folder!)


CREDITS FOR MY PURPOSES
LoganF:   Without whom, this script's release would have been delayed a long time. 
Also, Mangomight, ThallionDarkshine, Hungrysnake and Heretic86 gave input into fixing some minor bugs with the script.  Sometimes folks just don't get appreciated enough for taking time to offer insight, suggest a remedy or give advice.  These things should be more appreciated, whether or not their recommendations lead to any form of success.  So thanks guys!

THE SCRIPT

The Code:
Spoiler for:
Code: [Select]


    ################################################################################
    #                             Gamepedia 2.0
    #                             By: Ixfuru
    #                        2.0 released Feb 3, 2013
    ################################################################################
     
    ################################################################################
    #
    #   This script creates a scene of selectable windows that can display
    # information that you supply it.  It would be ideal for creating a how to guide,
    # or a good place to put credits.  You can basically use it as you wish, but I
    # created it as a personal need to provide an 'encyclopedia' for my project,
    # where one can look up and reference abbreviations, controls and other such
    # items that the player may need without the aid of an instruction manual. 
    # Follow the instructions in each section within the "CUSTOMIZATION SECTION"s to
    # set up what you want displayed.  I'll be using not only layman's terms for
    # those who want to 'use' the script, but I'll try to add some scripting info
    # as well so that someone who wants to add on to it, or get an idea from it, will
    # understand how I did the things I did.
    #
    # To call the scene, you just use the 'script' command on the third page inside
    # an event and enter:
    #
    #          $scene = Scene_Gamepedia.new
    #
    ################################################################################
    #
    ################################################################################
    #      THIS SCRIPT REQUIRES ModernAlgebra's ParagraphFormatter Script, which
    # can be found here:
    #
    #               http://rmrk.net/index.php/topic,25129.0.html
    #
    # You must abide by the rules and license statement on this page if you use his
    # script in conjunction with this one.
    ################################################################################
     
    #*******************************************************************************
    #
    # You can use this script for free NON-COMMERCIALLY.  If you intend to market
    # your project and want to include my script, please just give credit to IXFURU
    # somewhere in the game (Maybe in the Gamepedia) and contact me to discuss
    # if any compensation would be necessary.
    #
    #*******************************************************************************
     
    #*******************************************************************************
    #                             OTHER CREDITS:
    # LoganF was a great help with two of the lingering bugs in the script.
    # ThallionDarkshine, Heretic86 and Mangomight for offering their assistance on
    # the some bugs, as well.
    #
    # ModernAlgebra for his Paragraph Formatter script, without which, the Entries
    # window is not functional.
    #
    # A sample windowskin by Cassy was used to show the capability to show different
    # skins in the scene.  If you use this skin in your project, you must credit her.
    #
    # Here is a link to her other skins:
    #
    # http://www.rpgmakervx.net/index.php?showtopic=7859
    #
    # In GAMEPEDIA 2.0, special credit goes to both Johnny0798 and trakel, for it was
    # only after their suggestion that hidden topics/subjects was implemented.
    #
    #*******************************************************************************
     
     
    module GAMEPEDIA
     
      ##############################################################################
      #                 CUSTOMIZATION SECTION START
      ##############################################################################
     
      #*************                  PHAZE 1                  *********************
      # The first order of business is to add strings as "Subjects".  These strings
      # will be visible as selectable options in the Gamepedia scene.  Each 'Subject'
      # will have a number of child 'Topics' which you will set up later.  For this
      # section, just add to the given array below with double-quoted (") words
      # (strings).  The order in which these subjects are placed will not only be
      # important in the rest of the setup, but will be referenced as selectable
      # indexes in the scene.
      #*****************************************************************************
     
      SUBJECTS = ["ANIMALS", "FOOD", "SPORTS", "CREDITS"]
     
      #*************                  PHAZE 2                  *********************
      # Next, you need to set up the 'Topics' in the below hash.  You must use the
      # following formula to set it up:
      #
      #                        subject_position => [topic1, topic2, etc],
      #
      # subject_position:
      #
      # This is where you will reference the subjects in the first
      # array above.  As all arrays start with 0, not 1, you'll need to use '0' as
      # your subject_position.  The word position was given to show that you are in
      # essence taking the subject in the array above from the given position in the
      # array.  The topics will change in the Gamepedia scene, according to which
      # subject is highlighted. 
      #
      # topics:
      # You can place anything as the topics in the array, as long as they
      # are double-quoted.  These will be the selectable options in the Topics
      # selectable window in the scene.  Their order in the array will also be
      # the order in which they are displayed. 
      #
      # It is important that you END EVERY ARRAY with a comma (,). 
      #*****************************************************************************
     
      TOPICS = {#<<<Don't delete this!
     
      0 => ["DOGS", "CATS", "CROWS", "SALAMANDERS", "FROGS"],
      1 => ["APPLES", "ORANGES", "ICE CREAM"],
      2 => ["FOOTBALL", "BASEBALL", "BOXING", "BASKETBALL", "BOWLING", "MARTIAL ARTS"],
      3 => ["SCRIPT HELP", "MAD GENIUSES", "REQUIREMENTS"]
           
      }#<<<Don't delete this!
     
      #*************                  PHAZE 3                  *********************
      # This section enables you to set up the displayable text (or information)
      # about the selected topic in the Gamepedia scene.  In the hash, you need to
      # add a single string, which will then be shown in the large window.  This
      # will be the guts of the Gamepedia scene, where you set up just what you want
      # to display.  Though there is no limit to the amount of words or characters
      # one can use in the string, you'll need to remember, it must be double-quoted
      # and end in a comma, like before.  In addition, the ids (number to the left of
      # the "=>"), should be in numerical order and all displayable text should be
      # kept in the order of the topics above.  For instance, if you have the topic
      # set up as follows:
      #
      #                  0 => [stuff, morestuff, scratches_head],
      #                  1 => [people, chicks, more_chicks],
      #
      # You would then want to set up the ENTRIES in the same order.  Like this:
      #
      # 0 => stuff about stuff
      # 1 => more stuff about more stuff
      # 2 => why are you scratching your head
      # 3 => talk about people
      # 4 => talking about chicks
      # 5 => chicks rule!
      #
      # This will make more sense in the next phaze.  But this is VERY IMPORTANT. 
      # Failure to follow these guidelines will cause displayed text to not match the
      # selected topic.  It may wise to place commented divider lines between the
      # displays for each topic.  So the above would look more like this:
      #
      # 0 => stuff about stuff
      # 1 => more stuff about more stuff
      # 2 => why are you scratching your head
      #--------------------2-----------------------
      # 3 => talk about people
      # 4 => talking about chicks
      # 5 => chicks rule!
      #
      # That way, you would be sure you were adding the displayable entires for section
      # 2 in the correct location.
      #*****************************************************************************
     
      ENTRIES = {#<<<Don't delete this!
     
     
      #---------------------ANIMAL TOPICS------------------------------------------
      0 =>  "The first pet I can remember having when I was a kid was a dog named GYPSY.  GYPSY helped me and my siblings escape a horse which was chasing us.  Ultimately, GYPSY got really sick and died.",
      1 => "We had a cat once named MOSES.  It was an all-black cat.  It had big green eyes.  We named it MOSES, yet after several months, it became obvious, MOSES was a girl!  We never considered changing her name.",
      2 => "I've always liked Crows.  As Poe was the Raven, I have always considered myself a vast pupil of his, and likened myself a crow.  I even made a project once about a Red Crow.",
      3 => "I found a salamander one day while termite treating a house.  I took the salamader home.  Me and my brother built a box to keep it in.  I thought the light was too bright.  Only a day after we made the box, he disappeared.  Either he escaped, or fizzled away from the heat of the overhead light.",
      4 => "I had a shirt once that said, Frogs are the birds of the night.  They give it a voice.  I've always liked frogs because of that.  On a side note, never dump your grease from fried frog legs on a bush outside your home.",
     
      #---------------------FOOD TOPICS----------------------------------------
      5 => "Apples are pretty good.  However, whoever decided to couple them with cinamon, needs shot.  There's no worse pop tart on the market, and no two flavors together have ever turned my taste buds inside out more.",
      6 => "The best way to enjoy an orange is in drink form.  The wife and I had screwdrivers on our honeymoon.  But I forget what happened after that.",
      7 => "Ice Cream is perhaps the greatest of all desserts.  As long as it isn't Apple Cinamon.",
     
      #-------------------SPORTS TOPICS--------------------------------------------------
      8 => "There's no sport better than American Football.  There's no team I love more than the Cleveland Browns.  One day, maybe we'll make it to the Superbowl.  Then the rest of the league will quit ignoring us.",
      9 => "When I was a kid, I loved to play baseball.  I played everyday.  I watched the Indians every night I could.  And I played on the local little league teams during their seasons.  I was a pitcher and a firstbaseman.",
      10 => "Why is it that there are no good American Heavyweights anymore?  Back in the day, you had Foreman, Tyson, Holyfield, Bowe and countless others.  Now, The Europeans put out much better Heavyweights.",
      11 => "I've never liked Basketball very much.  I was never very good at it.  And I think the games a little too simple for my taste.",
      12 => "Is bowling even a sport?   I dont know, but I sure love to bowl.  I'm no good at it, but I love it just the same.  I think my high score is like a 140-something.",
      13 => "Martial Arts are cool.  I like the UFC and MMA in general.  What I don't like however, is when they just lay on each other for 15 minutes.  That sucks!",
     
      #-----------------CREDITS TOPICS----------------------------------------------
      45 => "Gotta give some credit to those who helped me with this script.  Whether their assistance ended up being useful or not.  Sometimes overlooked is the amount of time it takes just to TRY and help someone.  I appreciate it LoganF, Mangomight, Heretic60, ThallionDarkshine and Hungrysnake.",
      109 => "I've seen a lot of good VX scripts.  I just want to mention a few of my favorites.  One of whom's scripts is a necessity for this script.  ModernAlgebra, Jet, Yanfly and ???noBody???",
      16 => "I require many things.  One of the things I require the most is Pepsi.  I also require (though I wish I could quit) Camel Lights.  RPGMaker is a bit of a requirement, too.",
     
      }#<<<Don't delete this!
     
      #*************                  PHAZE 4                  *********************
      # In this phaze you will reference the subjects, by their positions, (just like
      # in the TOPICS hash, and you will then give a high and lo value following a
      # boolean (true or false).  Now, if you've followed directions precisely, you
      # should be able to place 'true' as the boolean in the first position of all
      # the following inner-hash arrays.   However, just because I know that some
      # may have made an error, or wish to add more entries later, I wanted to add
      # some type of solution to get you out of a jam without having to re-order
      # the entries above.  Here's how this all comes together:
      #
      # subject_position => [boolean true, low, high] or
      # subject_position => [boolean false, entry1, entry2, entry3, etc.]
      #
      # You place the values just like you did in the topics, telling the system that
      # the entries in this range are to be shown when a topic in this subject is
      # selected. 
      # Next, the boolean will be the answer to the following question for each
      # subject: 
      #       "Are the entries in the same order as their topics?"
      # If you answer the question, "yes", then you want to place true, if "no", you'll
      # put false. 
      # Low and High are values between and including the entry ids above where the
      # system will search for the displayable text information.  If you select true
      # for your boolean, then the system will display the text in numerical order
      # pertaining to which ever topic you have currently selected.
      # If by chance you used 'false' as your boolean, any following values will be
      # direct reference to specific entries.  If this is your setup:
      #
      # credits => [false, 7, 12, 3, 5, 9],
      #
      # Then as you move the cursor down the selected topics, it will jump to the
      # values you provided dependent upon index.  entry 7 will be displayed when
      # the cursor is in index position 0, entry 12 will be displayed when in index
      # 1, and so on...
      #
      #*****************************************************************************
     
      ENTRY_INDEXES = {#<<<Don't delete this!
     
      0 => [true, 0, 4],
      1 => [true, 5, 7],
      2 => [true, 8, 13],
      3 => [false, 45, 109, 16],  # This line demonstrates that you don't have to have
                                    # the topics in any particular order.
     
      }#<<<Don't delete this
     
      #*************                  PHAZE 5                  *********************
      # The last part of the customization just allows you to change trivial values
      # that will be used in deciding colors and text during the scene. 
      #*****************************************************************************
     
      ENCYCLOPEDIA_TITLE = "GAMEPEDIA"
      TITLE_COLOR = 14
      TOPIC_HEADING_COLOR = 27
      NEW_WINDOWSKIN = true #Set to false if you just want to use the project's default skin
      GP_WINDOWSKIN = "CassyOldWoodSkin"  #You MUST credit "Cassy" if you use this skin
      HIDDEN_COMMAND = "???????"
      HIDDEN_ENTRY_TEXT = "No information, regarding this topic is currently available."
      USE_FROM_MENU = true #Set to false if you don't want to access the scene from menu
      GAMEPEDIA_MENU_COMMAND = "Gamepedia" #if above is true, what you want to be the command
      #**************************SPECIAL COMMANDS***********************************
      # The following commands can be used via script call (3rd page of event commands)
      # and will offer methods to change existing Gamepedia Information.
      #******************************************************************************
      #  You can 'hide' a topics information by using the following:
      #                     $gamepedia.mark_hidden_topic(subject_id, topic_index)
      #
      #
      #  You can 'unhide' a topic and restore default by using:
      #                      $gamepedia.reveal_topic(subject_id, topic_index)
      #
      # You can 'hide' a subject's information by using the following:
      #                      $gamepedia.mark_hidden_subject(subject_id)
      #
      # You can 'unhide' a subject's information by using the following:
      #                        $gamepedia.reveal_subject(subject_id)
      #
      ##############################################################################
      #                         CUSTOMIZATION SECTION END
      # If you alter anything below this point, you risk screwing things up. 
      ##############################################################################
     
      ##############################################################################
      #             !!!!!!!!!!!!!!!!!!!PLEASE READ!!!!!!!!!!!!
      #
      # Be careful when revealing and hiding SUBJECTS.   When you reveal a subject,
      # all the topics of that subject will be revealed, as well.  And if you hide
      # a subject, all the topics of that subject will be hidden.  So, if you want
      # to reveal a subject, yet keep certain topics hidden, you'll have to use the
      # 'mark_hidden_topic' script call on each of the topics which are to remain
      # hidden after you reveal the subject.
      #
      ##############################################################################
     
    end
     
    ################################################################################
    #                     Gamepedia Class
    ################################################################################
     
    class Gamepedia
     
      include GAMEPEDIA
     
      attr_accessor :subjects
      attr_accessor :topics
      attr_accessor :entries
      attr_accessor :hidden_subjects
      attr_accessor :hidden_topics
     
      def initialize
        @subjects = SUBJECTS
        @hidden_subjects = []
        @hidden_topics = []
        unless $game_temp.topics_declared
          get_topics
        end
      end
     
      def get_topics
        @topics = TOPICS
        $game_temp.topics_declared = true
      end
     
      def get_entries(subject) #receives the value from the current subject index.
        entdex = ENTRY_INDEXES
        entkeys = ENTRIES.keys
        subnow = subject
        tempent = []
        if entdex[subnow][0] == true
          lo = entdex[subnow][1]
          hi = entdex[subnow][2]
          for i in lo..hi
            tempent.push(i)
          end
          @entries = tempent
          @entries.sort
        else
          get_jumbled_entries(subnow)
        end
      end
     
      #  This method retrieves displayable text from topics whose text is not in order
      def get_jumbled_entries(subject)
        entdex = ENTRY_INDEXES
        entkeys = ENTRIES.keys
        subnow = subject
        tempent = []
        for key in entkeys
          if entdex[subnow].include?(key)
            tempent.push(key)
          end
        end
        @entries = tempent
      end
     
      def mark_hidden_topic(subject, topic)
        @hidden_topics.push(@topics[subject][topic])
      end
     
      def reveal_topic(subject, topic)
        @hidden_topics.delete(@topics[subject][topic])
      end
       
      def mark_hidden_subject(subject)
        @hidden_subjects.push(@subjects[subject])
        for i in 0...@topics[subject].size
          unless @hidden_topics.include?(@topics[subject][i])
            @hidden_topics.push(@topics[subject][i])
          end
        end
      end
     
      def reveal_subject(subject)
        @hidden_subjects.delete(@subjects[subject])
        for i in 0...@topics[subject].size
          @hidden_topics.delete(@topics[subject][i])
        end
      end
     
    end
     
    ################################################################################
    #                         GAME TEMP
    ################################################################################
     
    class Game_Temp
     
      attr_accessor :last_pediasubject
      attr_accessor :pedia_menu
      attr_accessor :topics_declared
     
      alias nqenc_gtemp_initialize initialize unless $@
      def initialize
        nqenc_gtemp_initialize
        @last_pediasubject = 0
        @pedia_menu = false
        @topics_declared = false
      end
     
    end
     
    ################################################################################
    #                    WINDOW: SUBJECTS COMMANDS
    ################################################################################
     
    class Window_PediaSubjects < Window_Selectable
     
      include GAMEPEDIA
     
      def initialize(x, y)
        super(x, y, 120, 416)
        @item_max = $gamepedia.subjects.size
        @commands = $gamepedia.subjects
        if NEW_WINDOWSKIN
          self.windowskin = Cache.system(GP_WINDOWSKIN)
        end
        refresh
        self.index = $game_temp.last_pediasubject
      end
     
      def refresh
        self.contents.clear
        for i in 0...@item_max
          draw_item(i)
        end
      end
     
      def draw_item(index, enabled = true)
        rect = item_rect(index)
        rect.x += 4
        rect.width -= 8
        self.contents.font.color = normal_color
        self.contents.font.size = 12
        if $gamepedia.hidden_subjects.include?($gamepedia.subjects[index])
          self.contents.draw_text(rect, HIDDEN_COMMAND)
        else
          self.contents.draw_text(rect, @commands[index])
        end
      end
     
    end
     
    ################################################################################
    #                 WINDOW: TOPICS COMMANDS
    ################################################################################
     
    class Window_PediaTopics < Window_Selectable
     
      include GAMEPEDIA
     
      attr_writer :item_max
      attr_writer :commands
      attr_accessor :cur_subject
     
      def initialize(x, y)
        super(x, y, 120, 416)
        @cur_subject = $game_temp.last_pediasubject
        @item_max = $gamepedia.topics[cur_subject].size
        @commands = $gamepedia.topics[cur_subject]
        if NEW_WINDOWSKIN
          self.windowskin = Cache.system(GP_WINDOWSKIN)
        end
        refresh
        self.index = 0
      end
     
      def refresh
        create_contents
        self.contents.clear
        for i in 0...@item_max
          draw_item(i)
        end
      end
     
      def change_commands(subject)
        @item_max = $gamepedia.topics[subject].size
        @commands = $gamepedia.topics[subject]
      end
     
     
      def draw_item(index, enabled = true)
        rect = item_rect(index)
        self.contents.clear_rect(rect)
        rect.x += 4
        rect.width -= 8
        self.contents.font.color = normal_color
        self.contents.font.size = 12
        if $gamepedia.hidden_topics.include?($gamepedia.topics[@cur_subject][index])
          self.contents.draw_text(rect, HIDDEN_COMMAND)
        else
          self.contents.draw_text(rect, @commands[index])
        end
      end
     
    end
     
    ################################################################################
    #                  WINDOW: VIEW TOPIC
    ################################################################################
     
    class Window_PediaViewTopic < Window_Base
     
      include GAMEPEDIA
     
      attr_writer :topic_dex
      attr_accessor :cur_subject
     
      def initialize(x, y, heading, entry)
        super(x, y, 304, 346)
        @heading = heading
        @entry = entry
        @topic_dex = 0
        @cur_subject = $game_temp.last_pediasubject
        if NEW_WINDOWSKIN
          self.windowskin = Cache.system(GP_WINDOWSKIN)
        end
        refresh
      end
     
      def refresh
        self.contents.clear
        self.contents.font.size = 14   
        self.contents.font.color = text_color(TOPIC_HEADING_COLOR)
        self.contents.draw_text(-16, 0, self.width, WLH, @heading, 1)
        self.contents.font.size = 12   
        self.contents.font.color = normal_color
        if $gamepedia.hidden_topics.include?($gamepedia.topics[@cur_subject][@topic_dex])
          self.contents.draw_paragraph(0, WLH, self.width - 50, self.height, HIDDEN_ENTRY_TEXT)
        else
          self.contents.draw_paragraph(0, WLH, self.width - 50, self.height, @entry)
        end
      end
     
     
      def change_heading(heading)
        @heading = heading
      end
     
      def change_text(entry)
        @entry = entry
      end
     
     
    end
     
    ################################################################################
    #                  WINDOW: ENCYCLOPEDIA TITLE
    ################################################################################
     
    class Window_PediaTitle < Window_Base
     
      include GAMEPEDIA
     
      def initialize(x, y)
        super(x, y, 304, 70)
        if NEW_WINDOWSKIN
          self.windowskin = Cache.system(GP_WINDOWSKIN)
        end
        refresh
      end
     
      def refresh
        et = ENCYCLOPEDIA_TITLE
        self.contents.clear
        self.contents.font.color = text_color(TITLE_COLOR)
        self.contents.draw_text(-16, 0, self.width, WLH, et, 1)
      end
     
    end
     
    ################################################################################
    #                        SCENE: TITLE
    ################################################################################
    class Scene_Title < Scene_Base
     
      alias nq_st_create_game_objects create_game_objects unless $@
      def create_game_objects
        nq_st_create_game_objects
        $gamepedia = Gamepedia.new
      end
     
    end
     
    ################################################################################
    #                         SCENE: MENU
    ################################################################################
    class Scene_Menu < Scene_Base
     
      include GAMEPEDIA
     
      alias nq_create_command_window create_command_window unless $@
      def create_command_window
        if USE_FROM_MENU
          s1 = Vocab::item
          s2 = Vocab::skill
          s3 = Vocab::equip
          s4 = Vocab::status
          s5 = GAMEPEDIA_MENU_COMMAND
          s6 = Vocab::save
          s7 = Vocab::game_end
          @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
          @command_window.index = @menu_index
          if $game_party.members.size == 0          # If number of party members is 0
            @command_window.draw_item(0, false)     # Disable item
            @command_window.draw_item(1, false)     # Disable skill
            @command_window.draw_item(2, false)     # Disable equipment
            @command_window.draw_item(3, false)     # Disable status
          end
          if $game_system.save_disabled             # If save is forbidden
            @command_window.draw_item(4, false)     # Disable save
          end
        else
          nq_create_command_window
        end
      end
     
      alias nq_update_command_selection update_command_selection unless $@
      def update_command_selection
        if USE_FROM_MENU
          if Input.trigger?(Input::B)
            Sound.play_cancel
            $scene = Scene_Map.new
          elsif Input.trigger?(Input::C)
            if $game_party.members.size == 0 and @command_window.index < 4
              Sound.play_buzzer
              return
            elsif $game_system.save_disabled and @command_window.index == 4
              Sound.play_buzzer
              return
            end
            Sound.play_decision
            case @command_window.index
            when 0      # Item
              $scene = Scene_Item.new
            when 1,2,3  # Skill, equipment, status
              start_actor_selection
            when 4
              $game_temp.pedia_menu = true
              $scene = Scene_Gamepedia.new
            when 5      # Save
              $scene = Scene_File.new(true, false, false)
            when 6      # End Game
              $scene = Scene_End.new
            end
          end
        else
          nq_update_command_selection
        end
      end
     
     
    end
     
     
     
    ################################################################################
    #                        SCENE: FILE
    ################################################################################
     
    class Scene_File < Scene_Base
     
      alias nq_sfile_write_save_data write_save_data
      def write_save_data(file)
        nq_sfile_write_save_data(file)
        Marshal.dump($gamepedia, file)
      end
     
      alias nq_sfile_read_save_data read_save_data
      def read_save_data(file)
        nq_sfile_read_save_data(file)
        $gamepedia = Marshal.load(file)
      end
     
    end
     
    ################################################################################
    #                        SCENE: ENCYCLOPEDIA
    ################################################################################
     
    class Scene_Gamepedia < Scene_Base
     
      include GAMEPEDIA
     
      def start
        super
        create_menu_background
        @win_title = Window_PediaTitle.new(241, 0)
        @win_subjects = Window_PediaSubjects.new(0, 0)
        @win_topics = Window_PediaTopics.new(121, 0)
        get_current_heading
        get_current_entry
        @win_viewtopic = Window_PediaViewTopic.new(241, 71, @cur_head, @cur_entry)
        activate_subjects
      end
     
      #-----------------------------------------------------------------------------
      #                        Get Current Entry Heading
      #-----------------------------------------------------------------------------
      def get_current_heading
        @cur_head = $gamepedia.topics[@win_subjects.index][@win_topics.index]
      end
     
      #-----------------------------------------------------------------------------
      #                     Get Current Entry Text
      #-----------------------------------------------------------------------------
      def get_current_entry
        $gamepedia.get_entries(@win_subjects.index)
        if @cur_head == "???????"
          @cur_entry = HIDDEN_ENTRY_TEXT
        else
          @cur_entry = ENTRIES[$gamepedia.entries[@win_topics.index]]
        end
      end
     
      #-----------------------------------------------------------------------------
      #                           Update
      #-----------------------------------------------------------------------------
      def update
        super
        update_menu_background
        @win_title.refresh
        if @win_subjects.active
          update_subject_selection
        elsif @win_topics.active
          update_topic_selection
        end
      end
     
      #-----------------------------------------------------------------------------
      #                    Activate Topics Window
      #-----------------------------------------------------------------------------
     
      def activate_topics
        @win_subjects.active = false
        $game_temp.last_pediasubject = @win_subjects.index
        @win_topics.cur_subject = @win_subjects.index
        @win_viewtopic.cur_subject = @win_subjects.index
        @win_topics.refresh
        @win_viewtopic.refresh
        @win_topics.active = true
      end
     
      #-----------------------------------------------------------------------------
      #                    Activate Subjects Window
      #-----------------------------------------------------------------------------
      def activate_subjects
        @win_topics.active = false
        @win_topics.index = 0
        @win_subjects.index = $game_temp.last_pediasubject
        @win_subjects.active = true
      end
     
      #-----------------------------------------------------------------------------
      #                       Update Subject Selection
      #-----------------------------------------------------------------------------
       
      def update_subject_selection
        @win_subjects.update
        if Input.trigger?(Input::B)
          Sound.play_cancel
          if $game_temp.pedia_menu
            $scene = Scene_Menu.new
            $game_temp.pedia_menu = false
          else
            $scene = Scene_Map.new
          end
        elsif Input.trigger?(Input::C)
          if $gamepedia.hidden_subjects.include?($gamepedia.subjects[@win_subjects.index])
            Sound.play_buzzer
          else
            Sound.play_decision
            @win_topics.change_commands(@win_subjects.index)
            @win_topics.refresh
            get_current_heading
            get_current_entry
            @win_viewtopic.change_heading(@cur_head)
            @win_viewtopic.change_text(@cur_entry)
            @win_viewtopic.refresh
            activate_topics
          end
        end
      end
     
      #-----------------------------------------------------------------------------
      #                      Update Topic Selection
      #-----------------------------------------------------------------------------
     
      def update_topic_selection
        @win_topics.update
        @win_viewtopic.topic_dex = @win_topics.index
        if Input.trigger?(Input::B)
          Sound.play_cancel
          activate_subjects
        elsif Input.trigger?(Input::C)
          if $gamepedia.hidden_topics.include?($gamepedia.topics[@win_subjects.index][@win_topics.index])
            Sound.play_buzzer
          else
            Sound.play_decision
            @win_topics.refresh
            get_current_heading
            get_current_entry
            @win_viewtopic.change_heading(@cur_head)
            @win_viewtopic.change_text(@cur_entry)
            @win_viewtopic.refresh
          end
        end
      end
     
      #-----------------------------------------------------------------------------
      #                       Terminate
      #-----------------------------------------------------------------------------
      def terminate
        @win_title.dispose
        @win_subjects.dispose
        @win_topics.dispose
        @win_viewtopic.dispose
      end
     
    end




HOW YOU CAN HELP?
Post errors in the comments.  Post bugs and glitches.  Be as explanatory as possible. 
Offer new ideas to expand or improve the script.  (I reserve the right to turn the said idea down, of course!)
Test it out, see what you think.
Feedback.  Lots of Feedback.

Hope you enjoy it!
« Last Edit: August 14, 2014, 07:27:16 AM by IXFURU »

**
Rep: +0/-0Level 74
RMRK Junior
Very good script, I tried it and it was excellent. Yes you could put pictures under the letters of each section would be great.

Thank you!
Power of dogs!


*
RMRK's dad
Rep:
Level 86
You know, I think its all gonna be okay.
For going the distance for a balanced breakfast.Project of the Month winner for June 2009For being a noted contributor to the RMRK Wiki2013 Best WriterSilver Writing ReviewerSecret Santa 2013 Participant
Going in the game, dude.
:tinysmile:

***
Rep:
Level 75
What the...?
Thanks for the feedback guys.  There's an updated version of this script that I need to bring over to the site.  Sorry I haven't been around to manage some of my work. 

*
RMRK's dad
Rep:
Level 86
You know, I think its all gonna be okay.
For going the distance for a balanced breakfast.Project of the Month winner for June 2009For being a noted contributor to the RMRK Wiki2013 Best WriterSilver Writing ReviewerSecret Santa 2013 Participant
It's cool. I have your script running, but not yet configured- so if you get the update up soon, I'll definitely try it!
:tinysmile:

***
Rep:
Level 75
What the...?
I know it's been a long wait for this, but I just updated this post.  The script is now 2.0, where you have the ability to hide/reveal topics at runtime with script calls.  Also, this newer version has much less lag.

My plan is to update this script again soon, but we'll see.  I want to remove the requirement for MA's Paragraph Formatter and possibly add the ability to use images in the scene.  But for now, this will have to suffice.