Easy way to test passages with variables already?

Twine Version: Twine 2.6.0
Story Format: Sugarcube2

Hello! Its been about a week since i’ve started to use twine and while im doing well with my coding, i was wondering if there was a quick and easy way to view and test passages with already activated variables without having to go through the entire game?

Im rlly sorry if this sounds like a basic question. i’m still new to this whole thing + coding in general, and its been getting a bit exhausting going through the entire game just to check if a variable ive set up worked. I’ve tried looking it up too, but i dont think ive found anything abt this so any help is appreciated ;;

Twine lets you start testing from a passage.
When you have a passage selected, you can click on Test from Here in the menu at the top of the page.

However, it will only test the passage as if the story started there.

Ahh i do know that, but the thing thats been making me confused is how exactly can i view a passage with a past variable already set to true for the code to work, since it looks like it doesnt automatically do that for the passage im viewing when i test from there immediately

Is the past set variable in StoryInit or in a previous passage?
If the first, the method above should work.

If the second, then you’d either need to:

  • play it all again
  • set that variable at the top of the passage (temporarity, you delete it afterwards)
  • create a savefile (that includes the variable) that you load up
1 Like

oooh alright, i think i know what to do now thank you!

You might also want to check out Config.debug, which indicates whether the game is running in test mode. You can use it to set variables when the game is in test mode but not when running normally, like this:

<<if Config.debug>>
	/* Any code here will only be executed in test mode */

You can also change variables on the fly by opening the browser console and typing SugarCube.State.variables['variable_name'] = true.


Oh that actually makes things a lot easier for me omg, thank you!!

Another trick is to create a new dummy passage and in there set variables as you expec t them to be, then link from there to the passage you want to test (or the one before?). Then run the test from your dummy passage. You can delete it later, but even if you do not, there will be no links to it, so no effect on your game.

You could also keep notes in there, to track different combinations you know work and don’t.