0 votes
by (1.3k points)

I have lots of characters, and I want the player to be able to remember them. Right now I am using click-replace to do this:

(if: $allowHints is true)[(click-replace: "Tom")[Tom, the blacksmith,] ]

This is working fine except that if you click on Tom *once*, then *all* the instances of Tom change to include the hint. I want people to be able to click each time, that is, they will see the hint only when they want/need to. Is there a way to do this?

1 Answer

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

If I understand what you want, you want all Tom's to be clickable, but each should be clickable on its own and without affecting the others?

If so, try the following:

(if: $allowHints)[(replace: "Tom")[(link-replace: "Tom")[Tom, the blacksmith,]]]

That will replace each instance of the word "Tom" with a separate link.  Each link's text is "Tom", which is replaced with "Tom, the blacksmith," upon being clicked.

NOTE: You do not need to compare a boolean value to one of the boolean literals.  Conditional expressions ultimately resolve to a boolean value, so if your variable contains a boolean value, you may simply use it as-is in the conditional.

by (1.3k points)
Thanks, this works great! And nice to know I can simplify the (if:)s as well.
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...