[Twine 2][Harlowe 3]link in display is not working

Hi, I’m working on a selection system where it gets called up by
(link-replace: “select”)[(display: “SELECT”)]

The passage SELECT is working fine when I check but when I test the whole thing, all the links become unclickable and white. Is there a way to fix that? I’m using chrome with the default Harlowe.

You didn’t supply the contents of the SELECT Passage, so it’s difficult for us to debug what the issue is.

I created a new Harlowe 3.x based project that contain your example code in the initial Passage…

(link-replace: "select")[(display: "SELECT")]

…and a couple of links like the following in a Passage named SELECT

[[Link 1->Target Passage]]
[[Link 2->Target Passage]]

…and when I Played the project, selecting the “select” link displayed the two links in the SELECT passage correctly.

Sorry, it’s my first time here, this is the code for the passage, its a bit repetitive so I only put in three lines of it but it’s basically copy and paste.

[
[None]<back|
(if:$inventory contains “Red_key”)[[Red key]<red_key|]
(if:$inventory contains “Blue_key”)[[Blue key]<blue_key|]
(if:$inventory contains “Paper”)[[Paper]<paper|]
]<select|

(click:?back)[(replace:?select)[You decide not to select anything]]
(click:?red_key)[(replace:?select)[(set:$select = “red key”)You selected the (print:$select).]]
(click:?blue_key)[(replace:?select)[(set:$select = “blue key”)You selected the (print:$select).]]
(click:?paper)[(replace:?select)[(set:$select=“paper”)You take out your (print:$implement).]]

I tried just copying and pasting the passage code into the initial passage but it still had the same problem.

As your code stands, it works. It might be a problem in the passage that’s calling it.
Personally, I put the hooks at the front instead of the back, stops creating accidental passages.

Due to how the (click:) family of macros are implemented (1) it is generally recommended that you use one of the (link:) family of macros instead whenever possible.

The following is a variation of your own SELECT passage code, that has been changed to use a (link:) macro instead. I have also added the usage of Collapsing whitespace mark-up and HTML line-break <br> elements to better control when & where blank lines appear.

|select>[{
(link: "None")[(replace: ?select)[You decide not to select anything]]
(if: $inventory contains "Red_key")[
	<br>
	(link: "Red key")[
		(replace: ?select)[{
			(set: $select = "red key")
			You selected the (print: $select).
		}]
	]
]
(if: $inventory contains "Blue_key")[
	<br>
	(link: "Blue key")[
		(replace: ?select)[{
			(set: $select = "blue key")
			You selected the (print: $select).
		}]
	]
]
(if: $inventory contains "Paper")[
	<br>
	(link: "Paper")[
		(replace: ?select)[{
			(set: $select = "paper")
			You selected the (print: $select).
		}]
	]
]
}]

You can safely remove the extra line-breaks & indentation I have used to make the code more readable.

(1) Each of (click:) family of macros need to wait until the entire Passage content has been processed and the generated HTML elements have been added to the ‘current’ web-page before the macro can scan the entirety of the ‘current’ webpage’s HTML structure looking for the specified ‘target’, so each occurrence can be converted into a ‘link’. This scanning process needs to be done for each and every (click:) macro call made within the current passage, and any dynamic change to the HTML structure of the ‘current’ web-page (like those done using the (replace:) macro) may cause the whole scanning process to be re-done.

So in the case of your SELECT that scanning was initially done 4 times when the contents of the Passage was initially process, once for each of the 4 (click:) macros within that Passage. And another 4 times when one of the ‘links’ was selected.

Thanks! Sorry for the long wait, I was busy with real-life lately but it did work!