question regarding *finish and *goto_scene

I know that *finish will lead to the next chapter on the *scene_list, but if I use *goto_scene to load a script that isn’t on the *scene_list, whenever I use *finish it just ends the game instead of loading the next script on the *scene_list, is there a way to work around it?

You should be able to *goto_ another scene from there, instead of *finish.

If this scene can appear in multiple scenarios and you want to return to wherever you were and progress from there, a subroutine may work better.

2 Likes

If you use *gosub_scene instead, you can return with *return instead of *finish.

3 Likes

what about using stacks of scenes, something like:
*gosub_scene
*goto_scene
*return
It works when I just use a single *gosub_scebe and then return but choicescript ide says “it is illegal to fall out of a *choice statement; you must *goto or *finish before the end of the intended block”

I’m not sure what this is intended to do. The *return would have absolutely no functionality because you’ve already left the subroutine. That’s probably why it doesn’t work.

2 Likes

My previous response was written quickly and probably without fully understanding the problem. I didn’t realise there was a *choice involved. The *choice command forces each option to end with *goto or *finish. You can use *fake_choice instead, which does not have this requirement.

Maybe it’s something like this you’re after:

my_scene.txt (listed in startup.txt)

	(...)
	
*choice
	#choice1
		Some code.
		*goto after_my_choice
	#choice2
		*gosub_scene another_scene another_code
		*goto after_my_choice

*label after_my_choice

	(...)

another_scene.txt (not listed in startup.txt)

	(...)

*label another_code

	(...)

*return

But without looking at the code, or at least the way it’s structured, it’s hard to make any better suggestions.

1 Like

You should include all scenes in the scene list regardless.

1 Like