Help - Search - Members - Calendar
Full Version: Use iconsets in XP
RPG RPG Revolution Forums > Scripting > Script Submissions > RGSS-Submissions
Legacy
VX iconsets in XP - by LegACy
Version 1.0


Description:
This little snippet allows you to use IconSets instead of single files for icons, just like VX. Easy to install and easy to use.

Compatibility:
no issues so far.

Screenshots:


Instructions:

Place above main, and above any custom scripts. So, place under Scene_Debug.

to use follow this syntax: draw_icon(file_name, icon_index, x, y)
- file_name : the file name for the iconset
- icon_index : Icon number
- x : draw spot x-coordinate
- y : draw spot y-coordinate

* All iconsets must be placed in the Pictures folder.

for the VX iconset, and the set used in the Example please use this:



Main Script:

CODE

#=======================================================
# ~** VX iconsets in XP **~
#=======================================================
# Author: LegACy (LegacyX)
# Version: 1.0
# Build Date: 2009-02-26
#-------------------------------------------------------------------------------
#
# This little snippet allows you to use VX iconsets in XP
#
#========================================================

class Window_Base < Window
#--------------------------------------------------------------------------
# * Draw Icon
# file_name : the file name for the iconset
# icon_index : Icon number
# x : draw spot x-coordinate
# y : draw spot y-coordinate
# enabled : Enabled flag. When false, draw semi-transparently.
#--------------------------------------------------------------------------
def draw_icon(file_name,icon_index, x, y, enabled = true)
bitmap = RPG::Cache.picture(file_name.to_s)
rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
self.contents.blt(x, y, bitmap, rect, enabled ? 255 : 128)
end

end


Example Window using this script:

CODE

class Sample_Window < Window_Base
#----------------------------------------------------------------------
# * Object Initialization
#----------------------------------------------------------------------
def initialize
super(20, 20, 100, 100)
self.contents = Bitmap.new(width - 32, height - 32)
refresh # Calls the refresh function in this class
end

def refresh
self.contents.clear
# file name is " IconSet", icon is the 5th in the set.
self.draw_icon("IconSet", 5, 20, 30)
end

end


To test this, make a new event, then add a call event and paste this: Sample_Window.new



Any problems or questions please ask. ~LegACy
jens009
I was actually thinking of making this. It's good that I looked first before "reinventing the wheel" eh? haha.

Good job scripting it!
Legacy
ha thanks jens, no body really commented on this, so i didnt know if it was going to be of any use. lmao.
DragoonHP
It's a cool script. Now I don't have to rip icons from the iconfile.

Thanks
That_Guy
Arg. I'm getting Syntax Error what did I do wrong?
Legacy
Screenshot of the error would be good. otherwise i don't know what you're doing wrong.
That_Guy
Of course, sorry for the vague comment rolleyes.gif

Here's the common event:
Image


Here's the call event:
Image


And here's the wonderful error:
Image


It's probably something stupid I did

Edit: Put spoilers on images
Legacy
Well firstly, you dont need to put scripts in common event boxes. put them in the script editor then call them.
That_Guy
I know I just did it because I thought I would be using it a lot. Did you see anything wrong?
Legacy
nothing will be wrong if you put it in the script editor, it's wrong because the call script box cuts off lines and makes the script error.
That_Guy
Ah I figured it out. I got confused lol
So, is there a way to use icons from an IconSet for weapon and armor icons in the database?
Legacy
Not at the moment, not unless i recreate the database in C# or Ruby or something. Which i probably could do, but it seems a little too much effort to do right at the moment.
That_Guy
Well, thanks for the great script! I'll be sure to credit happy.gif
chorrol
Does this work for items and weapons, etc.?
Legacy
It uses iconsets, so you can create your own scenes using iconsets instead of single icons. If you want to use iconsets in the database then i would have to recreate the database to allow this.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.