Headcannon Game Engine Script Commands - Math Operations (Addition)
Index:
Increment:
(D) (E) | _Reg++ |
(D) (E) | _Chr++ |
(D) (E) | _Obj++ |
Addition - Preserve original values:
(D) (E) | _Reg=Reg+Reg |
(D) (E) | _Reg=Reg+Const |
(D) (E) | _Reg=Chr+Reg |
(D) (E) | _Reg=Chr+Const |
(D) (E) | _Reg=Chr+Obj |
(D) (E) | _Reg=Chr+Chr |
(D) (E) | _Reg=Obj+Obj |
(D) (E) | _Reg=Obj+Reg |
(D) (E) | _Reg=Obj+Const |
(D) (E) | _Chr=Reg+Reg |
(D) (E) | _Chr=Reg+Const |
(D) (E) | _Chr=Chr+Reg |
(D) (E) | _Chr=Chr+Const |
(D) (E) | _Chr=Chr+Obj |
(D) (E) | _Chr=Chr+Chr |
(D) (E) | _Chr=Obj+Obj |
(D) (E) | _Chr=Obj+Reg |
(D) (E) | _Chr=Obj+Const |
(D) (E) | _Obj=Reg+Reg |
(D) (E) | _Obj=Reg+Const |
(D) (E) | _Obj=Chr+Reg |
(D) (E) | _Obj=Chr+Const |
(D) (E) | _Obj=Chr+Obj |
(D) (E) | _Obj=Chr+Chr |
(D) (E) | _Obj=Obj+Obj |
(D) (E) | _Obj=Obj+Reg |
(D) (E) | _Obj=Obj+Const |
Addition - Overwrite original values:
(D) (E) | _Reg+=Reg |
(D) (E) | _Reg+=Chr |
(D) (E) | _Reg+=Obj |
(D) (E) | _Reg+=Const |
(D) (E) | _Chr+=Reg |
(D) (E) | _Chr+=Chr |
(D) (E) | _Chr+=Obj |
(D) (E) | _Chr+=Const |
(D) (E) | _Obj+=Reg |
(D) (E) | _Obj+=Chr |
(D) (E) | _Obj+=Obj |
(D) (E) | _Obj+=Const |
Descriptions:
Increment:
_Reg++
_Chr++
_Obj++
(ALL) (Example)
These Commands increase the value of the given variable by 1.
Parameters:
- Var ID
This is the ID number of the variable to increase
In the case of "Registers", "Var ID" is the ID of the "Register" whose value should be increased. The "U" tag may be used
to specify a user-defined Register. Otherwise, the ID will refer to a Game Register
In the case of Player Variables, "Var ID" is the ID of the Player Variable for the Player that is "Fetched" to "Reference 2" whose value should be increased. The capital "A"
tag may be used to specify an "Active" variable, the lower-case "a" to specify a user-
defined "Active" variable, and the lower-case "c" to specify a user-defined Constant.
Otherwise, the ID will refer to one of the Player's required Constants
In the case of Object Variables, "Var ID" is the ID of the Object Variable for the Object that is "Fetched" to "Reference 2" whose value should be increased. The "E" tag may
be used to specify an "Extra" variable. Otherwise, the ID will refer to one of the
Object's standard variables
Addition - Preserve original values:
_Reg=Reg+Reg
_Reg=Reg+Const
_Reg=Chr+Reg
_Reg=Chr+Const
_Reg=Chr+Obj
_Reg=Chr+Chr
_Reg=Obj+Obj
_Reg=Obj+Reg
_Reg=Obj+Const
_Chr=Reg+Reg
_Chr=Reg+Const
_Chr=Chr+Reg
_Chr=Chr+Const
_Chr=Chr+Obj
_Chr=Chr+Chr
_Chr=Obj+Obj
_Chr=Obj+Reg
_Chr=Obj+Const
_Obj=Reg+Reg
_Obj=Reg+Const
_Obj=Chr+Reg
_Obj=Chr+Const
_Obj=Chr+Obj
_Obj=Chr+Chr
_Obj=Obj+Obj
_Obj=Obj+Reg
_Obj=Obj+Const
(ALL) (Example)
These Commands add the values of two variables together and give the resulting value to
a third variable.
Dest = Var1 + Var2
Commands only exist for unique expressions; expressions for two variables in reverse
order of any of the commands above are not included because they will return the same
result.
In the case of two Players, Var 1 is read from the Player "Fetched" to "Reference 0", and Var 2 is
read from the Player "Fetched" to "Reference 1"
In the case of two Objects, Var 1 is read from the Object "Fetched" to "Reference 0", and Var 2 is
read from the Object "Fetched" to "Reference 1"
In the case that only one Player is used for input, and/or only one Object is used for input, the Player
"Fetched" to "Reference 0" is used, and the Object "Fetched" to "Reference 0" is used.
The Destination variable is always considered to be from the Object or Player "Fetched" to "Reference 2"
Parameters:
- Var ID 1
- Var ID 2
- Dest Var ID
The value of the variable given by "Var ID 1" is added to the value of the variable given by "Var ID 2",
and the result is stored in the variable given by "Dest Var ID".
In the case of "Registers", "Var ID" is the ID of the "Register" that should be read/written. The "U" tag may be used
to specify a user-defined Register. Otherwise, the ID will refer to a Game Register
In the case of Player Variables, "Var ID" is the ID of the Player Variable that should be read/written. The capital "A"
tag may be used to specify an "Active" variable, the lower-case "a" to specify a user-
defined "Active" variable, and the lower-case "c" to specify a user-defined Constant.
Otherwise, the ID will refer to one of the Player's required Constants
In the case of Object Variables, "Var ID" is the ID of the Object Variable that should be read/written. The "E" tag may
be used to specify an "Extra" variable. Otherwise, the ID will refer to one of the
Object's standard variables
In the case of a Constant Value, "Var ID" is the actual value to be used in the calculation, rather than any variable ID.
Addition - Overwrite original values:
_Reg+=Reg
_Reg+=Chr
_Reg+=Obj
_Reg+=Const
_Chr+=Reg
_Chr+=Chr
_Chr+=Obj
_Chr+=Const
_Obj+=Reg
_Obj+=Chr
_Obj+=Obj
_Obj+=Const
(ALL) (Example)
These Commands add the value of the given Source variable to the value of the given Destination variable,
and place the result into the given Destination variable, overwriting its previous content.
Dest += Src
The Source variable is always considered to be from the Object or Player "Fetched" to "Reference 0"
The Destination variable is always considered to be from the Object or Player "Fetched" to "Reference 2"
Parameters:
- Src Var ID
- Dest Var ID
The value of the variable given by "Src" is added to the value of the variable given by "Dest",
and the result is placed into "Dest"
In the case of "Registers", "Var ID" is the ID of the "Register" that should be read/written. The "U" tag may be used
to specify a user-defined Register. Otherwise, the ID will refer to a Game Register
In the case of Player Variables, "Var ID" is the ID of the Player Variable that should be read/written. The capital "A"
tag may be used to specify an "Active" variable, the lower-case "a" to specify a user-
defined "Active" variable, and the lower-case "c" to specify a user-defined Constant.
Otherwise, the ID will refer to one of the Player's required Constants
In the case of Object Variables, "Var ID" is the ID of the Object Variable that should be read/written. The "E" tag may
be used to specify an "Extra" variable. Otherwise, the ID will refer to one of the
Object's standard variables
In the case of a Constant Value, "Var ID" is the actual value to be used in the calculation, rather than any variable ID.
Examples:
#_Reg++ ;Increase the value stored in "User Register" 8 by 1
: U8 ;(Dest) "User Register" 8
; ----------
#_Chr++ ;Increase the value stored in User-created "Active Variable" 5 of the Player "Fetched" to "Reference 2" by 1
: a5 ;(Dest) User-created "Active Variable" 5 of the Player "Fetched" to "Reference 2"
; ----------
#_Obj++ ;Increase the value stored in "Extra Variable" 0 of the Object "Fetched" to "Reference 2" by 1
: E0 ;(Dest) "Extra Variable" 0 of the Object "Fetched" to "Reference 2"
Addition - Preserve original values:
#_Reg=Chr0+Const ;Add 3 to the value of User-created "Active Variable" 18 of the Player "Fetched" to "Reference 0", and place the result in "User Register" 7
: a18 ;(Chr0) User-created "Active Variable" of the Player "Fetched" to "Reference 0"
: 3 ;(Const) 3
: U7 ;(Dest) "User Register" 7
; ----------
#_Chr2=Chr0+Chr1 ;Add the value of User-created "Active Variable" 13 of the Player "Fetched" to "Reference 1" to the value of User-created "Active Variable" 12 of the Player "Fetched" to "Reference 0", and place the result in User-created "Active Variable" 2 of the Player "Fetched" to "Reference 2"
: a12 ;(Chr0) User-created "Active Variable" 12 of the Player "Fetched" to "Reference 0"
: a13 ;(Chr1) User-created "Active Variable" 13 of the Player "Fetched" to "Reference 1"
: a2 ;(Dest) User-created "Active Variable" 2 of the Player "Fetched" to "Reference 2"
; ----------
#_Obj2=Obj0+Reg ;Add the value of "User Register" 24 to the value of "Extra Variable" 4 of the Object "Fetched" to "Reference 0", and place the result in "Extra Variable" 8 of the Object "Fetched" to "Reference 2"
: E4 ;(Obj0) "Extra Variable" 4 of the Object "Fetched" to "Reference 0"
: U24 ;(Reg) "User Register" 24
: E8 ;(Dest) "Extra Variable" 8 of the Object "Fetched" to "Reference 2"
Addition - Overwrite original values:
#_Reg+=Obj0 ;Add the value of "Extra Variable" 4 of the Object "Fetched" to "Reference 0" to the value of "User Register" 3, and place the result back into "User Register" 3
: E1 ;(Obj0) "Extra Variable" 4 of the Object "Fetched" to "Reference 0"
: U3 ;(Dest) "User Register" 3
; ----------
#_Chr2+=Chr0 ;Add the value of User-created "Active Variable" 9 of the Player "Fetched" to "Reference 0" to the value of User-created "Active Variable" 6 of the Player "Fetched" to "Reference 2" , and place the result back into User-created "Active Variable" 6 of the Player "Fetched" to "Reference 2"
: a9 ;(Chr0) User-created "Active Variable" 9 of the Player "Fetched" to "Reference 0"
: a6 ;(Dest) User-created "Active Variable" 6 of the Player "Fetched" to "Reference 2"
; ----------
#_Obj2+=Const ;Add 12 to the value of "Extra Variable" 8 of the Object "Fetched" to "Reference 2", and place the result back into "Extra Variable" 8 of the Object "Fetched" to "Reference 2"
: 12 ;(Const) 12
: E8 ;(Dest) "Extra Variable" 8 of the Object "Fetched" to "Reference 2"