Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Disabling (click:) links, without reloading page, without replacing original text (Harlowe)

Hey all. I signed up to ask this since I've found similar examples solved, but I have a specific question that I can't seem to find a solution for.

I want to have a dynamic link system that creates a sense of urgency in a passage. The reader should be able to click certain words (in the sentences) that act as options, and have more text appear in the passage. The problem is, I want the other options given to them to disappear as well, not just the one they clicked.

I know I can accomplish this by replacing the text of the other links, ergo:
This is a test. There are two options. []<continue|
(click-append: "test")[(append: ?continue)[You clicked the first option. (replace: "options")[inert text]]]
(click-append: "options")[append: ?continue)[You clicked the second option. (replace: "test")[inert text]]]
I've done this as a workaround in the past but it's annoying unless I can find something that the player won't notice, and even them it's a bit of a clumsy workaround.

I also know you can achieve this "updating" effect by refreshing a page using (goto:) on itself. I can't really do that either, as I'm using a piece of code I wrote that "typewrites" the text on the screen for effect, and refreshing the page would start that all over again.

I've tried outsourcing the code portion to another passage, with conditions surrounding the click options, and having the code redisplay itself. But this hasn't worked either--the links that are already created stay there, even if the condition that lets it create the link is no longer true. For clarity, here's the code for that:
This text is for testing purposes. Can I create multiple click points in the text and later revoke them without changing the affected text?

(set: $switch = 0)

[]<code|

(replace: ?code)[(display: "Code1")]
And the outsourced "Code1" passage:
{(if: $switch is 0)[
	(click-replace: "revoke")[\
		OPT1\
		(set: $switch = 1)\
		(replace: ?code)[(display: "Code1")]\
		]
	(click-replace: "affected")[\
		OPT2\
		(set: $swtich = 1)\
		(replace: ?code)[(display: "Code1")]\
		]
	]}

I'm really stumped here. I know I'm asking for the moon, but if I got this part working as intended, it would be so satisfying. I plan to use it to present the player with "action sequences" where the live text presents them links that they need to click on quickly (like steering oneself through dangerous whitewater rapids) and have the passage unfold from there. But I need to make sure they can't click multiple options.
Sign In or Register to comment.