Noob question on permanent click-replaces

Please specify version and format if asking for help, or apply optional tags above:
Twine Version: 2.3.9
Story Format: 2.1.0

Maybe I’m just not searching the right terms, but I haven’t seen anyone else asking and I wanted to check and make sure I’m not overcomplicating things.

I have a MEMORY passage: players can unlock memories and return to the passage to read them. Some of the memories are somewhat long, so to make them more readable I broke them into chunks that the player clicks to read more of. It ensures that they read thoroughly instead of skimming and helps with pacing. Originally I had this set up very simply, like so:

{text1text1text1text1text1text1text1text1text1text
<p>[∨]<memory1-2|</p>]
(click: ?memory1-2)[text2text2text2text2text2text2text2text2text2text2
<p>[∨]<memory1-3|</p>]
(click: ?memory1-3)[text3text3text3text3text3text3text3text3text3text3
<p>[∨]<memory1-4|</p>]}

But I quickly realized that doing it this way meant that, every time someone left the MEMORY page and then returned, all the text they’d previously clicked to reveal would be hidden again. I want them to click to reveal during their first read-through, but be able to leave and return and find all the text permanently revealed.

I know that I can work around this with variables - I came up with this, which I think works:

text1text1text1text1text1text1text1
<p>[∨]<memory1-2|</p><p>[]<replace1-2|</p>
{(click: ?memory1-2)[(set: $memoryone2 to "clicked")]
(live:)[(if: $memoryone2 is "clicked")[text2text2text2text2text2text2text2
<p>[∨]<memory1-3|</p><p>[]<replace1-3|</p>]]
(click: ?memory1-3)[(set: $memoryone3 to "clicked")]
(live:)[(if: $memoryone3 is "clicked")[text3text3text3text3text3text3text3text3text3
<p>[∨]<memory1-4|</p><p>[]<replace1-4|</p>]]

Is that a sensible way to handle this? Will it be a problem if I have 25 “(live:)” commands running on the page at once? Is there an extremely easy permanent click-replace command that I just can’t find? I don’t want to be overly convoluted.

My other (extremely ignorant) question is that as I was testing my new solution on my laptop, I realized that tap-clicking the “∨” worked to expand it, but regular-clicking on my trackpad did not. Only taps. I tested this in several other apps but the difference only appears to be in Twine. Is this a weird Twine thing? Twine doesn’t distinguish between types of clicks, does it?

You could try this: I’ve used (link:)[(show:)] instead of (click:) so the "v"s disappear after you click them, used an (if:) with a single variable that counts up to decide whether to show the “v” or the text, and used the unclosed hook markup to mark the “rest of the passage” instead of having to close each one.

text1text1text1text1text1text1text1text1text1text
(if: $memory1 < 2)[(link: "<p>v</p>")[(show: ?memory1-2)]](else:)|memory1-2>[=(set: $memory1 to 2)
text2text2text2text2text2text2text2text2text2text2
(if: $memory1 < 3)[(link: "<p>v</p>")[(show: ?memory1-3)]](else:)|memory1-3>[=(set: $memory1 to 3)
text3text3text3text3text3text3text3text3text3text3

Thank you so much! I tried it, but perhaps I’m not understanding unclosed hooks: I keep getting the message “The (else:) command should be assigned to a variable or attached to a hook.►” Then I tried closing the hooks at the very foot of the page, which got rid of the error message; but when I did this only text2 remained after leaving the page and returning to it again.

Hmm. Can you paste the code you’re using? I got it working in Twine and then just copy-pasted here, so unless I’m on an older version of Harlowe and something changed…which seems somewhat unlikely.

Edit: Oh, wait, I can’t read. You said you’re using 2.1.0, I tested this on 3.1.0. Gah.

Yup. And I put the (set:) in the wrong place, that’s why only the second one was showing up. Sloppy, sloppy. Sorry about that. Try this.

text1text1text1text1text1text1text1text1text1text
(if: $memory1 < 2)[(link: "<p>v</p>")[(show: ?memory1-2)(set: $memory1 to 2)]](else:)|memory1-2>[
text2text2text2text2text2text2text2text2text2text2
(if: $memory1 < 3)[(link: "<p>v</p>")[(show: ?memory1-3)(set: $memory1 to 3)]](else:)|memory1-3>[
text3text3text3text3text3text3text3text3text3text3]]

So basically, if it’s not shown, give a link which shows it and sets the variable so it will be shown next time you visit the page. Else it is already shown, so just show it.

Ahhhh that worked PERFECTLY! Thank you!! So I do need to close all the brackets at the very end of all the text, not use an unclosed hook?

Yeah, unclosed hooks were added in Harlowe 3. So…you may be able to switch the story format? Worth a try, I think. You can always switch it back. Maybe make a backup copy first, just in case, but I don’t think it can break your story permanently.

OK, so this worked perfectly except for one thing: when I test it, I can easily expand every link and leave the page. But when I come BACK to the page, I get the error “Printing this expression may have trapped me in an infinite loop.” Did I repeat something too many times? Is there a limit to how many times I can repeat a command per page?