[SOLVED] need help with debugging this thing

been a long time since i've been making things with Quest, encountered this bug, would like someone to fix this because I can't debug.
Error running script: Error compiling expression 'player.hunger = < 50 ': SyntaxError: Unexpected token "<"; expected one of "-",

the turnscript script:

player.hunger = player.hunger - 1
player.thirst = player.thirst - 1
if (player.hunger = < 50 ) {
OutputTextNoBr ("Your stomach begins to rumble, You want to eat some food.")
if (player.hunger = < 1) {
msg ("You're starving to death..")
DecreaseHealth (1)
player.sanity = player.sanity - 1
}
}
if (player.thirst = < 50) {
OutputTextNoBr ("Your throat is dry, you need water.")
if (player.thirst = < 1) {
DecreaseHealth (2)
player.sanity = player.sanity - 1
}
}
if (player.sanity = < 25) {
msg ("You're hearing voices. They're telling you about how tasty human flesh is... You attempt to drown out the voices.")
if (player.sanity = < 1) {
PrintCentered ("You go insane, and eat yourself alive. tearing yourself open with your hands and having a grand feast on your own body.")
msg ("GAME OVER")
finish
}
}

the other turnscript

player.sanity = player.sanity - 1


Error compiling expression 'player.hunger = < 50 ': SyntaxError: Unexpected token "<"

This tells you pretty clearly that it sees a < when it doesn't expect one in the expression player.hunger = < 50

That's because a conditional expression should look like "first-value operator second-value". Your expression has two operators, = and <, so it sees < where the second value should be.

your operator needs to be one of the symbols:

  • = (equal)
  • <> (not equal)
  • < (less than)
  • > (more than)
  • <= (less than or equal)
  • >= (more than or equal)

Hopefully that's clear. I assume in this case your = < was suupposed to be either < or <=.


ty very helpful


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums