Hello again. The *else statement inside this choice:
> *label hug
> Maybe you should show the goo your love for it.
> *choice
> #Yes, I should. I give it a great big hug.
> *set Evil -10
> *set Health -5
> *if Health <= 0
> *gosub_scene dead
> *else
> *goto hug2
> #Having my own pet dragon goo is nice, but it's a hopefully useful travelling companion, not a friend.
> *goto leave
> #No, I give it a kick. It should know who its master is and learn to obey.
> *set Evil +10
> *goto leave
Gives this error:
Error: chapter3 line 1035: It is illegal to fall in to an *else statement; you must *goto or *finish before the end of the indented block.
I can’t seem to figure out why, though. If I’m not mistaken I can solve this by going to a separate label after the choice first and performing the Health check there, but is it possible to make the *else statement work within the choice?
Thanks in advance.
I am not sure but the reason it is not working could be that use of gosub as a goto or finish command is required to start a else command
You could try this
*if health <= 0
*gosub_scene dead
*if health > 0
*goto hug2
1 Like
Error: chapter3 line 1037: It is illegal to fall out of a *choice statement; you must *goto or *finish before the end of the indented block.
Is what it says now. Line 1037 is the second choice.
I think it’s the indentation messing things up. Try aligning the *goto leave commands with *goto hug2, maybe?
1 Like
*goto is not indented correctly in second choice
Every *if/*elseif/*else
within a choice needs a *goto
command. In this instance, I believe *gosub_scene
is what’s causing you trouble. It’s going to run the subroutine, come back, and have nowhere to go. Try:
> #Yes, I should. I give it a great big hug.
> *set Evil -10
> *set Health -5
> *if Health <= 0
> *goto_scene dead
> *else
> *goto hug2
The alternative is to rework your labels a bit and have something like:
> #Yes, I should. I give it a great big hug.
> *set Evil -10
> *set Health -5
> *if Health <= 0
> *gosub_scene dead
> *goto ending
> *else
> *goto hug2
You just need to make sure you have a *goto
in there.
4 Likes
Thank you, it passes quicktest now. I had just changed it to a *goto label that sends you to the dead scene file instead, but this is more efficient.
Before you edited I also thought of that, I used the *gosub command wrong: dead.txt is a dead end/early end in the game and ends with a *ending. There’s no reason for it to return. And if it had been a gosub_scene with the intention to return, I should use a separate label to *goto since it can’t return in the middle of a choice. If I’m not mistaken.
Anyway, thanks to all three of you.
3 Likes
@DesmundGrimsted mark this thread solved to avoid inconvenience of other forum users
It could return. It’d just need a *goto
at the end.
Like…
*choice
#Run over yonder!
[I'm running, yay!]
*if trait = "observant"
*gosub_scene observations running
*goto NextScene
#I'm walking.
[I'm walking... d'aw.]
*goto NextScene
*label running [Within observations.txt]
[Something special to be seen while running!]
*return
2 Likes