Howdy, Stranger!

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

Twine doesn't seem to recognize built-in functions

(I'm using Harlowe.)

According to http://twinery.org/wiki/function, I should be able to use built-in functions listed on the page in expressions. But if I include something like:
[[link->previous()]]

in my story, the story literally creates a link to a passage called "previous()".

And if I try to use other functions, like, say, turns(), with the following statement:
(print:turns())

I get the following message when I try to play my story:
turns is not defined

The editor's only help for this issue is:
This error message was reported by your browser's Javascript engine. I don't understand it either, but it usually means that an expression was badly written.

I don't even understand why I'm getting this message, since I'm not using a browser to test my story. I'm using the local version of twine for Windows that you can download from the Twine website.

How can I get Twine to recognize these functions?

Comments

  • Unfortunately the function link you were reading is part of the Twine 1 Guide, and the information in it is not relevant for Twine 2's Harlowe story format. You may wish to read the Twine 2 Guide instead.

    Each story format defines it's own list of macros, the syntax (format) of those macros and what features the story format supports.
    Verity wrote:
    Harlowe has a (history: ) macro which can be used to determine the passage name of the previously shown passage.
    (set: $last to (history:)'s last)
    [[link->$last]]
    
    ... unfortunately the Twine 2 application does not understand advance markup links like the above and it will automatically create a new passage with an incorrect passage name.
    One way to get around this problem is to use the (link-goto: ) macro:
    (link-goto: "Link", (history:)'s last)
    
    Verity wrote:
    (print:turns())
    You can use the length property of array returned by the (history: ) macro to achieve the same result as the above:
    (print: (history:)'s length)
    
    Verity wrote:
    I don't even understand why I'm getting this message, since I'm not using a browser to test my story.
    The installable version of the Twine 2 application contains a built-in custom web-browser, so you are using one when you Test/Play your story.
Sign In or Register to comment.