0 votes
by (490 points)
I'm working with Sugarcube 1.0.35 right now. There's a particular part of the game that I'm trying to put together and don't know how to- there's eleven separate variables.(all called $partone, $parttwo, and so on) that are either true or false at any given time. I want to make it so that when all variables are true, the game, no matter which passage the player is on at the time, sets a twelfth (separate) variable to be true as well.

Please tell me if I'm not making any sense/need to clarify any information. Help would definitely be appreciated!


1 Answer

0 votes
by (1.1k points)
selected by
Best answer

Would it be as simple as a PassageReady passage with an if statement in it, checking is parts one through to eleven are true and if so, setting $parttwelve to true as well? This would only update them upon loading a new passage (or reloading the current one), to my understanding, which may or may not get the full functionality you're looking for.

by (490 points)
edited by
This sounds about right from what I can tell, but I'm having trouble tracking down the information on how exactly to do it. Would you have a link for something that could explain PassageReady info?

EDIT: actually did manage to find a thing explaining PassageReady, but now I'm having trouble with sorting the <<if>> statements themselves. Mainly, I have no idea where to actually begin. HelP?
by (159k points)

Create a new passage and name it PassageReady, then place TwineScript something like the following within it

<<if $partone and $parttwo and $partthree and $partfour and $partfive and $partsix and $partseven and $parteight and $partnine and $partten and $parteleven>>\
	<<set $parttwelve to true>>\


by (490 points)
it worked- thank you so much!
by (68.6k points)
reshown by

There's no need for the <<if>> in this case.  You may set $parttwelve appropriately by assigning it the conditional subexpression.  For example:

<<set $parttwelve to ($partone and $parttwo and $partthree and $partfour and $partfive and $partsix and $partseven and $parteight and $partnine and $partten and $parteleven)>>

The parenthesis aren't really needed there.  I used them solely to visually set off the conditional subexpression.

I don't know if you will need to guard against $parttwelve being changed once its been set to true.  If you do, then you could do something like the following:

<<if not $parttwelve>>
	<<set $parttwelve to ($partone and $parttwo and $partthree and $partfour and $partfive and $partsix and $partseven and $parteight and $partnine and $partten and $parteleven)>>