Axe Software Forums
  Quest Developer Forum
  Question concerning variables


Author Topic:   Question concerning variables
Tyrant posted 18-01-2002 23:08 GMT     
In my little example, I want the player to type any number from 1 to 20 by using the "Put what the player types next to ? string variable". The string variable is called #digit#. Now how can I check to see that the player only types a number from 1 to 20? I want to prevent the player from typing any letters or words, as well as any numbers less than 1 or greater than 20. Does Quest have a specific function for this?

Thanks

Alex posted 19-01-2002 02:13 GMT          
Anything that isn't a number should be evaluated as zero, so this should work:

enter <digit>
if (#digit# < 1) or (#digit# > 20) then msg <Foolish boy>

carlii posted 24-01-2002 04:07 GMT          
What a good idea Alex. Thanks!