Howdy, Stranger!

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

Question about setting variables and Updating Stats sheet issue

So for my game I am needing to have a stats sheet, very choice of games style where the decisions players make affect their stats.

Right now I just have something pretty basic because I don't think it should be too complicated. On my start page I set my values to 0. so something like:

(set: $kindness to 0)

no problem. From there I'm using a header to lead to stats page which is supposed to display the Stats the player has accumulated so simply something like:

Kind: (print: $kindess)

This is all no issue until I try and change the values on my stat page. So say my player choices a path which gives him +1 to kindness I have this notated as:

(set: $kindness to $kindness+1)

which does, I recognize, change the value of "kindness" in that passage itself, however, once I press my link to my stats page, it's still printing a value of 0. I am wondering how to make sure the stats page is updating properly.

Thanks.

Comments

  • Please state the name and version of the Story Format you are using when asking a question, as answers can be different for each one. Based on your examples I will assume you are using Harlowe v1.2.2

    A couple of points about your examples.

    1. Please use the C button found in the comment field's tool bar to wrap your examples with a code tag, it makes them easier to find and read.

    2. Instead of initialising your variables within the first passage of your story you should do that within a startup tagged passage. You can place CSS like the following within your story's Story Stylesheet area to hide any white-space generated by the tagged passage.
    tw-include[type="startup"] {
    	display: none;
    }
    


    3. As explained in the Variable markup section of the manual, you don't need to use a (print:) macro to display the value of a variable on the page.
    Kind: $kindness
    
    note: In your example you have mis-spelt the variable name ($kindess instead of $kindness) and this is what is causing your error!

    4. I suggest using the it keyword when updating a varaible's value, it will lower the chance of misspelling the variable's name.
    (set: $kindness to it + 1)
    


    One further suggest in relation to your header tagged passage containing the Stats markup link. You can use code like the following within your header tagged passage to ensure that the Stats link is not displayed while viewing the Stats passage. (or whatever you named it)
    (if: not ((passage:)'s name is "Stats"))[ [[Stats]]
    ]
    
  • edited January 2017
    As an unrelated note for future help requests. You created this thread in the wrong category. Harlowe is a story format which is only available for Twine 2 and compatible compilers. This thread should have gone in the "Help! with 2.0" category, not "Help! with 1.x".
  • Thanks for the help, Yeah I realized that after. My bad. And thanks for the tips. First time getting into this type of thing.
  • Also, I got it to work! Thanks so much for your help!
Sign In or Register to comment.