Programming uses ASSIGNMENT, which is different than math's EQUALS:
math:
(x = 10) = (10 = x)
programming~coding:
(x = 10) =/= (10 = x): ERROR
the ASSIGNMENT OPERATOR (=) means that you're putting~storing the value_or_expression on the right side of the '=', into the VARIABLE on the left side of the '=', conceptually algebraic substitution:
x = 10
msg ("The value of x is: " + x)
// outputs: The value of x is: 10
player.strength = 10
msg ("The Player's strength is: " + player.strength)
// outputs: The Player's strength is: 10
----------
so, the syntax (in code) for the basic computations is:
// this is my own way of representing the syntax generically (an Attribute):
Object_name.Attribute_name = Value_or_Expression
~and for a conditional, an example using an 'if' Script ~
if (Object_name.Attribute_name OPERATOR Value_or_Expression) { scripts }
----------
OPERATORS:
Assignment or Comparison: =
// quest doesn't have the '==' (comparison operator), it can parse the '=' accurately, to whether to do an assignment or comparison
Addition or Concatenation (Concatenation: literally putting strings together, aka next to each other: "55" + "55" = "5555"): +
Subtraction: -
Multiplication: *
Division (getting the quotient, aka normal devision: 4/2 = 2): /
Modulus (devision, except you're getting~finding the REMAINDER, not the quotient: 5%2 = R1, 4%2 = R0, 5%3 = R2): %
Negation (Not) method A: not Object_name.Attribute_name = Value_or_Expression
// or for Boolean Attributes, the shorthand is: not Object_name.Attribute_name
~OR~
// if you're doing stuff directly in code (non-GUI~Editor), then you need to add the 'CDATA' tags to tell quest that the '<,>' are NOT html tags:
<![CDATA[ scripts ]]>
example:
<function name="student_grade_function" parameters="student"><![CDATA[
if (student.score > 90) {
student.grade = "A"
} else if (student.score > 80) {
student.grade = "B"
} else if (student.score > 70) {
student.grade = "C"
} else if (student.score > 60) {
student.grade = "D"
} else {
student.grade = "F"
}
]]></function>
so, this 'CDATA' tagging applies to all of these: again only if doing directly in code (if doing in the GUI~Editor, than it will automatically handle it for you, do NOT use the 'CDATA' tags if using the GUI~Editor):
Negation (Not) method B: Object_name.Attribute_name <> Value_or_Expression
Greater Than: >
Lesser Than: <
// the equals must be on the RIGHT side:
Greater Than or Equals To: >=
Lesser Than or Equals To: <=
etc etc etc (probably missing a few more operators... meh)
---------
Setting~Re-Setting~Alternating~Manipulating a VARIABLE's (usually using Attributes as your VARIABLES) Value:
player.strength = 0
player.strength = 100
monster.strength = 25
player.strength = monster.strength
// player.strength = 25
monster.strength = 25
monster.endurance = 75
player.strength = monster.strength + monster.endurance
// player.strength = 100
--------------
Addition (examples):
player.strength = player.strength + 5 // or whatever value you want
player.strength = player.strength + player.endurance + player.constitution
----------
*conceptual* example of how it works (using simple addition):
initial (old) value: player.strength = 0
player.strength (new) = player.strength (old:0) + 5
player.strength (new) = (0) + 5
new value: player.strength = 5
old value: player.strength = 5
player.strength (new) = player.strength (old:5) + 5
player.strength (new) = (5) + 5
new value: player.strength = 10
old value: player.strength = 10
player.strength (new) = player.strength (old:10) + 5
player.strength (new) = (10) + 5
new value: player.strength = 15
etc etc etc
---------------------
Subtraction:
player.strength = player.strength - 5
-------------------
Multiplication:
player.strength = player.strength * 5
-----------------
Division:
player.strength = player.strength / 5
----------------
Modulus:
game.seconds = game.seconds % 60
// remember this gets the REMAINDER of a division operation: making it good for cyclic things, such as time and dates (like seconds, minutes, hours, months, days, seasons, etc etc etc)
// 0,1,2,...,59,0,...,59,0,...,59, etc etc etc
// (0%60 = 60: you don't want this, lol), 1%60 = 1, 2%60 = 2, 59/60 = 59, 60%60 = 0, 61%60 = 1, 119%60 = 59, 120%60 = 0, 121%60 = 1, etc etc etc
game.minutes = game.minutes % 60
game.civilian_hours = game.civilian_hours % 12 // 0-11 am, 0-11 pm, 0 (0 or 12): am to pm (noon) or pm to am (midnight)
game.military_hours = game.military_hours % 24 // 0-23, 0 (0 or 24): from old day to new day (midnight)
game.months = game.months % 12
game.days = game.days % 7
game.seasons = game.seasons % 4
-------------------------
IN THE GUI~EDITOR:
Attributes (script that creates, sets, re-sets, changes, alters, manipulates, and~or etc Attributes):
run as script -> add new script -> variables -> 'set a variable or attribute' Script -> [expression], or choose the right option for what you want to do
if you choose the [expression] option, then you can type in the quasi-code (since I don't know the GUI~Editor's options, I like to cheat, choosing the [expression] option which lets me write in what I want the in it directly):
run as script -> add new script -> variables -> 'set a variable or attribute' Script -> [expression]: see below
set variable player.strength [expression] player.strength + 5
the 'if' Script:
or, if you want to use 'if' (or whatever conditional) Script:
run as script -> add new script -> scripts -> 'set a variable or attribute' Script -> [expression]: see below
if [expression] player.strength > monster.strength
-> then, -> add new script -> output -> 'print a message' Script -> print [message] The Player's strength is greater than the Monster's strength.
// choose the [expression] if you want to use VARIABLES or VARIABLES+TEXT, as the [message] is for TEXT only
------
the GUI~Editor's [increase~decrease to object's counter or whatever it is called] script option, only is able to do +1 or -1, which in code is, an example:
player.strength = player.strength + 1
player.strength = player.strength - 1
so, if you want to do~use values other than 1, or different operators (like multiply or divide or modulus), then you're going to have to choose the [expression] script option, and type in the quasi-code yourself.