Gotoref equivalent to use variables with goto_scene?


#1

Is there a gotoref equivalent for goto_scene? That is, something that would allow me to use goto_scene with a variable. I think it would be a nice little debug tool. I’d like to be able to skip ahead to whatever scene I’m working on without having to replay the whole game each time, especially since I already have a kind of “new game +” function that allows me to keep previous stats. So at the end of each scene I’d like to add something like:

*if debug=true
    *choice
        # Continue
            *finish
        # Skip to a different scene
            *input_text skip
            *[tweaked goto_scene command] skip
*finish

#2

You want to use *goto_scene with a variable?

*if (blank = 1)
     *goto_scene blank_1

Something like that right?

Is it not possible for you to use a normal choice to skip ahead to a scene?

*choice
 #go to the first scene
  *goto_scene first_1

#3

I think what your looking for is simply the update to goto_scene command which allows you to go to any scene and then any label inside of that scene. SImply put in the scene you want to go to…
*goto_scene chapter2 war

The game will automatically skip to the scene called chapter2 and look for a *label war and things will roll out from there. I highly recommend not using *gotoref.


#4

Well, the way I want to do it, I’d only need this tiny block of code at the end of each scene. Right now I have 48 scenes so if I do a simple choice, it would look like:

*choice
    # Skip to chapter 1
        *goto_scene 1
(etc. all the way up to chapter 48)
    # Continue
        *finish

Which means 99 lines of code! Even if I decided to paste that at the bottom of each scene, if I were to add or rename chapters, I’d have to change the code again on every page! That wouldn’t be helpful at all.


#6

#7

Thanks! That’s what I thought, but it’s not working for me. My code right now is:

*if debug=true
	*choice
		# Skip to a different scene
			*input_text skip
			Are you sure you want to skip to scene ${skip}?
			*goto_scene {skip}
		# Continue
			*finish
*finish

I added the “are you sure” bit just to verify that I could use the curly braces and get the right value for skip. The value I entered was a3 (my file is called a3.txt). Here is what I get:

Am I missing something?


#8

I’m rather new to coding and I might be way off here, but…should that be *goto_scene {skip} instead of just {skip}, without the sign? In looking at the error message, it seems like perhaps the program thinks you’re trying to go to a scene that’s called {skip}, rather than a scene called a3. And I’m guessing in this instance, ${skip} = a3, aye?


#9

@Fiogan In theory {skip} should have been substituted for a3. The $ prints the value of the variable as text, you only need to use it in dialogue.


#10

Ah okay, thank you.

Again, throwing random and probably worthless theories out here, but were you trying to run a compiled version? I know that when compiling, all of the scenes must be listed in the scene list, even if they’re never accessed with *finish, or else the game won’t compile properly.


#11

I can’t reproduce the problem you’re having. In Firefox, with the current latest version of ChoiceScript up on github, I replaced startup.txt with this:

*create leadership 50
*create strength 50
*temp skip
*choice
    # Continue
        *finish
    # Skip to a different scene
        *input_text skip
        *goto_scene {skip}
*finish

I was then able to type animal or variables into the box, and it just worked.


#12

Omg THANK YOU! I thought I had the latest version but I didn’t. I redownloaded ChoiceScript and it works now. This is going to save me so much time!