Temp variables versus gosub_scene


#1

I have a quick question about the way that temporary variables and subroutines that take you through other scenes interact.

Let’s say I’ve got the following code:

*temp output false
*label comeback_here

*choice
  # Take a detour through a subroutine in another scene.
    *set output true
    *gosub_scene scene_2 label_34
    *goto comeback_here
  *if (output = true) # Print the output.
    Hello world!
    *finish

Can we get to “Hello world!” in this code?

(this is a simplification of something I’m trying to do, which I might use a bunch of times in my code)

In other words, if you set a temporary variable in one scene and then take a detour through another scene using gosub_scene, do we keep the temporary variable?


#2

It looks like you do keep the temp variable through *gosub_scene
I copied your code but replaced something on one line.

Code
*temp output false
*label comeback_here

*choice
  # Take a detour through a subroutine in another scene.
    *set output true
    *gosub_scene scene1
    *goto comeback_here
  *if (output = true) # Print the output.
    Hello world!
    *finish

My “scene1” file consists of a *return, that’s it.


#3

Hooray! That makes things a lot easier to manage.