I was making a simple mission select menu with unlockable missions based on whether or not a switch was on. I copied some of the title screen script as a base and edited away, I'm a total scripting n00b but w/e. I keep getting this error
Quote
Script 'Scene_Mission_Menu' line 110: SyntaxError occurred
Here's my script
#==============================================================================
# ** Scene_Mission_Menu
#------------------------------------------------------------------------------
# This class performs Mission Menu processing.
#==============================================================================
class Scene_Mission_Menu
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
# Make command window
s1 = "Mission 1: Beginners Luck"
s2 = "Mission 2: "
s3 = "Mission 3: "
s4 = "Mission 4: "
@command_window = Window_Command.new(192, [s1, s2, s3, s4])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@command_window.update
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # M1
command_m1
when 1 # M2
command_m2
when 2 # M3
command_m3
when 3 # M4
command_m4
end
end
end
#--------------------------------------------------------------------------
# * Command: M1
#--------------------------------------------------------------------------
def command_m1
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Transfer
$game_temp.player_transferring = true
$game_temp.player_new_map_id = 4
$game_temp.player_new_x = 9
$game_temp.player_new_y = 11
$game_temp.player_new_direction = 0
end
#--------------------------------------------------------------------------
# * Command: M2
#--------------------------------------------------------------------------
def command_m2
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Check if available
if $game_switches[4] = true
# Transfer
$game_temp.player_transferring = true
$game_temp.player_new_map_id = 5
$game_temp.player_new_x = 9
$game_temp.player_new_y = 11
$game_temp.player_new_direction = 0
else print 'This mission is not unlocked yet!'
end
#--------------------------------------------------------------------------
# * Command: M3
#--------------------------------------------------------------------------
def command_m3
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Check if available
if $game_switches[5] = true
# Transfer
$game_temp.player_transferring = true
$game_temp.player_new_map_id = 6
$game_temp.player_new_x = 9
$game_temp.player_new_y = 11
$game_temp.player_new_direction = 0
else print 'This mission is not unlocked yet!'
end
#--------------------------------------------------------------------------
# * Command: M4
#--------------------------------------------------------------------------
def command_m4
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Check if available
if $game_switches[6] = true
# Transfer
$game_temp.player_transferring = true
$game_temp.player_new_map_id = 7
$game_temp.player_new_x = 9
$game_temp.player_new_y = 11
$game_temp.player_new_direction = 0
else print 'This mission is not unlocked yet!'
end
Add an 'end'.
You didn't end the class. XD
I don't think you wanna use the 'print' command to show that a mission is unavailable.
You should draw that string instead.
Nope, still get the same error, just time on line 111 :huh:
Quote from: Aquaman on April 15, 2009, 05:41:39 pm
I don't think you wanna use the 'print' command to show that a mission is unavailable.
You should draw that string instead.
And how would I do that?
Ok I'm going to redo this little script okay? Keep everything the same but redo it so it doesnt get the eror.
I'm also going to make it where no switches are needed. Or do you want to keep the switches like that.
I can make it where it uses a simple syntax.
Are you missing two 'end's?
# Check if available
if $game_switches[6] = true
# Transfer
$game_temp.player_transferring = true
$game_temp.player_new_map_id = 7
$game_temp.player_new_x = 9
$game_temp.player_new_y = 11
$game_temp.player_new_direction = 0
else print 'This mission is not unlocked yet!'
<Maybe an end goes here?>
end
<End the class like Aqua said>
Actually it happens a lot throughout. D= Seems to work after you end all the ifs. =]
class Scene_Mission_Menu
def initialize
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make command window
s1 = "Mission 1: Beginners Luck"
s2 = "Mission 2: "
s3 = "Mission 3: "
s4 = "Mission 4: "
@command_window = Window_Command.new(192, [s1, s2, s3, s4])
@command_window.back_opacity = 160
@command_window.x = 320 - @command_window.width / 2
@command_window.y = 288
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update command window
@command_window.update
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # M1
command_m1
when 1 # M2
command_m2
when 2 # M3
command_m3
when 3 # M4
command_m4
end
end
end
#--------------------------------------------------------------------------
# * Command: M1
#--------------------------------------------------------------------------
def command_m1
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Transfer
$game_temp.player_transferring = true
$game_temp.player_new_map_id = 4
$game_temp.player_new_x = 9
$game_temp.player_new_y = 11
$game_temp.player_new_direction = 0
end
#--------------------------------------------------------------------------
# * Command: M2
#--------------------------------------------------------------------------
def command_m2
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Check if available
if $game_switches[4] = true
# Transfer
$game_temp.player_transferring = true
$game_temp.player_new_map_id = 5
$game_temp.player_new_x = 9
$game_temp.player_new_y = 11
$game_temp.player_new_direction = 0
else
print 'This mission is not unlocked yet!'
end
end
#--------------------------------------------------------------------------
# * Command: M3
#--------------------------------------------------------------------------
def command_m3
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Check if available
if $game_switches[5] = true
# Transfer
$game_temp.player_transferring = true
$game_temp.player_new_map_id = 6
$game_temp.player_new_x = 9
$game_temp.player_new_y = 11
$game_temp.player_new_direction = 0
else
print 'This mission is not unlocked yet!'
end
end
#--------------------------------------------------------------------------
# * Command: M4
#--------------------------------------------------------------------------
def command_m4
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Check if available
if $game_switches[6] = true
# Transfer
$game_temp.player_transferring = true
$game_temp.player_new_map_id = 7
$game_temp.player_new_x = 9
$game_temp.player_new_y = 11
$game_temp.player_new_direction = 0
else
print 'This mission is not unlocked yet!'
end
end
end
also you forgot to define Main and initialize
initialize doesn't have to do anything but if you don't define it in my experience bad thing will happen
and the reason you have to add def main is because when you call your scene with $scene = Scene_Mission_Menu the base scrips will try to call the main method and if you don't have it defined it wont work. the code above has all the ends and method definitions and should work
ty everyone, no error popups anymore, only 1 problem, the game 'freezes' whenever the script is called... :argh: The only thing you can do is close the game <_<
You mean this?
$scene = Scene_Mission_Menu.new
Try this:
$scene =
Scene_Mission_Menu.new
Well that's weird... the game isn't actually freezing up, when I call the script it looks like it is but if you press up or down you can hear the cursor sound, so you just cant see the menu, and none the options do what there supposed to but you can here the cursor and confirm sounds :P
What would be the problem there?
try this
class Scene_Mission_Menu
def initialize(menu_index = 0)
@menu_index = menu_index
end
def main
s1 = "Mission 1: Beginners Luck"
s2 = "Mission 2: "
s3 = "Mission 3: "
s4 = "Mission 4: "
@command_window = Window_Command.new(160, [s1, s2, s3, s4])
@command_window.index = @menu_index
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@command_window.dispose
end
def update
@command_window.update
update_command
end
def update_command
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Map.new
return
end
if Input.trigger?(Input::C)
if $game_party.actors.size == 0 and @command_window.index < 4
$game_system.se_play($data_system.buzzer_se)
return
end
case @command_window.index
when 0
$game_temp.player_transferring = true
$game_temp.player_new_map_id = 4
$game_temp.player_new_x = 9
$game_temp.player_new_y = 11
$game_temp.player_new_direction = 0
$scene = Scene_Map.new
when 1
if $game_switches[4] == true
# Transfer
$game_temp.player_transferring = true
$game_temp.player_new_map_id = 5
$game_temp.player_new_x = 9
$game_temp.player_new_y = 11
$game_temp.player_new_direction = 0
$scene = Scene_Map.new
else
print 'This mission is not unlocked yet!'
end
when 2
if $game_switches[5] = true
# Transfer
$game_temp.player_transferring = true
$game_temp.player_new_map_id = 6
$game_temp.player_new_x = 9
$game_temp.player_new_y = 11
$game_temp.player_new_direction = 0
$scene = Scene_Map.new
else
print 'This mission is not unlocked yet!'
end
when 3
$game_temp.player_transferring = true
$game_temp.player_new_map_id = 7
$game_temp.player_new_x = 9
$game_temp.player_new_y = 11
$game_temp.player_new_direction = 0
$scene = Scene_Map.new
else
print 'This mission is not unlocked yet!'
end
end
return
end
end
Perfect! Except I just had to change the width of the choice box but w/e ty matt :)
So my first scripting attempt pretty much failed but I can try again :D
Failed? Never.
Do keep trying again. :)
<3
i have to admit all i did was strip scene menu i like to use scrips that are already there & just edit it frankenscripting lol