Quantcast
Channel: Help! with 2.0 - Twine Forum
Viewing all articles
Browse latest Browse all 1844

Harlowe Error with negative numbers?

$
0
0
Hey all,

I'm having trouble getting an if macro to work when a variable is negative.

I'm using the latest version of twine harlowe online, and I have four passages, set up as follows.


Start Passage:
Hello this is a numbers test

[[do a good thing]]
[[do a bad thing]]

$goodBad

do a good thing:
(set: $goodBad to it +1)

YOU DID GOOD!

[[next]]

$goodBad

do a bad thing:
(set: $goodBad to it -1)

YOU DID BAD!

[[next]]

$goodBad

next:
(if: $goodBad is > 0)[Yay! Good ending! You are nice.]
(else-if: $goodBad is < 0)[Hee hee! You rascal. You are not nice.]

$goodBad

So the problem is this: if I do a bad thing, $goodBad prints out as "NaN" and so my else-if statement in "next" won't work. Does Twine not do negative numbers anymore? Or what? How do I get a number to go less than zero without printing out as "NaN"?

Thanks in advance for your help. :)

Viewing all articles
Browse latest Browse all 1844

Trending Articles