Keyword Encyclopedia é um script desenvolvido por SephirothSpawn para o RPG Maker XP que foi projetado para permitir ao desenvolvedor de um game/projeto definir Keywords e descrições para palavras.
Qualquer coisa que você colocar na janela de mensagem muda de uma cor para a cor definida. Leia os comentários no script para ver as instruções de personalização.
Este script precisa do precisa do Standard Development Kit para funcionar, e deve ser adicionado abaixo deste e acima do Main.
#============================================================================== # ** Keyword Encyclopedia #------------------------------------------------------------------------------ # SephirothSpawn # Version 1 # 2006-09-09 #------------------------------------------------------------------------------ # * Description : # # This script was designed to allow you to set "keywords" and descriptions # for your words. It reads anything you place in the message window, # changes it to the color to a defined color. #------------------------------------------------------------------------------ # * Instructions : # # Place The Script Below the SDK and Above Main. # To Customize your keywords, refer to the customization instructions. #------------------------------------------------------------------------------ # * Customization : # # Setting Unknown Word Display and Description (Will Appear on Encylopedia) # - Unknown_Word_Display = '_______' # - Unknown_Word_Description = '___________' # # Setting Up Keywords and Description # - Key_Words = {'keyword' => 'description', ...} # # Setting Up Keyword Colors # - Default_Keyword_Color = n # - Keyword_Colors = {'keyword' => n, ...} # # Colors (n) Replace with: # 0 : White 1 : Dark Blue # 2 : Red 3 : Green # 4 : Light Blue 5 : Purple # 6 : Yellow 7 : Gray #------------------------------------------------------------------------------ # * Syntax : # # Opening Word Encyclopedia # - $scene.open_wordenc #============================================================================== #------------------------------------------------------------------------------ # * SDK Log Script #------------------------------------------------------------------------------ SDK.log('Keyword Encyclopedia ', 'SephirothSpawn', 1, '2006-09-09') #------------------------------------------------------------------------------ # * Begin SDK Enable Test #------------------------------------------------------------------------------ if SDK.state('Keyword Encyclopedia ') #============================================================================== # ** Game_WordEncyclopedia #============================================================================== class Game_WordEncyclopedia #-------------------------------------------------------------------------- # * Unknown Word Display #-------------------------------------------------------------------------- Unknown_Word_Display = '------' Unknown_Word_Description = '------' #-------------------------------------------------------------------------- # * Key Words (Non-case sensitive) # # ~ Key_Words = { 'keyword' => 'description' #-------------------------------------------------------------------------- Key_Words = { 'This' => 'Just some word. Now I will take up some space for a ' + 'description. blah blah blah blah', 'Special' => 'another test', 'Blah' => 'Sarcastic Word to take up space' } #-------------------------------------------------------------------------- # * Key Word Coloring # # ~ Default Keyword Color # Default_Keyword_Color = n # # ~ Special Word Coloring # Keyword_Colors = { 'special keyword' => n # # The Text Colors are the colors you would use when you use \c[n]. # By Default, these are the colors: # # 0 : White 1 : Dark Blue # 2 : Red 3 : Green # 4 : Light Blue 5 : Purple # 6 : Yellow 7 : Gray #-------------------------------------------------------------------------- Default_Keyword_Color = 1 Keyword_Colors = { 'this' => 2 } #-------------------------------------------------------------------------- # * Public Instance Variables #-------------------------------------------------------------------------- attr_reader :known_words #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize @known_words = [] end #-------------------------------------------------------------------------- # * Scan Text (Is Preformed Before Each Message Display) #-------------------------------------------------------------------------- def scan_text # Checks All Words In Text for word in $game_temp.message_text.split # Delete All Non Letters word.gsub!(/(\W+)/, '') # Test For Key Word keyword = false Key_Words.keys.each do |x| if x.downcase == word.downcase keyword = true break end end # If Word is a Key Word if keyword # Memorize Key Word @known_words << word.downcase # Change Text Color c = Keyword_Colors.has_key?(word) ? Keyword_Colors[word] : Default_Keyword_Color $game_temp.message_text.gsub!(word, '\c' + "[#{c}]" + word + '\c[0]') end end end end #============================================================================== # ** Window_Message #============================================================================== class Window_Message #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- alias seph_wordenc_wdmsg_refresh refresh def refresh $game_wordenc.scan_text seph_wordenc_wdmsg_refresh end end #============================================================================== # ** Window_WordEncyclopedia #============================================================================== class Window_WordEncyclopedia < Window_Base #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize super(32, 256, 576, 192) self.contents = Bitmap.new(width - 32, height) self.oy = 16 @index = 0 # Sets Up Word Listing set_words # Refreshes Window Contents refresh end #-------------------------------------------------------------------------- # * Set Words #-------------------------------------------------------------------------- def set_words @data = [] for word in Game_WordEncyclopedia::Key_Words.keys if $game_wordenc.known_words.include?(word.downcase) @data << word else @data << Game_WordEncyclopedia::Unknown_Word_Display end end @item_max = @data.size end #-------------------------------------------------------------------------- # * Refresh #-------------------------------------------------------------------------- def refresh self.contents.clear # Draw Previous Word word = @index == 0 ? @data[@item_max - 1] : @data[@index - 1] self.contents.font.size = 16 self.contents.font.color = system_color self.contents.draw_text(0, 16, contents.width, 16, word, 1) # Draw Current Word & Description word = @data[@index] self.contents.font.size = 22 self.contents.draw_text(8, 32, contents.width, 24, 'Keyword:') self.contents.draw_text(8, 56, contents.width, 24, 'Description:') self.contents.font.color = normal_color ox = contents.text_size('Keyword:').width + 8 self.contents.draw_text(8 + ox, 32, contents.width - 8 - ox, 24, word) ox = contents.text_size('Description:').width + 4 if $game_wordenc.known_words.include?(word.downcase) description = Game_WordEncyclopedia::Key_Words[word] else description = Game_WordEncyclopedia::Unknown_Word_Description end self.contents.draw_paragraph(16, 56, contents.width - 16, description, ox) # Draw Next Word word = @index == @item_max - 1 ? @data[0] : @data[@index + 1] self.contents.font.size = 16 self.contents.font.color = system_color self.contents.draw_text(0, 144, contents.width, 16, word, 1) end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # If Up is Pressed if Input.repeat?(Input::UP) $game_system.se_play($data_system.cursor_se) @index == 0 ? @index = @item_max - 1 : @index -= 1 refresh end # If Down is Pressed if Input.repeat?(Input::DOWN) $game_system.se_play($data_system.cursor_se) @index == @item_max - 1 ? @index = 0 : @index += 1 refresh end # Update Cursor Rect update_cursor_rect end #-------------------------------------------------------------------------- # * Update Cursor Rectangle #-------------------------------------------------------------------------- def update_cursor_rect # Update cursor rectangle self.cursor_rect.set(4, 16, self.contents.width - 8, 112) end end #============================================================================== # ** Scene_Map #============================================================================== class Scene_Map #-------------------------------------------------------------------------- # * Alias Listings #-------------------------------------------------------------------------- alias seph_wordenc_scnmap_update update #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update # If Word Encyclopedia Active unless @seph_wordenc_window.nil? update_seph_wordenc return end # Original Update seph_wordenc_scnmap_update end #-------------------------------------------------------------------------- # * Frame Update : Seph Word Encyclopedia #-------------------------------------------------------------------------- def update_seph_wordenc # Update Shift Puzzle Window @seph_wordenc_window.update # Update Map and Spriteset $game_map.update $game_system.map_interpreter.update $game_system.update $game_screen.update @spriteset.update @message_window.update # If B Button is Pressed if Input.trigger?(Input::B) # Play Unsolved SE $game_system.se_play($data_system.cancel_se) # Dispose Window @seph_wordenc_window.dispose @seph_wordenc_window = nil end end #-------------------------------------------------------------------------- # * Open Word Encyclopedia #-------------------------------------------------------------------------- def open_wordenc # Creates Word Enc Window @seph_wordenc_window = Window_WordEncyclopedia.new end end #============================================================================== # ** Scene_Title #============================================================================== class Scene_Title #-------------------------------------------------------------------------- # * Command : New Game #-------------------------------------------------------------------------- alias seph_wordenc_scnttl_cng command_new_game def command_new_game # Original Command New Game seph_wordenc_scnttl_cng # Creates Word Encyclopedia Game Data $game_wordenc = Game_WordEncyclopedia .new end end #============================================================================== # ** Scene_Save #============================================================================== class Scene_Save #-------------------------------------------------------------------------- # * Command : New Game #-------------------------------------------------------------------------- alias seph_wordenc_scnsave_wd write_data def write_data(file) # Original Write Data seph_wordenc_scnsave_wd(file) # Saves Word Encyclopedia Data Marshal.dump($game_wordenc, file) end end #============================================================================== # ** Scene_Load #============================================================================== class Scene_Load #-------------------------------------------------------------------------- # * Command : New Game #-------------------------------------------------------------------------- alias seph_wordenc_scnload_rd read_data def read_data(file) # Original Write Data seph_wordenc_scnload_rd(file) # Saves Word Encyclopedia Data $game_wordenc = Marshal.load(file) end end #------------------------------------------------------------------------------ # * End SDK Enable Test #------------------------------------------------------------------------------ end
Observação: se você gostou deste post ou ele lhe foi útil de alguma forma, por favor considere apoiar financeiramente a Gaming Room. Fico feliz só de ajudar, mas a contribuição do visitante é muito importante para que este site continua existindo e para que eu possa continuar provendo este tipo de conteúdo e melhorar cada vez mais. Acesse aqui e saiba como. Obrigado!