Hey,
I was just wondering if I could get some help with my script.
I've written a script (code below) to make a custom menu show on a screen, and when an option is selected, the script changes a variable and a switch to the corresponding number using $game_variables[n] and $game_switches[n]. This all works fine - however, after I have selected an option, I return to Scene_Map.new as I should - and when I press F9, the cursor sound plays, but then the game freezes and and error comes up (see screenshot below also). The debug mode works fine before I use my script.
Thanks in advance for any help with this - it's probably a really noobish problem
Tigerseye
The Script:
The Error:
http://www.tigerseye.uk.com/holding/error.jpg[/img]
I was just wondering if I could get some help with my script.
I've written a script (code below) to make a custom menu show on a screen, and when an option is selected, the script changes a variable and a switch to the corresponding number using $game_variables[n] and $game_switches[n]. This all works fine - however, after I have selected an option, I return to Scene_Map.new as I should - and when I press F9, the cursor sound plays, but then the game freezes and and error comes up (see screenshot below also). The debug mode works fine before I use my script.
Thanks in advance for any help with this - it's probably a really noobish problem
Tigerseye
The Script:
Code:
#==============================================================================
# ** Scene_End
#------------------------------------------------------------------------------
# This class performs game end screen processing.
#==============================================================================
class Window_SkillLearn
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make command window
s1 = "Water"
s2 = "Earth"
s3 = "Air"
s4 = "Fire"
@choice_window = Window_Command.new(320, [s1, s2, s3, s4])
@choice_window.x = 320 - @choice_window.width / 2
@choice_window.y = 240 - @choice_window.height / 2
@choice_window.back_opacity = 160
# Create spriteset map object so that the map is displayed behind the
# window
@spriteset = Spriteset_Map.new
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame Update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of window
@choice_window.dispose
# If switching to title screen
if $scene.is_a?(Scene_Title)
# Fade out screen
Graphics.transition
Graphics.freeze
@spriteset.dispose
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@choice_window.update
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(5)
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @choice_window.index
when 0 # command 1
command_0
when 1 # command 2
command_1
when 2 # command 3
command_2
when 3 # command 4
command_3
end
return
end
end
#--------------------------------------------------------------------------
# * Process When Choosing [0] Command
#--------------------------------------------------------------------------
def command_0
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch the Autorun Switch on
$game_switches[28] = true
# Change the variable value to indicate which option has been picked
$game_variables[23] = 1
# The rest is done with eventing
@choice_window.active = false
@choice_window.visible = false
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Process When Choosing [1] Command
#--------------------------------------------------------------------------
def command_1
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch the Autorun Switch on
$game_switches[28] = true
# Change the variable value to indicate which option has been picked
$game_variables[23] = 2
# The rest is done with eventing
@choice_window.active = false
@choice_window.visible = false
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Process When Choosing [2] Command
#--------------------------------------------------------------------------
def command_2
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch the Autorun Switch on
$game_switches[28] = true
# Change the variable value to indicate which option has been picked
$game_variables[23] = 3
# The rest is done with eventing
@choice_window.active = false
@choice_window.visible = false
$scene = Scene_Map.new
end
#--------------------------------------------------------------------------
# * Process When Choosing [3] Command
#--------------------------------------------------------------------------
def command_3
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch the Autorun Switch on
$game_switches[28] = true
# Change the variable value to indicate which option has been picked
$game_variables[23] = 4
# The rest is done with eventing
@choice_window.active = false
@choice_window.visible = false
$scene = Scene_Map.new
end
end
The Error:
http://www.tigerseye.uk.com/holding/error.jpg[/img]