# ▼ Switch and Variable Script Calls 1.0
# -- Last Updated: 2012.07.30
# -- Author: Helladen
#==============================================================================
# This will allow a developer to call specific things using switches and/or
# variables. This has support for YEA's System Options script.
#==============================================================================
#------------------------------------------------------------------------------
# ■ Aliased methods (YEA's System Options)
#------------------------------------------------------------------------------
# change_custom_variables
# change_custom_switch
#------------------------------------------------------------------------------
#==============================================================================
# ■ Instructions
#==============================================================================
# It will automatically call the script for you if you change them in
# YEA's System Options menu, but you will need to script call if it is not.
#
# You need to add each switch/variable you want and what it will call in the
# configuration below. Switches work differently than variables, they only call
# when they meet the requirements, where variables will always call and embed
# that value into the script call. For example, if you have a argument in your
# script call it will place the variable in the argument. This does not have
# support for multiple arguments, so you can't have a script call that has more
# than one.
#==============================================================================
#------------------------------------------------------------------------------
# ■ Event Script Calls
#------------------------------------------------------------------------------
# These are used to call the script for a variable or switch.
#
# call_switch_script(ID)
# call_variable_script(ID)
#
# ID is the given switch or variable index number.
#------------------------------------------------------------------------------
#==============================================================================
# ■ Configuration
#==============================================================================
module SCRIPT_CALLS
WINDOW_VARIABLE = 3
VARIABLES ={
# -------------------------------------------------------------------------
# index => call,
# -------------------------------------------------------------------------
3 => "$game_system.windowskin = Window",
}
#SWITCHES ={
# -------------------------------------------------------------------------
# index => [on/off, call],
# -------------------------------------------------------------------------
#1 => [true, ]
#}
end
#==============================================================================
# ■ Script Import
#==============================================================================
$imported = {} if $imported == nil
$imported["Switch and Variable Script Calls"] = true
#==============================================================================
# Compatibility for YEA's System Options
if $imported["YEA-SystemOptions"]
class Window_SystemOptions < Window_Command
#------------------------------------------------------------------------
# alias method: change_custom_variables
#------------------------------------------------------------------------
alias change_custom_variables_al change_custom_variables
def change_custom_variables(direction)
change_custom_variables_al(direction)
variable_script(SCRIPT_CALLS::WINDOW_VARIABLE)
end
#------------------------------------------------------------------------
# alias method: change_custom_switches
#------------------------------------------------------------------------
#alias change_custom_switch_al change_custom_switch
#def change_custom_switch(direction)
# change_custom_switch_al(direction)
#end
def variable_script(num)
#if $game_variables[SCRIPT_CALLS::WINDOW_VARIABLE] == 0
# $game_system.windowskin = "Window"
#else
# $game_system.windowskin = "Window" + $game_variables[SCRIPT_CALLS::WINDOW_VARIABLE].to_s
#end
eval(SCRIPT_CALLS::VARIABLES[num][0].to_s + $game_variables[num].to_s)
end
end
end
Code:
#==============================================================================