Sugarcube: Can I make one variable overwrite another variable?

The thing I want to do is have a set variable to denote what starting point the reader takes because that affects text throughout the thing. What I want is later on a second variable is tripped just before returning to an already visited passage and because that second variable holds true. the prior text is replaced with new text.

I could have this happen as its own passage, but I do want to try doing this less because of current project and more ‘learn if this is doable and if so how so it can be implemented later on in other projects.’

Edit: Right now i have each of the starting variables as true/false flags that get tripped when starting out in such a way that there will always be a single true variable. Was thinking 'what if i just set that starting variable to false and have a state that’s ‘well now ALL the starting flags are false’ text.

Edit: Thanks @hanonO

I’m having trouble parsing exactly what you want, partially because you spend more time trying to explain how you think it needs to be done, rather than what you actually want to do.

Are you trying to determine what the first choice the user made was? If so, you can track that either by checking to see what passages they’ve visited using the hasVisited() function, something like this:

<<if hasVisited("Passage Name")>>
	Text or code for if they've visited that passage.
	Text or code for if they haven't visited that passage.

Or by setting a variable when you go to the next passage, something like this:

[[Choice 1][$choice = 1]]
[[Choice 2][$choice = 2]]

If you want to change the value of that variable later on, you’d just do something like this:

<<set $choice = 3>>

Then you could check the value of that variable like this:

<<switch $choice>>
<<case 1>>
	Text or code for if they picked choice 1.
<<case 2>>
	Text or code for if they picked choice 2.
	Text or code for if they picked anything else.

If that doesn’t answer your question, instead of saying how you want to do something, try just explaining what you want as the end result.

Hope that helps! :slight_smile:

On the one hand you provide what might be what I am looking for.

On the other you go out of your way to insult the fact I have little idea of what I’m doing so basically all but call be a moron because I’m explaining what I’m trying to do based around what i THINK it will give me because i"m not sure how better to word the problem.

I’m not sure how to feel. So I’ll get back to you after plugging what you handed me in to see if that works.

I apologize.

I wasn’t at all trying to insult you or say that you’re a moron, I was just trying to explain why it was difficult for me to understand what you wanted. That way, if I didn’t give you what you were looking for, you would be able to have a better idea of how to clarify what you actually wanted to do.