Howdy, Stranger!

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

How do I add stats?

edited February 2016 in Help! with 2.0
I'm really new to Twine, and I'm looking for documentation or advice on how to add stats using Snowman.

I basically want to be able to add or remove a stat from the player, then run a check (in later steps) with outcomes dependent on the level of the stat.

Does that make sense?

Comments

  • Sounds like you want to use variables and conditional statements.
    I haven't used snowman, but those are the terms you're looking for.
    add or remove a stat from the player
    - setting and unsetting variables. $str = 10
    then run a check (in later steps) with outcomes dependent on the level of the stat.
    - conditional statements: if x eq true, do blah blah blah

  • The Snowman 2 documentation can be found here, as you can see it is brief and relies on you knowing (or being willing to learn) at least a little about HTML, CSS, Javascript and possibly Underscore.

    The documentation mentions that code in <% blocks %> has access to the s variable which is used to store your story's variables like so:
    <% s.strength = 18 %>
    
    ... You can show the current value of a variable using a <%= block %> like so:
    Your strength is <%= s.strength %>
    
    ... and you can conditionally show text by checking the current value of a variable like so:
    <% if (s.strength == 18) { %>You are strong<% } %>
    

    * Note that Javascript uses a single equal sign = to assign a value to a variable, where as a double (or triple) equal sign == (or ===) is used to compare two values.
  • Thank you both so much! I do know some front-end. I'm glad it comes in handy here! :)
Sign In or Register to comment.