Hi guys, this is another script i just wrote, it enables the ability to use multiple windowskins in any window class that you create.
Here is a screenshot of the result of a test i did:

Here is the script source:
( Note: The script itself contains information on how to use the additions.)DeadlyDan_WindowSkinCODE
#==============================================================================
# ■ DeadlyDan_WindowSkin, by DeadlyDan
#------------------------------------------------------------------------------
# Allows to specify a custom windowskin when creating windows.
#==============================================================================
# Usage:
=begin
When creating your window, you need to specify a windowskin name, by default it chooses "Window"
For example:
--------------------------------------------------------------------------
--------------------------------------------------------------------------
class Window_Test < Window_Base
def initialize ( x, y, w, h )
super ( x, y, w, h, "Window2" )
end
end
$window = Window_Test.new ( 0, 0, 320, 240 )
--------------------------------------------------------------------------
--------------------------------------------------------------------------
You can create this window normally and it will set the skin accordingly.
(NOTE)
When using this with non Window_Base inherited classes, because the limitations of ruby you must specify
all default parameters before setting the window skin. For example:
Using it with a Window_Selectable inherited class you must call it like so:
--------------------------------------------------------------------------
--------------------------------------------------------------------------
class Window_Test < Window_Selectable
def initialize ( x, y, w, h )
super ( x, y, w, h, 32, "Window2" )
end
end
$window = Window_Test.new ( 0, 0, 320, 240 )
--------------------------------------------------------------------------
--------------------------------------------------------------------------
Notice the "32" parameter, this is the spacing parameter of Window_Selectable. This rule of putting all
parameters applies for any Window_* class you want to use a different windowskin with.
=end
class Window_Base < Window
def initialize ( x, y, width, height, skin = "Window" )
super ( )
self.windowskin = Cache.system ( skin )
self.x = x
self.y = y
self.width = width
self.height = height
self.z = 100
self.back_opacity = 200
self.openness = 255
create_contents
@opening = false
@closing = false
end
end
class Window_Selectable < Window_Base
def initialize ( x, y, width, height, spacing = 32, skin = "Window" )
@item_max = 1
@column_max = 1
@index = -1
@spacing = spacing.to_i
super ( x, y, width, height, skin )
end
end
class Window_Command < Window_Selectable
def initialize ( width, commands, column_max = 1, row_max = 0, spacing = 32, skin = "Window" )
if ( row_max == 0 )
row_max = ( commands.size + column_max - 1 ) / column_max
end
super ( 0, 0, width, row_max * WLH + 32, spacing, skin )
@commands = commands
@item_max = commands.size
@column_max = column_max
refresh
self.index = 0
end
end
class Window_Message < Window_Selectable
def initialize ( skin = "Window" )
super ( 0, 288, 544, 128, 32, skin )
self.z = 200
self.active = false
self.index = -1
self.openness = 0
@opening = false
@closing = false
@text = nil
@contents_x = 0
@contents_y = 0
@line_count = 0
@wait_count = 0
@background = 0
@position = 2
@show_fast = false
@line_show_fast = false
@pause_skip = false
create_gold_window
create_number_input_window
create_back_sprite
end
end
class Window_Item < Window_Selectable
def initialize ( x, y, width, height, skin = "Window" )
super ( x, y, width, height, skin )
@column_max = 2
self.index = 0
refresh
end
end
The source code for my example is:
( Note: "Window2" and "Window3" are *.png files in the project System directory. The following code over-rides the RMVX ones as an example.)CODE
class Window_MenuStatus < Window_Selectable
def initialize ( x, y )
super ( x, y, 384, 416, 32, "Window2" )
refresh
self.active = false
self.index = -1
end
end
class Window_Gold < Window_Base
def initialize ( x, y )
super ( x, y, 160, WLH + 32, "Window3" )
refresh
end
end
This post has been edited by deadlydan: Jan 25 2008, 10:08 PM