Randomtest issue? Possible incorrect 'illegal to fall out of a *choice' message


#1

Why does it think this a *choice? Perhaps there’s something I’m missing.

Any ideas anyone?

(Btw the long *if statements are templated and work everywhere else without throwing the issue - this is chapter 13 and multiple preceding iterations of the story have already passed in the same randomtest session)


#2

Try creating a label for it to goto so it can be happy?


#3

*fake_choice was originally not intended to nest other code. It did get that added after a while, but further nesting in a *fake_choice has always been at least a little buggy (e.g. IIRC nesting a *fake_choice in a *fake_choice will always cause a crash). If you intend to do that a fair bit, you should instead turn on implicit control flow.


#4

Thanks @RETowers
Neither:
*create implicit_flow_control true
or
*create implicit_flow_control false
added to the startup.txt seem to get rid of the issue. But I am a moron. I’m likely misunderstanding something. (Or is this general good advice for my current style of coding, and should I keep *create implicit_flow_control true in the startup.txt?)

Thanks @Carlos.R your dirty workaround worked like a charm.


#5

Godsdammit, the error is back, same place. Randomtest must just have hit a couple of different errors first in other runthroughs, and I mistakenly interpreted that as a fix. Thanks anyway @Carlos.R


#6

What does the code look like now? Can you copy and paste?


#7
*fake_choice
	*if (((choices = false) or ((c_m_z#jump_to_page_minus_one) = 0)) or ((reread = false) and (red_flags_path != "fighter")))
		#I'm definitely going to join the others and defend the North chain. [i]${considerate}[/i]
			*if reread = false
				*set c_m (c_m&0)
				*gosub_scene operation_spirit considerate_1
				*set red_flags_path "fighter"
				*goto skip_13041900
	*if ((((choices) and (reread = false)) and (red_flags_path != "surgeon")) or ((c_m_z#jump_to_page_minus_one) = 1))
		#I'm positive helping the surgeon is the best way for me to help everyone. [i]${caring}[/i]
			*if reread = false
				*set c_m (c_m&1)
				*gosub_scene operation_spirit caring_1
				*set red_flags_path "surgeon"
				*goto skip_13041900
	*if ((((choices) and (reread = false)) and (red_flags_path != "politician")) or ((c_m_z#jump_to_page_minus_one) = 2))
		#I have to find out if anyone's trying to find a political solution to stopping the fighting. [i]${considerate}[/i]
			*if reread = false
				*set c_m (c_m&2)
				*gosub_scene operation_spirit considerate_1
				*set red_flags_path "politician"
				*goto skip_13041900
	*if ((((choices) and (reread = false)) and (red_flags_path != "criminal")) or ((c_m_z#jump_to_page_minus_one) = 3))
		#I'm an idiot for being swept up in the moment. I don't actually wish to help these people.  [i]${uncaring}[/i]
			*if reread = false
				*set c_m (c_m&3)
				*gosub_scene operation_spirit uncaring_1
				*set red_flags_path "criminal"
	*if ((((choices) and (reread = false)) and (red_flags_path = "fighter")) or ((c_m_z#jump_to_page_minus_one) = 4))
		#It was just a moments doubt. I want to stand toe to toe with the others defending the North chain. [i]${considerate}[/i]
			*if reread = false
				*set c_m (c_m&4)
				*goto skip_13041900
	*if ((((choices) and (reread = false)) and (red_flags_path = "politician")) or ((c_m_z#jump_to_page_minus_one) = 5))
		#It was just a moments doubt. I'm sure I want to go to the keep to see whether politics can save us from this war. [i]${considerate}[/i]
			*if reread = false
				*set c_m (c_m&5)
				*goto skip_13041900
	*if ((((choices) and (reread = false)) and (red_flags_path = "surgeon")) or ((c_m_z#jump_to_page_minus_one) = 6))
		#It was just a moments doubt. I'm sure I want to help Rudi prepare for casualties. [i]${caring}[/i]
			*if reread = false
				*set c_m (c_m&6)
				*goto skip_13041900
	*if ((((choices) and (reread = false)) and (red_flags_path = "criminal")) or ((c_m_z#jump_to_page_minus_one) = 7))
		#It was just a moments doubt. I'm sure that exploiting this situation is the best thing for me. [i]${uncaring}[/i]
			*if reread = false
				*set c_m (c_m&7)
				*goto skip_13041900
	*if not (((choice_randomtest) or (reread)) or (skip_forward)) 
		#Menu.
			*gosub_scene operation_menu
				*goto skip_13041900
	*if (reread) 
		#Return to page ${p}.
			*goto_scene operation_reread_skip_forward return_to_page_choice
				*goto skip_13041900
*label skip_13041900

#8

Ok yeah, try making it an actual choice instead of a fake_choice?


#9

Failed with *choice

RANDOMTEST FAILED: Error: chapter_13_to_those_who_work__you line 8229: It is illegal to fall out of a *choice statement; you must *goto or *finish before the end of the indented block.

Have also tested without success with *choice:
*create implicit_flow_control true
and
*create implicit_flow_control false
in startup.txt


#10

I think it’s because your goto commands are under the *if statements. So if the code thinks that it can’t get to a *goto, then it will give you that same fall out error.


#11

Ooh, that’s creepy…

(same with *fake_choice or *choice)


#12

Is there a reason for the # in this line of code?

*if (((choices = false) or ((c_m_z#jump_to_page_minus_one) = 0))


#13

((c_m_z#jump_to_page_minus_one) = 0)

Checks a page number against a numeric string variable (a choice memory), so that if a player returns to a page to reread it, *if (choices) prevents them from choosing any choice other than the one they chose when they read the page in the first place.

So the # is preventing ‘do-overs’ by reading one number in a cumulative numeric variable that looks a bit like 020420102030302302230402301013302002 etc.


#14

Will be back later, but you can always try adding this to the bottom of that long choice tree.
Normal gameplay should never see this option, but randomtest will look at it and it “should” see that there is a goto, so hopefully that alleviates the error.

	*if choice_randomtest
		#Hello Randomtest.
			*goto skip_13041900

#15

According to what you posted this choice doesn’t have the *goto skip_13041900, could that be the issue?


#17

Awesome, if you can’t pass the test, bypass the test. Working, thank you!


Hey @SomethingSome. That version of the code didn’t, but the later tries did. Thank you


#18

No! I take that back, you were absolutely right - I was missing a piece of code from @Carlos.R’s workaround. Apologies for misunderstanding!

Appears to be solved. Thank you so much. Will keep checking in case the error gets thrown again. If not, will mark as solved shortly.


#19

That’s probably because you left it as a *fake_choice. Implicit control flow is for actual *choices.