I've been working with Sugarcube in Twine 2 to produce a fairly simple adventure game of branching narrative paths.
I've found that the main thing I keep running up against is the need to run a command or function only the first time the passage is read--i.e. I want a <<set>> command in the passage "Meet the wicked witch" to increment $witchesmet by 1, but I don't want it to increment again until passage "Meet the good witch," even if the player reads through "Meet the wicked witch" a second time.
I've come up with an assortment of jury-rigged hacks for this in the form of an unwieldy sequence of <<if>> and <<else>> calls, but it's getting difficult to sustain them, and I can't help but feel that I'm missing something obvious. Does anyone have any help for me?
Comments
One way to solve the issue is to use the visited() function to check how many times the reader has seen the Meet the wicked witch passage. motoslave.net/sugarcube/1/docs/utility-functions.html#functions-visited
Thank you!