Howdy, Stranger!

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

Sugarcube 2, javascript which executes if 2 variables reach a certain level

In my story I have a tiredness meter which goes to 150.
Now I want to make it so that if Tiredness is over 100 a warning message is displayed once and the characters hp is lowered.
Then if the player does not do something about it, at 150 I want a game over screen to be shown.

Since I have no knowledge of javascript, everything I tried based on random google results seems to have failed so far.

TLDR
I want a certain passage to be shown if 2 variables reach a certain state. If these 2 variables are both correct I also want to set another variable to a new value.

Comments

  • This might be a little sketchy, but in absence of other answers this may help.
    You could format each link like so:
    <<if $Tiredness gte 100 and $Tiredness lt 150>>
    Warning! You are tired.
    <</if>>
    <<if $Tiredness gte 150>>
    You are too tired. You lose.
    <<else>>
    "The normal text of your passage."
    <</if>>

    Does that help at all?
Sign In or Register to comment.