What I'm trying to do: Create a script command to restore certain switches & variables to a specific value.
Script I am trying this in: Yanfly's System Options.
I've noticed that Yanfly more or less doesn't really respond to support questions on their site, at least they haven't for a while, which is why I'm posting here.
I've decided to replace the options "Return to Title Screen" and "Exit Game" with a "Restore Default Settings" and "Save and Go Back". "Save..." works fine with just a :return_scene command, but "Restore..." is a bit harder.
Right now, I have this in the SYSTEM module:
Spoiler
SWITCHES = { 14 => false,
15 => true,
13 => true,
1 => false
}
VARIABLES = {
13 => 2,
14 => 1
}
15 => true,
13 => true,
1 => false
}
VARIABLES = {
13 => 2,
14 => 1
}
Near the bottom of the script, I have this:
def create_command_window
@command_window = Window_SystemOptions.new(@help_window)
@command_window.set_handler:)cancel, method:)return_scene))
@command_window.set_handler:)set_restore, method:)command_set_restore))
@command_window.set_handler:)go_back, method:)return_scene))
end
#--------------------------------------------------------------------------
# command_to_title
#--------------------------------------------------------------------------
def command_set_restore
YEA::SYSTEM::SWITCHES.each do |id, bool|
$game_switches[id] = bool
end
YEA::SYSTEM::VARIABLES.each do |id, val|
$game_variables[id] = val
end
end
Like I said, :go_back is working just fine, but when I try to select :set_restore, the game freezes. It doesn't crash, doesn't give an error, just freezes. :(
What am I doing wrong?