Passage links that show as normal text?

Hello, it is i again to pick at the brains of more experienced folk.

I’m setting up the inventory system for the little adventure i’m running, but rather than making it

“do you want to pick up scissors?” [[Pick up scissors]]

I want to be able to “hide” the passage links to such items, for example

“You enter a dusty storage room that has been mostly cleaned out, the only remaining furniture is a tool rack with an in built shelf, the rack still holds a pair of garden shears and a half used up roll of duct tape”

in this sentence i would want the words “shelf” “garden shears” and “duct tape” to be passage links to passages where player can then confirm picking up the item, but i don’t want them to be colored or stand out in any way.

TL;DR how to make a passage link behave as ordinary text? i’m convinced it is possible but atm i’m only finding tutorials that make the text invisible unless clicked which isn’t quite it.

One way you can do it is by creating a named hook |hiddenlink>[ ] and place your link(s) inside. Then you make CSS code in the Stylesheet to target any links inside that named hook.

Passage:

[[Somewhere]]
|hiddenlink>[ [[Somehow]] ]
|hiddenlink>[ You can even have regular text in the hook. [[Someway]] ]

CSS Stylesheet:

tw-hook[name=hiddenlink] > tw-expression > tw-link {
  color: inherit;
  font-weight: inherit;
  text-decoration: inherit;
  cursor: inherit;
}

The code inherit means that it will use whatever property exists just outside the link. So now the hidden link will have the same color, weight/boldness, underline and cursor style as the surrounding text. If you find that some other style is making your links look different, let us know and we’ll figure out what CSS style to add.

Note: Harlowe removes certain characters and changes the capitalization in named hooks when they are generated for the final HTML code used by your game. When targeting named hooks with CSS, just keep the hook names to all lowercase letters with no spaces (hiddenlink vs Hidden-Link) and things should be fine.

2 Likes

Tested and found to work, thank you!

1 Like