Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

[VX] IconView

IconView
Last Update: 2009.03.27
By: Yanfly

Introduction
The reason I made this is so that I could figure out which ID numbers some icons had and Woratana's version lags horribly on a large iconsheet since I have a slow slow slow computer. This one doesn't load up the whole sheet at once, but instead, only loads up a 16 by 16 grid of the icons on that sheet, and inputs them out individually onto a window.

Screenshots
iconview_new.jpg


Script
Code:
#===============================================================================

#

# 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.

#

#===============================================================================

#

# Compatibility

# - Overwrites: Scene_Title, create_command_window

# - Overwrites: Scene_Title, 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

#

#===============================================================================

Instructions
Just put it under Materials somewhere. When you launch your game in Test Mode (like you normally would if you launch the game in RPG Maker VX), you'll notice a fourth option in your title menu called "IconView." Just select that and you'll have access to the screen you see above. During a non-test run of the executable, this option won't appear at all.

Download the IconSet
For those who would like the iconset used in the screenshot, you can download it here. Just remember to name it as IconSet.png in your system folder.
guildwarsicons.png

Terms and Conditions
This is just for utility to provide ease for figuring out Icon ID's. Just give credit where due.

Credits and Thanks
-Woratana for the initial idea
-Guild Wars/Arena Net for icons

Originally Found Here: http://pockethouse.wordpress.com/vx/iconview/
 
So, lemme say first that this isn't meant as harassing or whatever... but I don't really see the reason why you'd need that script... what you need is y-value of icon * 16 + x-value... if you calculate x and y by using Photoshop's info values / 16, you don't even need to count...

Other than that, I like your code style. Easily overviewable and almost perfectly efficient. What you shouldn't do probably is 'your computer will explode and you'll be sad' - there are scripters among the users of that script as well, so if you want to include a message like that, tell the people either to only edit if they know what they're doing, or what the script below that point does and why it should be left alone.
This might not be professional business, but it'll never be professional if you don't start it. ;)

Keep up the good work.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top