Multiple comparisons in a conditional
writtenhigh
05 Jan 2016, 19:11I really don't want to nest a bunch of if statements, but I can't find the syntax for doing multiple comparisons (ex. if (player.variable<3 & player.variable>1){do stuff}).

jaynabonne
05 Jan 2016, 19:41It's literally the words "and" and "or" and "not" instead of "&" and "|" and "~". 


XanMag
05 Jan 2016, 20:06I'm not sure if Jay probably answered the question or not... probably and I can't understand your all lingo... 
But, I will leave this link here. It might have been the most helpful thread in my game creation progress.
viewtopic.php?f=10&t=5411&p=37579&hilit=multiple+conditions+met#p37579

But, I will leave this link here. It might have been the most helpful thread in my game creation progress.
viewtopic.php?f=10&t=5411&p=37579&hilit=multiple+conditions+met#p37579
writtenhigh
05 Jan 2016, 21:04Of course it's the one thing I didn't try. o_0
Thanks!
Thanks!
HegemonKhan
05 Jan 2016, 23:01I think you already got it now, but here's some examples and info to look at too:
viewtopic.php?f=10&t=5757&p=39912#p39912
https://en.wikipedia.org/wiki/Truth_table (Boolean-If-Conditional Logic)
https://en.wikipedia.org/wiki/De_Morgan%27s_laws (My brain is still totally unable to understand this logic, but oh well, it still somehow works, lol)
------------
in Quest:
you can have as many (you aren't limited to only 2 conditionals as shown below) and any combination of conditions as you want (or can understand accurately, lol), and you can determine the order of operations just like you do in mathematics, with using parenthesis
'and' Operator:
true and true -> TRUE
false and true -> FALSE
true and false -> FALSE
false and false -> FALSE
quest example: if (student.score >= 90 and student.score <= 100) { msg (student.alias + " got an 'A' grade on the test") }
'or' Operator:
true or true -> TRUE
false or true -> TRUE
true or false -> TRUE
false or false -> FALSE
quest example: if (student.score < 0 or student.score > 100) { msg ("Erroneous score, as no bonus points were given, test needs to be re-checked") }
'not' or '<>' (Negation) Operator:
not true -> FALSE
not false -> TRUE
quest syntax examples:
if (not player.condition = "poisoned") { scripts }
~ is the same as ~
if (player.condition <> "poisoned") { scripts }
// if you're using the '<>' in code (non-GUI~Editor), then you'll need the 'CDATA' tags encasing your scripting
------------
ask if you need help with or explanation of anything
viewtopic.php?f=10&t=5757&p=39912#p39912
https://en.wikipedia.org/wiki/Truth_table (Boolean-If-Conditional Logic)
https://en.wikipedia.org/wiki/De_Morgan%27s_laws (My brain is still totally unable to understand this logic, but oh well, it still somehow works, lol)
------------
in Quest:
you can have as many (you aren't limited to only 2 conditionals as shown below) and any combination of conditions as you want (or can understand accurately, lol), and you can determine the order of operations just like you do in mathematics, with using parenthesis
'and' Operator:
true and true -> TRUE
false and true -> FALSE
true and false -> FALSE
false and false -> FALSE
quest example: if (student.score >= 90 and student.score <= 100) { msg (student.alias + " got an 'A' grade on the test") }
'or' Operator:
true or true -> TRUE
false or true -> TRUE
true or false -> TRUE
false or false -> FALSE
quest example: if (student.score < 0 or student.score > 100) { msg ("Erroneous score, as no bonus points were given, test needs to be re-checked") }
'not' or '<>' (Negation) Operator:
not true -> FALSE
not false -> TRUE
quest syntax examples:
if (not player.condition = "poisoned") { scripts }
~ is the same as ~
if (player.condition <> "poisoned") { scripts }
// if you're using the '<>' in code (non-GUI~Editor), then you'll need the 'CDATA' tags encasing your scripting
------------
ask if you need help with or explanation of anything