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

Booleans as numeric values

$
0
0
Hi all,
in twine, are the numeric values of "true" and "false" guaranteed to be 1 and 0 respectively? I know that in some other languages, you only know that "true" is nonzero.

The reason I'm asking is that I'm trying to do something like this:
<<set $kindness to $walked_dog + 2*$fed_horse + 5*$rescued_kitten>>
and I would like to be sure that the result will be 8 if those three things are true, no matter what computer this game is played on.

The alternative would be to do
<<set $kindness to 0>>
<<if $walked_dog>><<set $kindness += 1>><</if>>
and so on, but that's horrendous and I'd rather not have to.

I am using Twine 2.0.11 and Sugarcube 2.14 if that matters.

Viewing all articles
Browse latest Browse all 1844

Trending Articles