just to add:
The "set a variable or attribute" (and just remember in its drop-down-box to select "EXPRESSION", don't leave it selected on "???") and "If..." Scripts enables you to do most of whatever you may want to do, they're very powerful~useful Scripts.
In Code, it's syntax~format is this:
object.attribute = value_or_expression
~OR~
variable = value_or_expression
which is exactly the same thing as what you do in the GUI~Editor's "set a variable or attribute" Script:
Set variable "object.attribute" = [EXPRESSION] "value_or_expression"
~OR~
Set variable "variable" = [EXPRESSION] "value_or_expression"
so here's some examples:
Object (Name): player
Attribute (Name): alias
Attribute (Type): string
Value_or_Expression: Value
Value: "HK"
Set variable player.alias = [EXPRESSION] "HK"
(the quotes are required for when your Attribute Type is a: string)
(but, the quote usage is more complicated when you're doing an Expression, and not just merely a single Value)
(the built-in "alias" Attribute's Type is a: string, so it needs the quotes)
-------------------------------------
Variable: you_go_first
Value_or_Expression: Value
Value: true_or_false
If... -> Print a message [EXPRESSION] player.speed > monster.speed
-> then -> Set variable you_go_first = [EXPRESSION] true
else -> If... -> Print a message [EXPRESSION] player.speed < monster.speed
-> then -> Set variable you_go_first = [EXPRESSION] false
else -> If... -> Print a message [EXPRESSION] player.speed = monster.speed
-> then -> If... -> Print a message [EXPRESSION] RandomChance (50) = true
->-> then -> Set variable you_go_first = [EXPRESSION] true
If... -> Set variable you_go_first = [EXPRESSION] true
-> then -> Set variable monster.hit_points = [EXPRESSION] monster.hit_points - player.damage
-> then -> Print a message [MESSAGE] You get to go first and damage the monster!
else -> If... Set variable you_go_first = [EXPRESSION] false
-> then -> Set variable player.hit_points = [EXPRESSION] player.hit_points - monster.damage
-> then -> Print a message [EXPRESSION] "The " + monster.alias + "gets to go first and damages " + player.alias + " for " + monster.damage + " damage, leaving " + player.article + " now with only " + player.hit_points + " HP."
-----------
Object (Name): monster
Attribute (Name): dead
Attribute (Type): boolean
Value_or_Expression: Value
Value: false
boolean <-- as is code built-in within quest is the same thing as specifically a --> "true_or_false" flag
Set variable monster.dead = [EXPRESSION] false
you then kill the monster:
Set variable monster.dead = [EXPRESSION] true
booleans~flags is just the *specific* use of "true~false" (which is a type of "dualism~opposites" ~ 2 options) String Values to choose results
----
other types of CONCEPTUAL (*NOT* using the actual Attribute Type: boolean) flags~booleans (2 options for results):
binary ("0~1"): if "0" then do "this", if "1" then do "that"
numbers (any 2 numbers, except 0 and 1): if "5" then do "this", if "23", then do "that"
physics charges: if "-" then do "this", if "+" then do "that"
"on~off": if "on", then do "this", if "off", then do "that"
"yes~no": if "yes", then do "this", if "no", then do "that"
"in~out": ...
"hot~cold": ...
"up~down": ....
"left~right": ....
"male~female": ...
"tall~short": ...
"fat~skinny": ...
...you get the idea...
and we can expand this beyond dualism~opposites (ie: 3 and more options) to choose results:
if "1", then do "this_1"
if "2", then do "this_2"
if "3", then do "this_3"
if "4", ....
etc etc etc
if "red", then do "this_1"
if "blue", then do "this_2"
if "yellow", then do "this_3"
if "purple", ....
etc etc etc
--------------
so, actually (CONCEPTUALLY ONLY: booleans~flags) are just:
(IF)
object.attribute = Value
(THEN...)
(result~action~"whatever_you_want" Script)
object.(Type: Boolean)attribute = (String) Value
Strings ~ String Values:
0, 1, 5, 23, +, -, on, off, yes, no, true, false, in, out, hot, cold, male, female, left, right, up, down, -5, hhh23_888#$%ffss, a, b, c, z, and etc...
-----------
Object (Name): player
Attribute (Name): strength
Attribute (Type): int
Value_or_Expression: Value
Value: 0
int is used as a short form of integer, so if you were coding this, you'd not have to write out "integer"
Set variable player.strength = [EXPRESSION] 100
----------------
and if you want to do (computation ~ adjusting attributes):
Old player.strength Value: 10
(In Code: player.strength = 10)
Object (Name): player
Attribute (Name): strength
Attribute (Type): int
Value_or_Expression: Expression
Computational Operators: + (addition), - (subtraction), * (multiplication), and / (division)
Expression: player.strength Operator 10
Set variable player.strength = [EXPRESSION] player.strength - 10
New player.strength Value: 0
Set variable player.strength = [EXPRESSION] player.strength + 10
New player.strength Value: 20
Set variable player.strength = [EXPRESSION] player.strength * 10
New player.strength Value: 100
Set variable player.strength = [EXPRESSION] player.strength / 10
New player.strength Value: 1
conceptually, it's algebraic substitution:
Old: player.strength = 10
player.strength (New) = player.strength (Old) + 10 (Value)
player.strength (New) = 10 (Old player.strength Value) + 10 (Value)
player.strength (New) = 10 + 10
New: player.strength = 20