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 Windowskin Scriptlet

VX Windowskin Scriptlet
by Kyonides-Arkanthos

Features:

It just lets you change your game's windowskin during gameplay by calling a scene script or just by typing a single command in a script call.

Script Call: RPGWindow.skin = 'File'
Scene Script Call: $scene = Scene_SetWindowskin.new

[rgss]#  VX Windowskin Scriptlet
#  by Kyonides-Arkanthos alias Kyonides, Shadowball
#  03.12.2010
 
#  Script Call:        RPGWindow.skin = 'File'
#  Scene Script Call:  $scene = Scene_SetWindowskin.new
module RPGWindow
  def self.skin=(filename)
    @filename = filename
    @windowskin = filename.is_a?(String) ? Cache.system(filename) : filename
  end
 
  def self.skin; @windowskin end
 
  def self.name; @filename end
end
 
class Window_Base
  Windowskin = Cache.system('Window')
  def initialize(x, y, width, height)
    super()
    self.windowskin = RPGWindow.skin.nil? ? Windowskin : RPGWindow.skin
    self.x, self.y, self.z = x, y, 100
    self.width, self.height = width, height
    self.back_opacity, self.openness = 200, 255
    create_contents
    @opening, @closing = false, false
  end
 
  alias :kyon_skin_win_base_up :update
  def update
    if !RPGWindow.skin.nil? and self.windowskin != RPGWindow.skin
      self.windowskin = RPGWindow.skin
    end
    kyon_skin_win_base_up
  end
end
 
# Array Add-on - original de Kyonides-Arkanthos
class Array
  def now; return if @pos.nil?; return self[@pos] end
 
  def now=(value); @pos = value end
 
  def index_now; return !@pos.nil? ? @pos : 0 ; end
 
  def next
    @pos = (@pos.nil? or @pos == self.size-1) ? 0 : @pos+1
    return self[@pos]
  end
  alias :succ :next
 
  def previous
    @pos = (@pos.nil? or @pos == 0) ? self.size-1 : @pos-1
    return self[@pos]
  end
  alias :prev :previous
end
 
class Scene_SetWindowskin < Scene_Base
  WINDOWSKINS = ['Window', 'Window Black', 'Window Gray']
  def start
    @spriteset = Spriteset_Map.new
    @help_window = Window_Help.new
    @help_window.set_text('Escoja un Windowskin',1)
    WINDOWSKINS.now = WINDOWSKINS.index(RPGWindow.name)
    RPGWindow.skin = WINDOWSKINS.now
    @name_window = Window_Help.new
    @name_window.y = 64
    @name_window.set_text(windowskin_name,1)
  end
 
  def terminate
    @help_window.dispose
    @name_window.dispose
    @spriteset.dispose
  end
 
  def windowskin_name
    @name_index = RPGWindow.name + " #{WINDOWSKINS.index_now+1} / " +
      WINDOWSKINS.size.to_s
  end
 
  def update
    @help_window.update
    @name_window.update
    if windowskin_name != @name
      @name_window.set_text(windowskin_name,1)
      @name = @name_index
    end
    if Input.trigger? Input::B
      Sound.play_cancel
      $scene = Scene_Map.new
      return
    elsif Input.trigger? Input::LEFT
      Sound.play_decision
      RPGWindow.skin = WINDOWSKINS.prev
    elsif Input.trigger? Input::RIGHT
      Sound.play_decision
      RPGWindow.skin = WINDOWSKINS.next
    end
  end
end
[/rgss]

Author Notes

Free to use in any type of RPG Maker game, just include my name (Kyonides-Arkanthos) in your credits.
 
This certainly looks like an interesting script, and would definitely be useful to some. My one nitpick with the thing is the commenting, or lack thereof. I realize that you can probably read the script easily, as could several other members of the community. But, what happens when a relatively inexperienced scripter tries to do something with this? What happens when someone tries to learn from this script?

As I said, it is just a nitpick, but I think that commenting the methods in the same way RMXP and RMVX have (those little method headers) will improve readability, and by commenting the actual code, you will enable someone to learn from or modify this script far more easily. As for the header, I think that could be expanded upon. You don't have to go overboard like I do with my scripts, but explaining what those methods actually do would help, as would including your terms of use and contact info.
 
I know that comments serve a purpose in scripting and programming but I avoid it because I tend to leave silly or extremely simple comments for no good reason. Maybe later I'd include some comments regarding the arguments that should be passed to every single method.
 

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