Submit Your Article


 
RPG Maker

Welcome Guest ( Log In | Register )


  Games Resources RPG Maker VX RPG Maker XP Scripts Tutorials Downloads

 
Reply to this topicStart new topic
> Multiple Windowskins, Enable ability to use mulitple windowskins for any window.
deadlydan
post Jan 25 2008, 09:10 PM
Post #1


Level 5
Group Icon

Group: Member
Posts: 71
Type: Event Designer
RM Skill: Masterful




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_WindowSkin
CODE
#==============================================================================
# ■ 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


__________________________
Go to the top of the page
 
+Quote Post
   
alucart13
post Jan 30 2008, 03:28 PM
Post #2


Level 1
Group Icon

Group: Member
Posts: 12
Type: Event Designer
RM Skill: Masterful




Thats pretty cool. Thanks mate
Go to the top of the page
 
+Quote Post
   
lahandi
post Feb 14 2008, 09:17 AM
Post #3


Level 8
Group Icon

Group: Revolutionary
Posts: 111
Type: Artist
RM Skill: Skilled




Mr. Deadlydan,

It would be nice if you can post the demo here, so that we can know the size of each window and from that we can prepared the same size picture to fill each window.

smile.gif


__________________________
Go to the top of the page
 
+Quote Post
   
FireRMVX
post Aug 14 2009, 04:59 PM
Post #4


Level 5
Group Icon

Group: Member
Posts: 60
Type: Mapper
RM Skill: Intermediate




One question, can i use this for diff towns like one town is this windowskin and another is this?


__________________________
If you can read this, you passed kindergarten.

The following sentence is true. The previous sentance is false. This sentance is a lie
Parllexes rule!

Personality:
Others see you as fresh, lively, charming, amusing, practical, and always interesting; someone who's constantly in the center of attention, but sufficiently well-balanced not to let it go to their head. They also see you as kind, considerate, and understanding; someone who'll always cheer them up and help them out.

Last words:
GET THIS THING OFF ME!!


Gangster name:
Scrappy

AND LASTLY...
I
AM
A
DARK
ANGEL!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
**Updated stuff**

[Show/Hide] Siggy Stuff



[u][img]
http://www.runwithgod.com/romans12/images/...b3eb789e9d2.jpg

[/img]








Most importantly children:

[/u
]
Go to the top of the page
 
+Quote Post
   

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 19th June 2013 - 11:57 AM
RPG RPG Revolution is an Privacy Policy and Legal
eXTReMe Tracker