0 votes
by (2.2k points)
edited by

Harlowe 2 is what's being used

Hello, I'm using Furkleindustries' cycling link macro and it's pretty handy but I'm running into two small problems that I haven't been able to work out all by myself.

The first one is that within the alternatives for the cycling link, I would like some things to be striked through but it isn't being recognized. I've used the ~~word~~ and <s>word</s> syntax to mark it but when it shows up it shows up exactly how it's written.

(set: $var to "word")<tw-link class='cyclingLink' data-cycling-texts='["~~word~~", "word"]' onclick='clickCyclingLink(this, "$var");'>$var</tw-link>

That's how that looks, the ~~ shows up as if it's verbatim.

How would I go about fixing this? If I can't fix this is there an alternative that I can use to get what I want to happen without running into this problem?

My second problem is that when I click it to strike through and then move on, the word resets into it's unmarked state. Is there a way to stay on a certain option, so that the "word" stays crossed out even after moving onto another passage? Would that require something more complex?

Thank you in advance

1 Answer

+1 vote
by (159k points)
edited by
 
Best answer

warning: The Furkleindustries implementation of Cycling Link uses a Scope Escalation hack to access the undocumented internals of the Harlowe story format's JavaScript based engine, this engine has been deliberately designed by it's developer to restrict access to those internals and any future changes made to this engine by it's developer may casue Furkleindustries Cycling Link to stop working correctly.
 

The Furkleindustrie implementation of Cycling Link works by using JavaScript to directly manipulating the text component (the $(element).text(currentText); line in the related code) of the HTML tw-link element generated by the story format for the current Passage.

Because of this any Harlowe Style markup (eg. ~~word~~) or HTML element markup (eg. <s>word</s>) you wrap the items contained within your data-cycling-texts Array in will be processed as if it is just plain-text, not as the Harlowe/HTML markup it actually is.

You could modify the JavaScript code of the Furkleindustrie implementation to use the jQuery html() function instead so that it treated the items contained within the Array as HTML instead of plain-text, which would potentially allow you to use the HTML s element (strikethrough). However that still wouldn't support using Harlowe Style markup because that requires accessing the restricted part of the story format's engine that handles the conversion of Harlowe Style markup to HTML element markup.

The Twine Cookbook contains a Harlowe based implementation of Cycling Choices / Links which does support adding Harlowe Style or HTML markup to the items contained in the Array, as demostrated by the following modified copy of the example's Start passage.

:: Start
(set: $choices to (array: "~~word~~", "word"))
Click options to cycle: [(display: "Cycling")]<choice|
[[Submit|Results]]

 

...