Also, the Boolean Logic / Truth Tables involved:
https://en.wikipedia.org/wiki/Truth_tablehttps://en.wikipedia.org/wiki/Boolean_algebra (this link is a bit more math/physics heavy/focused however)
AND:
true and true -> TRUE
false and true -> FALSE
true and false -> FALSE
false and false -> FALSE
conceptual example:
if you get a 70 or higher score on both test 1 and test 2, you pass the class. If you get a 70 or greater on only one of the tests or none of the tests, you fail the class.
code example:
if (player.test_1.score > 70 and player.test_2.score > 70) { // if both conditions are true, it returns TRUE and thus activates the 'msg' Script below:
-> msg ("You passed the class!")
} else { // since both conditions aren't true, it returns FALSE and thus the 'else's msg' Script is activated instead:
-> msg ("You failed the class...")
}
OR:
true or true -> TRUE
false or true -> TRUE
true or false -> TRUE
false or false -> FALSE
conceptual example:
if you get a 70 or higher score on test 1 or a 70 or higher score on test 2, you pass the class. If you get a 70 or higher on both tests, then of course, you also pass the class. But, if you get lower than 70 on both tests, you of course fail the class.
code example:
if (player.test_1.score > 70 or player.test_2.score > 70) { // Only (a minimum requirement of) one of the conditions needs to be true, for it to return TRUE and thus activates the 'msg' Script below:
-> msg ("You passed the class!")
} else { // since neither of the test scores are 70 or above, it returns FALSE and thus the 'else's msg' Script is activated instead:
-> msg ("You failed the class...")
}
NOT (Negation):
(not) true -> FALSE
(not) false -> TRUE
conceptual examples:
HK is not a famale.
Sarah is not a male.
code example (using/inside-of an 'orc' Object's 'fight' Verb):
if (not orc.dead) {
-> msg ("You fight and kill the orc")
-> orc.dead = true // the orc is set to being dead, as you just killed it.
} else {
-> msg ("The orc is already dead, silly.")
}
VS the same thing, but with/when not using negation ('not'):
if (orc.dead) {
-> msg ("The orc is already dead, silly.")
} else {
-> msg ("You fight and kill the orc")
-> orc.dead = true // the orc is set to being dead, as you just killed it.
}
VS the opposite grammer logic:
if (not orc.alive) {
-> msg ("The orc is already dead, silly.")
} else {
-> msg ("You fight and kill the orc")
-> orc.dead = true // the orc is set to being dead, as you just killed it.
}
VS the same thing, but with/when not using negation ('not'):
if (orc.alive) {
-> msg ("You fight and kill the orc")
-> orc.dead = true // the orc is set to being dead, as you just killed it.
} else {
-> msg ("The orc is already dead, silly.")