0 votes
by (8.9k points)

I suspect that the answer is "no", in which case that's fine – I can get the effect I want by using <<if>> macros and linking the passage to itself.  However, just in case:

Imagine a passage with two <<linkreplace>> macros:

"But Alderaan is a peaceful planet!" you protest.

"You would prefer another target, a military target?" demands Tarkin.  "Then name the system!"

/* The first <<linkreplace>> macro */
<<linkreplace "Tell the truth.">>"Yavin 4," you murmur.<</linkreplace>>

/* The second <<linkreplace>> macro */
<<linkreplace "Lie.">>"Dantooine," you murmur.  "They're on Dantooine."<</linkreplace>>

My desire is that clicking one of the <<linkreplace>> macros removes the other (so the player can't both tell the truth and lie).  Is that possible?

2 Answers

+2 votes
by (68.6k points)
selected by
 
Best answer

In such a case I'd probably recommend using the individual <<link>> and <<replace>> macros on an ancestor element.  For example:

<div id="choices">\
<<link "Tell the truth.">>
	<<replace "#choices">>"Yavin 4," you murmur.<</replace>>
<</link>>

<<link "Lie.">>
	<<replace "#choices">>"Dantooine," you murmur.  "They're on Dantooine."<</replace>>
<</link>>
\</div>

 

by (8.9k points)
Perfect, thank you!  This has saved me a load of variable setting and relinking the passage to itself.  It seems like a much more elegant way to do what I want.
by (8.9k points)
Also, thanks litrouke for your answer &ndash; spans work just as well.
+2 votes
by (1.7k points)
/* The first <<linkreplace>> macro */
<span id="truther"><<linkreplace "Tell the truth.">>"Yavin 4," you murmur.<<replace "#liar">><</replace>><</linkreplace>></span>

/* The second <<linkreplace>> macro */
<span id="liar"><<linkreplace "Lie.">>"Dantooine," you murmur.  "They're on Dantooine."<<replace "#truther">><</replace>><</linkreplace>></span>

There may be a better way, but here's how I do it. Put a span around each thing you want to remove -- make sure their IDs are unique and easy to remember. Then, replace the other ID with nothing --- in effect, deleting it. (You could also replace it with the same text, but not within a linkreplace macro, so that the player can still see what they could have chosen prior to this point --- ie, <<replace "#truther">>Lie.<</replace>>)

Also....... eyes emoji @ all these Star Wars references... I'm intrigued.

edit: As an aside comment to my answer on a previous post, I still highly recommend installing that add-on pack. It has so many useful macros that I find it invaluable in every story.

...