[Twine 2.1/Sugarcube 2] if variable less then X but not 0

0 votes
asked Dec 30, 2017 by Loliconman (490 points)

Hello again!

 

This time is a lot simpler question.

 

I am trying to make a variable that if lt 15 but not 0. I want 0 to do another variable.

Example:

<<if $Variable lt 15 (but not) 0>>it is less than 15 but not 0<<if>>

<<if $Variable is 0>>It is 0<</if>>

1 Answer

+1 vote
answered Dec 31, 2017 by TheMadExile (47,560 points)

Did you mean, literally, less than 15 and not 0 or, more likely, greater than 0 and less than 15?  Here are examples of both:

→ Not 0 and and less than 15.  Range of -Infinity to 15, excluding 0.
<<if $Variable isnot 0 and $Variable lt 15>>
	less than 15, excluding 0
<<elseif $Variable is 0>>
	exactly 0
<</if>>

→ Greater than 0 and less than 15.  Range of 1 to 14.
<<if $Variable gt 0 and $Variable lt 15>>
	less than 15 and greater than 0
<<elseif $Variable is 0>>
	exactly 0
<</if>>

 

commented Dec 31, 2017 by Loliconman (490 points)
Worked like a charm!

 

Thanks for helping me so much!
Welcome to Twine Q&A, where you can ask questions and receive answers from other members of the community.

You can also find hints and information on Twine on the official wiki and the old forums archive.

See a spam question? Flag it instead of downvoting. A question flagged enough times will automatically be hidden while moderators review it.
...