Howdy, Stranger!

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

Displaying a Passage, and Setting a variable with a Passage selection in Snowman

Does Snowman have something similar to (display: passagename) from Harlowe, to display one passage inside another?

Is there a simple/concise way to set a variable when a passage link is clicked? I'm looking for something similar to setter-links from Twine 1.4
(eg [[Garb of the Hawk][$hat = "beak"; $shoes = "talons"]])



  • As explained in the Snowman 2 documentation it:

    a) requires you to know javascript, and
    b) it is using the Underscore template render.

    To display one passage inside another try adding the following to your passage:

    <%= story.passage("Other Passage").render() %>
    To assign a value to a variable do the following:
    (note: replace bob with your variable name.)

    <% s.bob = "Hi there" %>
    To print the value of a variable do the following:

    The value of bob is: <%= s.bob %>
    There is no equivalent of a setter link in Snowman 2, you would have to create the feature yourself using javascript.
    You could use the code of the built-in render function as a starting point.
  • Thanks. I figured it had something to do with render(), but I was trying to pass it the passage name directly. I probably wouldn't have figured it out myself.

    To create setter links, I wound up writing this function:

    setterLink = function(display, target, script){
    return "<a onclick='" + script + "' href='javascript:void(0)' data-passage=" + target + ">" + display + "</a>"
    Which can be invoked with:

    <%= setterLink('display', 'passageName', 'varName = "pickle"') %>
  • Thanks for the macro @guy231

    Do you know if this macro works with the back button?
Sign In or Register to comment.