Testing repeat code failed after 3 times

So I was testing a game im building in order to learn the language a little better and practice in general. After running my slide 3 times in a row to test it I got :caves line 10: It is illegal to fall out of a *choice statement; you must *goto or *finish before the end of the indented block. Where did I go wrong here?

And this is my code. Im using notepad++

*label lost
*label caves
*choice
	#Go into the random dark?
		*rand diceroll 1 12
		*if diceroll > 3
			*set health %-5
			A spider bit the hell out of you
			*goto caves
	#Did you want to just leave?
		*rand diceroll 1 2
		*if diceroll > 1
			*goto lost
		*else
			*goto_scene home

You need to either add an else statement here that includes a goto command or deactivate implicit control flow or use fake_choice instead of choice.

For a more detailed explanation, see here:

1 Like

I think you’re gonna need an else statement there regardless of whether implicit control flow is on or not or whether it’s choice or fake_choice. Otherwise, I’m pretty sure you’d just get a different error rather than no error.

2 Likes

You were actually right about this, I got 3 different ones before I came up with my solution but I think it looks kinda ugly.

This looks janky and I looked at whatever implicit control flow is, I dont think thats what I was looking for but I for sure appreciate it because it gave me the idea to make this janky code :sweat_smile: I could also be using that same thing you told me and not know it. Either way you helped I got it working @quartz

type or paste c*label lost
*label caves
*choice
	#Go into the random dark?
		*rand diceroll 1 12
		*if diceroll > 3
			*set health %-5
			A spider bit the hell out of you
			*goto caves
		*else
			*goto lost
	#Did you want to just leave?
		*rand diceroll 1 2
		*if diceroll > 1
			Youre lost
			*goto caves
		*else
			*goto_scene homeode here
2 Likes

Think about it if you were a computer. After every *choice, you need instructions on where to go next.

So, you look at that first choice. I roll the dice, I get 6. There’s a gate that checks if I’m above 3 – I am, great! Looks like I’ll go to caves next.

But wait, what if I roll 2? There’s somewhere for me to go if I’m above 3, but nowhere if I don’t fulfill those requirements. So where do I go next? I need direct, explicit instructions.

So, as the writer, you should write

*else
  *goto lost

to tell the computer where to go.

Bonus:

Implicit Control Flow is a switch that says to the computer, “You don’t need explicit instructions. Just assume you’re going to the end of the choice block unless it says otherwise.”

1 Like