Change Windowskin
Version: 1.0.1
Author: modern algebra
Date: 27 July 2013
Version History
- <Version 1.0.1> 2013.07.27 - Changed the way the windowskin is updated
- <Version 1.0.0> 2013.07.27 - Original Release
Description
This script allows you to change the windowskin in-game with a script call. It does not deal with changing the window tone, as there is already an event command that does that ("Change Window Color", page 3, column 1, row 14).
Instructions
Paste the script into its own slot in the Script Editor, above Main but below Materials.
For further instructions on configuration, consult the header of the script.
Script
#==============================================================================
# Change Windowskin
# Version: 1.0.1
# Author: modern algebra (rmrk.net)
# Date: 27 July 2013
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Description:
#
# This script allows you to change the windowskin in-game.
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Instructions:
#
# Paste this script into its own slot in the Script Editor, above Main but
# below Materials.
#
# To set the initial filename for the windowskin, go to line 46 and change
# the portion between quotation marks to the name of the desired windowskin.
#
# To change the windowskin in-game, use the following code in a Script call
# event command (last button on the last page of event commands)
#
# $game_system.windowskin = "filename"
#
# Replace filename with the name of the windowskin graphic you intend to
# use.
#
# If you are using another script that allows you to select a windowskin for
# some windows and do not want it to be affected by this script, then be
# sure to use a skin that you never use for this script. If you do want it
# to be controlled by this script, then set it to "Window"
#``````````````````````````````````````````````````````````````````````````````
# EXAMPLE:
#
# $game_system.windowskin = "Window"
#
# Will set the windowskin to the file named Window in the System folder of
# Graphics.
#==============================================================================
$imported = {} unless $imported
$imported[:MA_ChangeWindowSkin] = true
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
# BEGIN Editable Region
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
MACW_WINDOWSKIN = "Window" # Set this to the name of the window file to use.
#||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
# END Editable Region
#//////////////////////////////////////////////////////////////////////////////
if !MACW_WINDOWSKIN.is_a?(String) || MACW_WINDOWSKIN.empty?
MACW_WINDOWSKIN = "Window"
msgbox("Error at line 41 of Change Windowskin script:\nMACW_WINDOWSKIN must be a non-empty string!")
end
#==============================================================================
# *** Cache
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - self.system
#==============================================================================
class << Cache
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * System
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias macw_systm_2mf0 system
def system(filename, *args)
filename = $game_system.macw_windowskin if filename == "Window"
macw_systm_2mf0(filename, *args) # Call original method
end
end
#==============================================================================
# ** Game_System
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# new attr_accessor - macw_windowskin
# new attr_reader - macw_old_windowskin
# aliased method - initialize
#==============================================================================
class Game_System
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Public Instance Variables
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr_reader :macw_old_windowskin
attr_accessor :macw_windowskin
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Object Initialization
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias macw_ilze_2bd4 initialize
def initialize(*args)
@macw_old_windowskin = "Window"
@macw_windowskin = MACW_WINDOWSKIN
macw_ilze_2bd4(*args) # Call original method
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Set Windowskin
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def windowskin=(filename)
@macw_old_windowskin = @macw_windowskin
@macw_windowskin = filename
end
end
#==============================================================================
# ** Window_Base
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Summary of Changes:
# aliased method - update
#==============================================================================
class Window_Base
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
alias macw_pdat_5ht8 update
def update(*args)
macw_pdat_5ht8(*args) # Call original method
macw_update_windowskin
end
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# * Update Windowskin
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def macw_update_windowskin
if $game_system.macw_windowskin != @macw_check_windowskin
@macw_check_windowskin = $game_system.macw_windowskin
$game_system.macw_windowskin = "Window" # Disallow interference w/ check
# If windowskin governed by this script and no other
if windowskin == Cache.system($game_system.macw_old_windowskin) ||
windowskin == Cache.system("Window")
self.windowskin = Cache.system(@macw_check_windowskin)
end
$game_system.macw_windowskin = @macw_check_windowskin # Restore
end
end
end
Credit
Thanks
- TheoAllen, for alerting me to an error in the logic
- Artemis Dreamer, for the request
Support
Please post in this topic at RMRK.net if you have any questions, suggestions, error reports, or comments about this script. It is perfectly fine to post here even if this topic has not been posted in for a very long time.
Please do not message me privately, as any concerns you have are likely shared by others and they will benefit from our correspondence being public. Additionally, I am occasionally absent, and posting publically will allow other members to assist you when I am unable to do so quickly.
Known Compatibility Issues
If you are using a custom script that allows you to set windowskins and want it to be controlled by this script, then set the windowskin to "Window" in the other script. If you do not want it to be affected, then set it to a windowskin that you never use when changing it in this script.
I am currently unaware of any other compatibility issues.
Author's Notes
I could have sworn I had written this script a long time ago, but I couldn't find it. Maybe I was thinking of the System Options script I had started writing but abandoned.
Terms of Use
I adopt RMRK's default
Terms of Use.