Engine02 Script Commands - Math Operations (Flags)
Any variable can be used as a "Bitfield" instead of a full value. Each Bit in this "Bitfield"
is refered to as a "Flag".
Each variable used as a "Bitfield" contains 32 "Flags" that can
be turned "on" or "off" (the value of 1 or 0).
"Flags" are a nice way to save variable space
when there are several values that can be expressed simply as "On"/"Off", "True"/"False", etc
Flag IDs for each variable are always numbered 0 - 31.
Index:
Setting Flags:
| 362 | (D) (E) | Func_Set_Reg_Flag |
| 364 | (D) (E) | Func_Set_Chr_Flag |
| 366 | (D) (E) | Func_Set_Obj_Flag |
| 1415 | (D) (E) | Func_Set_Flag_ByReg |
| 1416 | (D) (E) | Func_UnSet_Flag_ByReg |
| 1417 | (D) (E) | Func_Set_Chr_Flag_ByReg |
Unsetting Flags:
| 363 | (D) (E) | Func_UnSet_Reg_Flag |
| 365 | (D) (E) | Func_UnSet_Chr_Flag |
| 367 | (D) (E) | Func_UnSet_Obj_Flag |
| 1418 | (D) (E) | Func_UnSet_Chr_Flag_ByReg |
| 1419 | (D) (E) | Func_Set_Obj_Flag_ByReg |
| 1420 | (D) (E) | Func_UnSet_Obj_Flag_ByReg |
Flipping Flags:
| 368 | (D) (E) | Func_Flip_Reg_Flag |
| 369 | (D) (E) | Func_Flip_Chr_Flag |
| 370 | (D) (E) | Func_Flip_Obj_Flag |
| 1421 | (D) (E) | Func_Flip_Flag_ByReg |
| 1422 | (D) (E) | Func_Flip_Chr_Flag_ByReg |
| 1423 | (D) (E) | Func_Flip_Obj_Flag_ByReg |
Descriptions:
Setting Flags:
362 - Func_Set_Reg_Flag
364 - Func_Set_Chr_Flag
366 - Func_Set_Obj_Flag
1415 - Func_Set_Flag_ByReg
1416 - Func_UnSet_Flag_ByReg
1417 - Func_Set_Chr_Flag_ByReg
(ALL) (Example)
These Commands are used to "Set" (turn on) a "Flag" within the given variable.
The "_ByReg" versions allow the use of a Register to dynamically specify Flag ID, as opposed to providing a fixed ID.
Parameters:
- Var ID
In the case of "Registers", "Var ID" is the ID of the "Register" that contains the desired Flag. 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" that contains the desired Flag. 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" that contains the desired Flag. The "E" tag may
be used to specify an "Extra" variable. Otherwise, the ID will refer to one of the
Object's standard variables
- Flag ID
In the case of the standard versions, this is the ID number of the Flag to manipulate
In the case of the "_ByReg" versions, this is the ID number of a Register that contains the ID number of the Flag to manipulate. The "U" tag may be used
to specify a user-defined Register. Otherwise, the ID will refer to a Game Register
Unsetting Flags:
363 - Func_UnSet_Reg_Flag
365 - Func_UnSet_Chr_Flag
367 - Func_UnSet_Obj_Flag
1418 - Func_UnSet_Chr_Flag_ByReg
1419 - Func_Set_Obj_Flag_ByReg
1420 - Func_UnSet_Obj_Flag_ByReg
(ALL) (Example)
These Commands are used to "Unset" (turn off) a "Flag""Flag" within the given variable.
The "_ByReg" versions allow the use of a Register to dynamically specify Flag ID, as opposed to providing a fixed ID.
Parameters:
- Var ID
In the case of "Registers", "Var ID" is the ID of the "Register" that contains the desired Flag. 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" that contains the desired Flag. 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" that contains the desired Flag. The "E" tag may
be used to specify an "Extra" variable. Otherwise, the ID will refer to one of the
Object's standard variables
- Flag ID
In the case of the standard versions, this is the ID number of the Flag to manipulate
In the case of the "_ByReg" versions, this is the ID number of a Register that contains the ID number of the Flag to manipulate. The "U" tag may be used
to specify a user-defined Register. Otherwise, the ID will refer to a Game Register
Flipping Flags:
368 - Func_Flip_Reg_Flag
369 - Func_Flip_Chr_Flag
370 - Func_Flip_Obj_Flag
1421 - Func_Flip_Flag_ByReg
1422 - Func_Flip_Chr_Flag_ByReg
1423 - Func_Flip_Obj_Flag_ByReg
(ALL) (Example)
These Commands are used to "Flip" a "Flag" within the given variable.
A "Set" (1) value will become "Unset" (0), and an "Unset" (0) value will become "Set" (1).
The "_ByReg" versions allow the use of a Register to dynamically specify Flag ID, as opposed to providing a fixed ID.
Parameters:
- Var ID
In the case of "Registers", "Var ID" is the ID of the "Register" that contains the desired Flag. 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" that contains the desired Flag. 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" that contains the desired Flag. The "E" tag may
be used to specify an "Extra" variable. Otherwise, the ID will refer to one of the
Object's standard variables
- Flag ID
In the case of the standard versions, this is the ID number of the Flag to manipulate
In the case of the "_ByReg" versions, this is the ID number of a Register that contains the ID number of the Flag to manipulate. The "U" tag may be used
to specify a user-defined Register. Otherwise, the ID will refer to a Game Register
Examples:
# 362 ;Set Reg Flag (Turn On Flag/Bit 6 in "User Register" 24)
: U24 ;(Reg) "User Register" 24
: 6 ;(Flag) Flag/Bit 6
; ----------
# 364 ;Set Chr2 Flag (Turn On Flag/Bit 0 in User-created "Active Variable" 5 of the Player "Fetched" to "Reference 2")
: a5 ;(Chr2) User-created "Active Variable" 5 of the Player "Fetched" to "Reference 2"
: 0 ;(Flag) Flag/Bit 0
; ----------
#1417 ;Set Obj2 Flag ByReg (In "Extra Variable" 2 of the Object "Fetched" to "Reference 2", Turn On the Flag/Bit whose ID is stored in "User Register" 8)
: E2 ;(Obj2) "Extra Variable" 2 of the Object "Fetched" to "Reference 2"
: U8 ;(Flag) Flag whose ID is stored in "User Register" 8
Unsetting Flags:
# 363 ;UnSet Reg Flag (Turn Off Flag/Bit 17 in "User Register" 11)
: U11 ;(Reg) "User Register" 11
: 17 ;(Flag) Flag/Bit 17
; ----------
#1419 ;UnSet Chr2 Flag ByReg (In User-created "Active Variable" 9 of the Player "Fetched" to "Reference 2", Turn Off the Flag/Bit whose ID is stored in "User Register" 3)
: a9 ;(Chr2) User-created "Active Variable" 9 of the Player "Fetched" to "Reference 2"
: U3 ;(Flag) Flag whose ID is stored in "User Register" 3
; ----------
# 367 ;UnSet Obj2 Flag (Turn Off Flag/Bit 30 in "Extra Variable" 1 of the Object "Fetched" to "Reference 2")
: E1 ;(Obj2) "Extra Variable" 1 of the Object "Fetched" to "Reference 2"
: 30 ;(Flag) Flag/Bit 30
Flipping Flags:
#1421 ;Flip Reg Flag ByReg (In "User Register" 14, Reverse the Flag/Bit whose ID is stored in "User Register" 6)
: U14 ;(Reg) "User Register" 14
: U6 ;(Flag) Flag whose ID is stored in "User Register" 6
; ----------
# 369 ;Flip Chr2 Flag (Reverse Flag/Bit 31 in User-created "Active Variable" 7 of the Player "Fetched" to "Reference 2")
: a7 ;(Chr2) User-created "Active Variable" 7 of the Player "Fetched" to "Reference 2"
: 31 ;(Flag) Flag/Bit 31
; ----------
# 370 ;Flip Obj2 Flag (Reverse Flag/Bit 24 in "Extra Variable" 8 of the Object "Fetched" to "Reference 2")
: E8 ;(Obj2) "Extra Variable" 8 of the Object "Fetched" to "Reference 2"
: 24 ;(Flag) Flag/Bit 24