Harlowe: links go rainbow and get hard to click

I honestly don’t know what’s causing this, but I’m using Harlowe 3.1.0 and sometimes click macros and/or links that worked entirely normally before become… incredibly hard to click for some reason. I really have to mash on them for the click to register. Odder still, when I simply hover over them, the link rapidly cycles through colors, even when the link or macro would not typically change color on a hover.

Has anyone else had this experience? Do you know what causes it and how to avoid it? (I suspect it may have something to do with the live: macro, but it’s too difficult to regularly reproduce.)

Do you have active (live:) macros in the same passage as the strangely behaving (click:) based links?
If so are those (live:) macros updating the content of the page?

I did in the most recent instance of this, but I seem to remember that this happened once or twice on passages without the live: macro as well.
However, the live: macro is NOT wrapped around the link behaving this way.

I did in the most recent instance of this…

Is this answer in relation to only my 1st question about having “active (live:) macros”, or is it also in in relation to my 2nd question about “those (live:) macros updating the content”?

background:
The (click:) family of macro need to wait until after the current page has been updated with all the HTML elements being generated by the content of the current Passage before it can scan the whole of the HTML contents of current page to find all instances of the (click:) macro’s associated target hookname or “text”.

This scanning process may need to be re-done each time the HTML content of the page is dynamically changed by the current passage, like the changes done by an active (live:) macro. Both the scanning process and the execution of the (live:) macro’s associated hook interfere with an end-user’s ability to interact with the current page, and both can result in unwanted visual effects on the current page.

The above behaviours is one of the main reasons why:
a. it is strongly recommended that you use the (link:) related macros instead whenever possible.
b. to only have a single (live:) macro active at any one time.

I would need to know more about your code to be able to suggest a work around for your specific issue.

What I want to do is to set a variable with the (click:) macro. If that is clicked (and therefore the variable is set to TRUE), a link at the bottom of the page is updated to lead to [[Place2]] instead of [[Place1]]. If that variable is changed back to FALSE before the link at the bottom is clicked, the link should update back to leading to [[Place1]].

Does that make sense? I fear that I’m not explaining myself too well.

Does the Link Text of the effected link need to change, or just the Name of the Target Passage?

Just the name of the target passage.

The following example does what you asked, it uses a $target story variable to track which Target Passage the “Continue” link will send the Reader to.

(set: $toggle to false, $target to "Place1")\

(link-repeat: "Toggle Target")[{
	(set: $toggle to not $toggle)
	(if: $toggle)[
		(set: $target to "Place2")
	]
	(else:)[
		(set: $target to "Place1")
	]
}]

(link: "Continue")[
	(go-to: $target)
]

You can change the names of the story variables being used to whatever makes sense to your project.

note: The above only contains the $toggle variable because your description included such a variable, if you don’t need to check the value of this variable within some later passage then the above example could be reduced to the following instead.

(set: $target to "Place1")\

(link-repeat: "Toggle Target")[{
	(if: $target is "Place1")[
		(set: $target to "Place2")
	]
	(else:)[
		(set: $target to "Place1")
	]
}]

(link: "Continue")[
	(go-to: $target)
]

Thank you! I will try this instead.