0 votes
by (730 points)
I want to have an (if:) statement using the (click:) macro, so if the player has clicked all the (click:) links, more texts will appear. Is it possible to do so, or will I have to just use the (link:) macro instead?

2 Answers

+1 vote
by (159k points)
selected by
 
Best answer

Due to how the (click:) macro needs to scan the entire of the generated HTML page (after it has been rendered) to find the content it needs to convert into a link, and that certain activities can cause that scanning to occur more than once, I would strongly suggest using the (click:) macro only when absolutely necessary and when you can't use a (link:) macro to achieve the outcome you need.

You can use Boolen variables to track if each of the links have been selected or not, an (if:) macro to determine if all the Boolen variables equal true, a hidden hook to hide the extra text, and the (show:) macro to reveal that hidden text later.
Select the following three links and the hidden text will be revealed.

(set: $linkA to false, $linkB to false, $linkC to false)

(link: "Link A")[{
	(set: $linkA to true)
	(if: $linkA and $linkB and $linkC)[
		(show: ?extra)
	]
}]

(link: "Link B")[{
	(set: $linkB to true)
	(if: $linkA and $linkB and $linkC)[
		(show: ?extra)
	]
}]

(link: "Link C")[{
	(set: $linkC to true)
	(if: $linkA and $linkB and $linkC)[
		(show: ?extra)
	]
}]

|extra)[This text is hidden until all three Boolean variables equal true.]

note: I have used extra indentation and line-breaks to make the above example more readable, they can be safely removed from your implementation. I also needed to use Collapsing white-space markup to remove the unwanted blank lines cause by the extra indentation and line-breaks.

+1 vote
by (910 points)
A quick and dirty way to do it would be to have a variable increase by a certain amount with each (click:) macro. Say you have four of them; one increases it by 1, another by 10, then 100, and 1000. Use an (if:) statement to check if the value of the variable is at least 1111, and if so, show the attached hook with the rest of the text.
by (730 points)
How do you set a variable to a (click:) macro? I thought you could only do such to a (link:) macro, or am I wrong?
...