Howdy, Stranger!

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

collecting points, then winning something

Hi all,

A problem I'm facing is that I've had a number of variables to collect points for different things e.g $pa $aa etc.

Now what I want is that if $pa has crossed 250 the player has essentially won $pa (lets name that $plove) and in future, instead of collecting more $pa points, I want to be able to use $plove to insert bits of text when necessary e.g.

$plove She hugs you in the dark.

So in a nutshell:

score points through the game
win/lose the variable $
Winning the variable sets a new state
New state can be used to insert text in passages.

Help!



Comments

  • This solution should do what you ask, it relies on you initializing the $plove variable before hand.

    Place the following in a startup tagged passage.
    (set: $plove to "")
    (set: $pa to 0)
    (set: $aa to 0)
    

    You can use the following to conditionally increment the $pa variable.
    <!-- The following set is used in the example to simulate pa raising to just below the threshhold. It should be removed! -->
    (set: $pa to it + 250)
    
    <!-- Only increament pa if plove has not been set/change yet. -->
    (if: $plove is "")[
    
    	(set: $pa to it + 1)
    
    	<!-- check if pa has exceded the threshhold and if so assign a value to plove. -->
    	(if: $pa > 250)[
    		(set: $plove to "some value")
    	]
    ]
    
    $plove She hugs you in the dark.
    
    note: I added indents, extra line-breaks and HTML comments to the above to make it more readable. You should remove them when you insert the code into your Story.
Sign In or Register to comment.