Howdy, Stranger!

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

Conditional links using Snowman

a52a52
edited July 2016 in Help! with 2.0
How can you display different options based on a condition using Snowman? Is there a "showLink()" method, or do you just use "if(this) next_page"?

Edit:
Or Sugarcube, either one. I've yet to decide which, but I know that Harlowe is far too simple.

Comments

  • As explained in Snowman's documentation that story format is designed for people that know how to program using HTML, CSS, Javascript, jQuery and Underscore.

    The following is one way to do what you asked using Snowman.
    <% s.someVariable = "value" %>
    
    <% if (s.someVariable == "value") { %>
    This text should appear.
    <% } %>
    

    The following is the same example as above using SugarCube.
    <<set $someVariable to "value">>
    
    <<if $someVariable is "value">>
    This text should appear.
    <</if>>
    
  • a52a52
    edited July 2016
    greyelf wrote: »


    Okay, thanks. I guess my confusion was due to thinking that the text would be inside of the code section.

    I know Java and C, but my Javascript's a little rusty.
  • a52 wrote: »
    I guess my confusion was due to thinking that the text would be inside of the code section.
    It can be. As I stated in my other comment, that was one way to do what you asked and here is another.
    <% s.someVariable = "value" %>
    
    <% if (s.someVariable == "value") { print('This text should appear.'); } %>
    
    ... the Underscore library allows you to do the same thing a number of different ways.
Sign In or Register to comment.