Howdy, Stranger!

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

[harlowe] "Badly written expression" Error message not helping.

Can you spot the mistake, please? It's supposed to get me one random name off the array, yet I get an "unexpected token illegal" error.
{(set: $highfnames to (array: “Adelaide“, “Adèle“, “Adeline“, “Agathe“, “Agnès“, “Aïcha“, “Albane“, “Alex“))

(set: $lovename to $highfnames)

}

Also, can I include special characters like é, è. or ï in the names, or should I remove them?

Comments

  • edited August 2016
    You may use single quotes or double quotes when quoting. You're probably using typographic/curly quotes, which aren't syntactically valid. You may use them in you normal text, just not in code.

    Try:
    {
    (set: $highfnames to (array: "Adelaide", "Adèle", "Adeline", "Agathe", "Agnès", "Aïcha", "Albane", "Alex"))
    (set: $lovename to $highfnames)
    }
    
    Accented characters should be fine. If you're copy-pasting from another application, however, you might want to ensure that it's set to the utf-8 encoding as I'm unsure if Twine 2 will convert from your local code page properly upon paste—it probably will, but I haven't tested that.
  • The expression was correct, or so it seems. But I think it can't grab just a single random name from the array, so I had to try a different method.
  • No. The expression was not correct. Typographic quotes are not legal syntax—this is not in question.

    Beyond that, I only corrected the quoting error. A full example, including a random selection from the array by spreading it into the (either:) macro, would be:
    {
    (set: $highfnames to (array: "Adelaide", "Adèle", "Adeline", "Agathe", "Agnès", "Aïcha", "Albane", "Alex"))
    (set: $lovename to (either: ...$highfnames))
    }Your love is $lovename.
    
Sign In or Register to comment.