0 votes
by (170 points)
edited by

Apologies, I accidentally submitted this blank by mistakenly hitting return.

I'm trying to make [[Link]] which will change the truth value of a variable to its opposite.  I have two NPCs to describe, the player picks which to look at first.  The link simply says "examine the other one."

I'm using the variable $ExamineTest is keep track of which of the NPCs is which, one is TRUE the other FALSE, this is initialized to FALSE at start.

The line should point the player back to the same room, and I'm usng an if:statement tied to the variable to choose which description is displayed.  That part seems to work.  

(link: "Examine the other one.")[(if: $ExamineTest is true [set: $ExamineTest to false])](else: (set: $ExamineTest to true))(goto: "Examine the men")

Any suggestions?

========

Someone asked for clarification of problem, so I wanted to edit that reply here:

If $ExamineTest is true, I want to set it to false.

If $ExamineTest is false, I want to set it to true.

Now, regardless of the above, I want to send the player to the same room to reload the room, and display the other variable's text.

2 Answers

0 votes
by (2.4k points)
I do not understand the question.
by (170 points)
If $ExamineTest is true, I want to set it to false.

If $ExamineTest is false, I want to set it to true.

Now, regardless of the above, I want to send the player to the same room to reload the room, and display the other variable's text.
+1 vote
by (159k points)

note: Your original example inclide a number of syntax error, my examples will include fixes for them.

You can use the Boolean not operator to qickly flip a true value to a false one and visa versa.

(link: "Examine the other one.")[
	(set: $ExamineTest to not $ExamineTest)
	(go-to: "Examine the men")
]


You can also use the (if:) and (else:) macros to achieve the same outcome if you perfer....

(link: "Examine the other one.")[
	(if: $ExamineTest)[
		(set: $ExamineTest to false)
	]
	(else:)[
		(set: $ExamineTest to true)
	]
	(go-to: "Examine the men")
]

 

by (170 points)
Excellent, thank you!  That did exactly what I had envisioned.  I appreciate the help.
...