Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

(Harlowe) if/else displaying wrong hook

I have the following scenario:
(set: $FLIRT to "catch someone's eye")
<tw-link class='cyclingLink' data-cycling-texts='["catch someone&apos;s eye", "find a lucky catch"]' onclick='clickCyclingLink(this, "$FLIRT");'>$FLIRT</tw-link>

In next passage:
(if: $FLIRT is "catch someone&apos;s eye")[he approaches you]
(else:)[you approach him]

(I know about backslashes helping with apostrophes, but I get error messages when I try "someone\'s")

Thing is, when I click through the options in the first passage and return to "catch someone's eye," the next passage continues to display the else statement.

Comments

  • The first issue is caused by the web-browser's parsing of the tw-link element, it converts the apos into a single quote character but the same thing does not happen with the String value in the (set:) macro. This means that if you click on the link twice the $FLIRT variable changes from a String value with an apos in it to one containing a single quote instead, and this is why the (if:) macro does not work.

    I am not totally sure what is causing the second issue (error when escaping the single quote) but I would guess it is either:

    1. The result of the regular expressions used by Harlowe to parse the passage contents having problems with the stacking of the single/double/escaped quotes.

    2. Furkle's Cycling Link code having a similar problem.

    3. A little of both 1 and 2.
  • I just realised I did not include the solution, change the apos in the (set:) and (if:) macro calls to a single quote but leave the apos in the tw-link element.
    eg.
    (set: $FLIRT to "catch someone's eye")
    
    and
    
    (if: $FLIRT is "catch someone's eye")[he approaches you]
    
  • edited November 2015
    greyelf wrote: »
    The first issue is caused by the web-browser's parsing of the tw-link element, it converts the apos into a single quote character but the same thing does not happen with the String value in the (set:) macro. This means that if you click on the link twice the $FLIRT variable changes from a String value with an apos in it to one containing a single quote instead, and this is why the (if:) macro does not work.

    Looks like this was the issue. I changed the apos as you suggested, and everything is working perfectly. Thanks!
Sign In or Register to comment.