#=============================================================================== # # Yanfly Engine - IconView # Last Date Updated: 2009.03.27 # Level: Easy # # Don't know how to use Photoshop's X and Y coordinates to count your icons or # just too lazy to do it? Well, you can use this tool to make your life easier # by loading up the icons on a static sheet and figuring out what those icons # are indexed as. This script will mark 256 icons per page and allows you to # scroll through those pages as lagless as possible. The icons are displayed # in columns of 16 icons each, following exactly the way your IconSet is made # (or should be made). # #=============================================================================== # Instructions #=============================================================================== # # Fire up your game in test mode. It'll display an extra option at the main menu # which pulls up your icons and their icon index numbers for you. If the fourth # option doesn't show up, then check IV_ENABLE to see if it's set to "true" # instead of "false" since that triggers it, too. # # Note, when playing the game normally and not from RPG Maker VX, the IconView # option won't show up at all. # #=============================================================================== # Updates: # ---------------------------------------------------------------------------- # o 2009.03.30 - Started script. #=============================================================================== # # Compatibility # - Overwrites: Scene_Title, create_command_window, update # #=============================================================================== $imported = {} if $imported == nil $imported["IconView"] = true module YE module TOOLS module ICONVIEW # Set this to true to enable IconView when you test run your game. IV_ENABLE = true # This is what you named your IconSet in the System Folder: ICONSET = "IconSet" # This is what shows up under your shutdown option at the title screen. IV_NAME = "IconView" # Show this icon if that icon doesn't exist in your IconSet. EMPTYICON = 23 end end end #=============================================================================== # Don't touch anything past here or else your computer will explode and you will # be a very sad person. #=============================================================================== #============================================================================== # Scene IconView #============================================================================== class Scene_IconView < Scene_Base #-------------------------------------------------------------------------- # Start #-------------------------------------------------------------------------- def start create_icon_window create_page_window @last_index = 256 @up_page = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15] @dn_page = [255,254,253,252,251,250,249,248,247,246,245,244,243,242,241,240] @icon_window.update_icons(@page_window.index, @total_icons) @icon_id_window = Window_Base.new (0, 0, 128, 80) @instruction_window = Window_Base.new (0, 336, 128, 80) instruct1 = "L:PageUp" instruct2 = "R:PageDn" @instruction_window.contents.draw_text(4, 0, 88, 24, instruct1, 1) @instruction_window.contents.draw_text(4, 24, 88, 24, instruct2, 1) end #-------------------------------------------------------------------------- # Terminate #-------------------------------------------------------------------------- def terminate @icon_window.dispose @page_window.dispose @icon_id_window.dispose @instruction_window.dispose end #-------------------------------------------------------------------------- # Update #-------------------------------------------------------------------------- def update @icon_window.update update_icon_id_window if Input.repeat?(Input::L) pageup elsif Input.repeat?(Input::R) pagedn elsif Input.trigger?(Input::B) Sound.play_cancel $scene = Scene_Title.new end end #-------------------------------------------------------------------------- # Page Up and Page Down #-------------------------------------------------------------------------- def pageup Sound.play_decision @page_window.index -= 1 @page_window.index = (@totalpages - 1 )if @page_window.index < 0 @icon_window.update_icons(@page_window.index, @total_icons) @page_window.update force_update_id end def pagedn Sound.play_decision @page_window.index += 1 @page_window.index = 0 if @page_window.index > (@totalpages - 1) @icon_window.update_icons(@page_window.index, @total_icons) @page_window.update force_update_id end #-------------------------------------------------------------------------- # Update Icon ID Window #-------------------------------------------------------------------------- def update_icon_id_window if @last_index != @icon_window.index force_update_id end end #-------------------------------------------------------------------------- # Update Icon ID Window #-------------------------------------------------------------------------- def force_update_id @icon_id_window.contents.clear # @icon_id_window.contents.font.size = 24 id_text = sprintf("Icon %d", @page_window.index * 256 + @icon_window.index) @icon_id_window.contents.draw_text(4, 0, 88, 24, id_text, 1) # @icon_id_window.contents.font.size = 24 id_total = sprintf("Total: %d", @total_icons - 1) @icon_id_window.contents.draw_text(4, 24, 88, 24, id_total, 1) @last_index = @icon_window.index end #-------------------------------------------------------------------------- # Create Icon Window #-------------------------------------------------------------------------- def create_icon_window icon_list = [] for i in 1..256 icon_list.push (" ") end @icon_window = Window_Command.new(416, icon_list, 16, 16, 0) @icon_window.x = 128 end #-------------------------------------------------------------------------- # Create Page Window #-------------------------------------------------------------------------- def create_page_window iconset = Cache.system(YE::TOOLS::ICONVIEW::ICONSET) iconrow = iconset.height / 24 iconcol = iconset.width / 24 @total_icons = iconrow * iconcol @totalpages = @total_icons / 256 @totalpages += 1 if iconrow > (@totalpages * 256 / iconcol) page_list = [] for i in 1..@totalpages page_list.push (sprintf("Page %d", i)) end @page_window = Window_Command.new(128, page_list, 1, @totalpages) @page_window.y = 80 @page_window.height = 256 @page_window.active = false iconset.dispose end end #============================================================================== # Window_Base #============================================================================== class Window_Base < Window #-------------------------------------------------------------------------- # Update Icons #-------------------------------------------------------------------------- def update_icons(page_number, total_icons) self.contents.clear iconrow = 0 iconcol = 0 icon_index = page_number * 256 for i in 1..256 draw_icon(icon_index, iconcol * 24, iconrow * 24) if icon_index < total_icons draw_icon(YE::TOOLS::ICONVIEW::EMPTYICON, iconcol * 24, iconrow * 24) if icon_index >= total_icons icon_index += 1 iconcol += 1 if iconcol == 16 iconcol = 0 iconrow += 1 end end end end #============================================================================== # Scene_Title #============================================================================== class Scene_Title < Scene_Base #----------------------------------------------------------------------------- if $TEST and YE::TOOLS::ICONVIEW::IV_ENABLE #--------------------------------- #----------------------------------------------------------------------------- #-------------------------------------------------------------------------- # Create Command Window #-------------------------------------------------------------------------- def create_command_window s1 = Vocab::new_game s2 = Vocab::continue s3 = Vocab::shutdown s4 = YE::TOOLS::ICONVIEW::IV_NAME @command_window = Window_Command.new(172, [s1, s2, s3, s4]) @command_window.x = (544 - @command_window.width) / 2 @command_window.y = 256 if @continue_enabled # If continue is enabled @command_window.index = 1 # Move cursor over command else # If disabled @command_window.draw_item(1, false) # Make command semi-transparent end @command_window.openness = 0 @command_window.open end #-------------------------------------------------------------------------- # Frame Update #-------------------------------------------------------------------------- def update super @command_window.update if Input.trigger?(Input::C) case @command_window.index when 0 command_new_game when 1 command_continue when 2 command_shutdown when 3 command_iconview end end end #-------------------------------------------------------------------------- # Command IconView #-------------------------------------------------------------------------- def command_iconview Sound.play_decision close_command_window $scene = Scene_IconView.new end #-------------------------------------------------------------------------- # End for Testing #-------------------------------------------------------------------------- #----------------------------------------------------------------------------- end #------------------------------------------------------------------------- #----------------------------------------------------------------------------- end #=============================================================================== # # END OF FILE # #===============================================================================