Falling out of choice, even *else not helping

I’m having trouble with this code

The error I’m getting is falling out of choice

My code looks like this:

You shake hands again and a carriage arives.
*choice
	*if (provisions = true) #Eat Provisions
		*if (provisions_number > 0) 
			*gosub_scene eatprovisions
		*else
			*gosub_scene noprovisions
	*if (provisions = true) #Don't eat provisions
		*goto HMS_Wayfarer
	*if (provisions = false) #To the Wayfarer!
		*goto HMS_Wayfarer
	*else
		*goto HMS_Wayfarer
*goto HMS_Wayfarer
*label HMS_Wayfarer
*page_break HMS Wayfarer
*goto_scene boat

Here are the gosub scenes

*label eat_provisions
*set stamina + 5
*set provisions_number -1
*if (provisions_number =0)
	*set provisions false
*gosub limit_stats

*label limit_stats
*if stamina > max_stamina
	*set stamina max_stamina
*return
*label no_provisions
"Empty already, they were tastier than I thought they would be"
*set provisions false
*return

I have a history of falling out of choice errors, last week it was because I hadn’t used *else
I was careful to do that this time so I don’t know why it is happening

The program returns from gosub_scene and doesn’t know where to go. Add a *goto command (also after that gosub_scene under *else).

3 Likes

There’s also

	*else
		*goto HMS_Wayfarer

which doesn’t adhere to *choice syntax, which only accepts #option.

2 Likes

Many thanks!
I added the *else , *goto HMS_Wayfarer when I was panicking

Here is the code I have now and it seems to work and pass randomtest:

You shake hands again and a carriage arives.
*choice
	*if (provisions = true) #Eat Provisions
		*if (provisions_number > 0) 
			*gosub_scene eatprovisions
			*goto HMS_Wayfarer
		*else
			*gosub_scene noprovisions
			*goto HMS_Wayfarer
	*if (provisions = true) #Don't eat provisions
		*goto HMS_Wayfarer
	*if (provisions = false) #To the Wayfarer!
		*goto HMS_Wayfarer

*label HMS_Wayfarer
*page_break HMS Wayfarer
*goto_scene boat

Thanks so much for your help, again

I spent a lot of the day today on this, originally I didn’t have a gosub_scene for provisions, I had it all in the scene itself
I then tried to create new labels for every time an eat provisions choice came up (5 times in the scene) and this didn’t work at all, also I was also confused as to why the characters stamina get going up anyway until I realised the system was just following the code to add stamina!

After hours of work I have pretty much just coded 2 gosub scenes of a few lines - terrible!

However, on the bright side, eating provisions is really just the last piece of new coding needed. From now on I should be able to cut and paste everything from elsewhere

Thank you for all your help again, time for me to save the work and have a break!

2 Likes

If a player with provisions sees your choice options, it wouldn’t be obvious to them that a choice to not eat provisions would lead them to HMS Wayfarer. Unlike a player without provisions, “To the Wayfarer!” is the only option for them.

1 Like

Yes, this is the problem I am having with the whole Eat Provisions thing

After the fight the story here moves on and no actual choice is required. However, because there is a need to potentially eat provisions and increase stamina I have had to add a choice to do this
The kind of game I am used to is all paper and pencil, so all you would do in the old days is just add it to a piece of paper!

I totally see what you are saying and will change the text - appreciated, cheers

How about:

You shake hands again and a carriage arives.
*if (provisions = false)
        *goto HMS_Wayfarer
*else
        *choice
	        #Eat Provisions before boarding
		        *if (provisions_number > 0) 
			        *gosub_scene eatprovisions
			        *goto HMS_Wayfarer
		        *else
			        *gosub_scene noprovisions
			        *goto HMS_Wayfarer
	        #Don't eat provisions - time to board the Wayfarer!
	                Some text, so the button from that *page_break is not the only thing you see on the page in-game.
		            *goto HMS_Wayfarer

*label HMS_Wayfarer
*page_break HMS Wayfarer
*goto_scene boat

Indents may be slightly off because editing them in comments gives strange results, but I think you can get the general idea.

1 Like

Love it! Many thanks!

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.