How do I test variables greater than or less than?


#1

Hi, i have an error, that is very, very weird.

My choices:

*choice
 #Shoot.
  *if Gunshooting = 55
   You jump sideways, suprising them, with your aim you take out three, you're behind a pillar now. What will you do now?
   *page_break
   *goto shuto
  *else
   You jump sideways, suprising them, but they quickly shoot you down. (55 gunshooting needed.)
   *page_break
   *goto amnesia

So that’s what i have, but even if a player has 55 Gunshooting, the *else message shows up.
I tried *if Gunshooting >= and => but that doesn’t seem to work.


#2

Try shifting the *else statement over to line up with the rest of the * commands

Or replace the *else with *if Gunshooting < 55


#3

Try putting “Gunshooting = 55” in brackets:
*if (Gunshooting = 55)

BTW, indenting by just one space makes it really hard to see what’s going on,.


#4

Also: you dont need the page_break there


#5

Doesn’t work. :frowning: Sad


#6

copied/pasted the code, tested it and it worked as intended, check if the “Gunshooting” variable really has a value of 55 any other value will go to the *else statement and try some of the suggestions above, by the way you want to use “Gunshooting >= 55” instead of “Gunshooting = 55”


#7

But i have other choices with *if Gunshooting = 55 and it worked. It just doesn’t work here


#8

Hmm that’s weird, like i said i tested and it worked just fine, try creating a *temp like this:

*temp Gunshooting2 55

and change your code to:

*if Gunshooting2 = 55

and check if you still get the bug

If it works maybe some event or choice prior to the one you posted is reducing/increasing Gunshooting


#9

As said in the other thread (you dont need to open multiple threads btw)
Use
*if (gunshooting >=55)
AND
*if (gunshooting <55)

No ‘else’


#10

It works now. But nothing prior to that choice reduced Gunshooting.


#11

Try changing the code to

*if Gunshooting <= 55

and see what happens


#12

Nothing. So weird. :


#13

You can put bits of temporary code in to print variables to help you determine what’s happening when you get hard to track down errors like this. I do it all the time. I put them in square brackets so I can tell them apart from other text. Just add something like…

[Gunshooting is ${Gunshooting}]

before your choice statement and it’ll tell you exactly what the value is when it gets there. That can save you a lot of time.


#14

before *choice or before #?


#15

You’d have to put it before *choice.


#16

I have 65 Gunshooting, and 55 is needed, but i still get f/cked.


#17

Then you need

*if (Gunshooting >= 55)

That’s testing for gunshooting being equal to or greater than 55.


#18

Finally. Thank you. But it’s still weird, since quictest told me it was a mistake.