Illegal to fall into an else statement


#1

I ran the quicktest on my game so far, and all was going well until my savegame file came up with "Error: savegame line 175: It is illegal to fall in to an *else statement; you must *goto or *finish before the end of the indented block."
I am at a loss on how to fix it. There are 8 lots of the goto in the indented block. I thought I had just messed up the indentation somewhere, but it is the restore section which is basically a clone of the save just above it which passes with no errors. Any idea’s would be greatly appreciated.


#2

It sounds like you are missing a *goto or *finish in one of your *if branches. Check the lines above the error and make sure that every *if option ends with a *goto or *finish.

If you wish the *if statement to apply without a *goto, you can’t use *else.


#3
*if save_flag = "save"
	*set save_flag ""
	GAME SAVED!
	*line_break
	If your adventures prove too much and you become one of the "living impaired" you can always start again from here.
	*line_break
	(Unless you close the browser... then you are on your own)
	*set save_msg true
	*page_break Continue
	*if return_to_scene = "home"
		*goto_scene home
	*elseif return_to_scene = "chapter1"
		*goto_scene chapter1
	*elseif return_to_scene = "chapter2"
		*goto_scene chapter2
	*elseif return_to_scene = "chapter2b"
		*goto_scene chapter2b
	*elseif return_to_scene = "chapter3"
		*goto_scene chapter3
	*elseif return_to_scene = "chapter4"
		*goto_scene chapter4
	*elseif return_to_scene = "chapter5"
		*goto_scene chapter5
	*elseif return_to_scene = "chapter6"
		*goto_scene chapter6
	*elseif return_to_scene = "chapter7"
		*goto_scene chapter7
*elseif save_flag = "restore"
	*page_break
	Couldn't quite cut it huh? Well thats ok, backtrack a bit and see if you         can do better.
	*page_break Continue
	*if return_to_scene = "home"
		*goto_scene home
	*elseif return_to_scene = "chapter1"
		*goto_scene chapter1
	*elseif return_to_scene = "chapter2"
		*goto_scene chapter2
	*elseif return_to_scene = "chapter2b"
		*goto_scene chapter2b
	*elseif return_to_scene = "chapter3"
		*goto_scene chapter3
	*elseif return_to_scene = "chapter4"
		*goto_scene chapter4
	*elseif return_to_scene = "chapter5"
		*goto_scene chapter5
	*elseif return_to_scene = "chapter6"
		*goto_scene chapter6
	*elseif return_to_scene = "chapter7"
		*goto_scene chapter7

This is basically it. The indents slipped a bit on the text when I copied it over. I still can’t see why I am wrong :frowning:


#4

Oh got it, sorry to waste your time. Didn’t finish the elseif column with an else. All sorted now. :smile: