Headcannon Game Engine Script Commands - While
Index:
Do/While Loop Control:
(D) (E) | _Do |
(D) (E) | _BreakDo |
(D) (E) | _Forever |
(D) (E) | _While(Reg==Reg) |
(D) (E) | _While(Reg!=Reg) |
(D) (E) | _While(Reg>Reg) |
(D) (E) | _While(Reg<Reg) |
(D) (E) | _While(Reg>=Reg) |
(D) (E) | _While(Reg<=Reg) |
(D) (E) | _While(Reg==Chr) |
(D) (E) | _While(Reg!=Chr) |
(D) (E) | _While(Reg>Chr) |
(D) (E) | _While(Reg<Chr) |
(D) (E) | _While(Reg>=Chr) |
(D) (E) | _While(Reg<=Chr) |
(D) (E) | _While(Reg==Obj) |
(D) (E) | _While(Reg!=Obj) |
(D) (E) | _While(Reg>Obj) |
(D) (E) | _While(Reg<Obj) |
(D) (E) | _While(Reg>=Obj) |
(D) (E) | _While(Reg<=Obj) |
(D) (E) | _While(Reg==Const) |
(D) (E) | _While(Reg!=Const) |
(D) (E) | _While(Reg>Const) |
(D) (E) | _While(Reg<Const) |
(D) (E) | _While(Reg>=Const) |
(D) (E) | _While(Reg<=Const) |
(D) (E) | _While(Chr==Chr) |
(D) (E) | _While(Chr!=Chr) |
(D) (E) | _While(Chr>Chr) |
(D) (E) | _While(Chr<Chr) |
(D) (E) | _While(Chr>=Chr) |
(D) (E) | _While(Chr<=Chr) |
(D) (E) | _While(Chr==Obj) |
(D) (E) | _While(Chr!=Obj) |
(D) (E) | _While(Chr>Obj) |
(D) (E) | _While(Chr<Obj) |
(D) (E) | _While(Chr>=Obj) |
(D) (E) | _While(Chr<=Obj) |
(D) (E) | _While(Chr==Const) |
(D) (E) | _While(Chr!=Const) |
(D) (E) | _While(Chr>Const) |
(D) (E) | _While(Chr<Const) |
(D) (E) | _While(Chr>=Const) |
(D) (E) | _While(Chr<=Const) |
(D) (E) | _While(Obj==Obj) |
(D) (E) | _While(Obj!=Obj) |
(D) (E) | _While(Obj>Obj) |
(D) (E) | _While(Obj<Obj) |
(D) (E) | _While(Obj>=Obj) |
(D) (E) | _While(Obj<=Obj) |
(D) (E) | _While(Obj==Const) |
(D) (E) | _While(Obj!=Const) |
(D) (E) | _While(Obj>Const) |
(D) (E) | _While(Obj<Const) |
(D) (E) | _While(Obj>=Const) |
(D) (E) | _While(Obj<=Const) |
Descriptions:
Do Loop Control:
_Do
(ALL) (Example)
Begins a Do/While loop. The "Do" Command should be placed just before
any code that should loop while the corresponding"While" condition is true. Because the "Do"
command is only a marker, the following code will process at least once, and the
"While" at the foot of the looping code determines whether or not to process it again
Parameters:
None
_BreakDo
(ALL) (Example)
Forceably breaks out of a "Do" loop. This Command can be used to exit a "Do" loop
at any time, if necessary. It causes the Function to jump directly to the Command that immediately
follows the corresponding "While" Command
Parameters:
None
_Forever
(ALL) (Example)
"Forever" works in place of a "While" Command at the end of a "Do" loop. If a
"Forever" Command is encountered, the Function will immediately loop back to the
Command that immediately follows the corresponding "Do" Command. The loop will not
end unless a "BreakDo" is encountered.
Because "Forever" and "While" do not
cause a Function break, a "BreakFunction" Command must be inserted manually if
the Function should "break" to allow the rest of the game to process at any time
during the loop. Otherwise, the function will continue to process until the loop
is broken and the next Command that does cause a "break" is reached
Parameters:
None
_While(Reg==Reg)
_While(Reg!=Reg)
_While(Reg>Reg)
_While(Reg<Reg)
_While(Reg>=Reg)
_While(Reg<=Reg)
_While(Reg==Chr)
_While(Reg!=Chr)
_While(Reg>Chr)
_While(Reg<Chr)
_While(Reg>=Chr)
_While(Reg<=Chr)
_While(Reg==Obj)
_While(Reg!=Obj)
_While(Reg>Obj)
_While(Reg<Obj)
_While(Reg>=Obj)
_While(Reg<=Obj)
_While(Reg==Const)
_While(Reg!=Const)
_While(Reg>Const)
_While(Reg<Const)
_While(Reg>=Const)
_While(Reg<=Const)
_While(Chr==Chr)
_While(Chr!=Chr)
_While(Chr>Chr)
_While(Chr<Chr)
_While(Chr>=Chr)
_While(Chr<=Chr)
_While(Chr==Obj)
_While(Chr!=Obj)
_While(Chr>Obj)
_While(Chr<Obj)
_While(Chr>=Obj)
_While(Chr<=Obj)
_While(Chr==Const)
_While(Chr!=Const)
_While(Chr>Const)
_While(Chr<Const)
_While(Chr>=Const)
_While(Chr<=Const)
_While(Obj==Obj)
_While(Obj!=Obj)
_While(Obj>Obj)
_While(Obj<Obj)
_While(Obj>=Obj)
_While(Obj<=Obj)
_While(Obj==Const)
_While(Obj!=Const)
_While(Obj>Const)
_While(Obj<Const)
_While(Obj>=Const)
_While(Obj<=Const)
(ALL) (Example)
The "While" Command is placed at the end of a "Do"/"While" loop, and specifies
the condition under which the loop continues. Because the "Do" Command only serves
as a marker, the Commands within the loop will be processed at least once, however,
the "While" condition determines whether or not they are processed again. If the
condition expressed by the "While" Command is true, the Function jumps
back to the Command that immediately follows the corresponding "Do" Command, and the process
repeated until the condition becomes untrue, at which point the "While" allows the
Function to continue with the following Command. The loop will otherwise not
end unless a "BreakDo" is encountered
Because "Forever" and "While" do not
cause a Function break, a "FuncBreak" Command must be inserted manually if
the Function should "break" to allow the rest of the game to process at any time
during the loop. Otherwise, the function will continue to process until the loop
is broken and the next Command that does cause a "break" is reached
These "While" condition Commands test the relation between two variables for any one of the
following conditions:
(Equ) | Equal To |
(NEqu) | Not Equal To |
(Great) | Greater Than |
(Less) | Less Than Less |
(GreatE) | Greater Than or Equal To |
(LessE) | Less than or Equal To |
Commands only exist for unique comparisons. Comparisons for two variable types in reverse
order of any of the listed Commands do not exist because they would return the same
result
One of the "FetchPlayer" Commands and/or one of the "FetchObject" Commands must
be used to select the appropriate Player(s) and/or Object(s) before these Commands are used.
If two Player Variables or two Object Variables are used, the first will use Reference 0, and the second
will use Reference 1. If one Player Variable and/or one Object Variable are used, each will use their respective Reference 0
Parameters:
- Var ID 1
- Var ID 2
These are the two variable IDs required by the condition. Variable IDs should be listed in
the order in which their types are specified by the condition. For example, with a "While(Obj<=Const)"
condition, "Var ID 1" would be the ID of an Object Variable (for the Object "Fetched" to Reference 0), and "Var ID 2" would be the constant value
for use in the comparison. Another way to represent the comparison would be "Obj0 <= Const"
In the case of "Registers", "Var ID" is the ID of the "Register" to test. 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 to test. 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 to test. 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, the value itself should be entered as the "Var ID" Parameter, rather than any actual Variable ID
Examples:
Do/While Loop Control:
This section lists examples of complete sets of "Do"/"BreakDo"/"Forever"/"While" Commands, because they have no individual use
_Do
(Description)
_BreakDo
(Description)
_Forever
(Description)
_While(Reg==Reg)
_While(Reg!=Reg)
_While(Reg>Reg)
_While(Reg<Reg)
_While(Reg>=Reg)
_While(Reg<=Reg)
_While(Reg==Chr)
_While(Reg!=Chr)
_While(Reg>Chr)
_While(Reg<Chr)
_While(Reg>=Chr)
_While(Reg<=Chr)
_While(Reg==Obj)
_While(Reg!=Obj)
_While(Reg>Obj)
_While(Reg<Obj)
_While(Reg>=Obj)
_While(Reg<=Obj)
_While(Reg==Const)
_While(Reg!=Const)
_While(Reg>Const)
_While(Reg<Const)
_While(Reg>=Const)
_While(Reg<=Const)
_While(Chr==Chr)
_While(Chr!=Chr)
_While(Chr>Chr)
_While(Chr<Chr)
_While(Chr>=Chr)
_While(Chr<=Chr)
_While(Chr==Obj)
_While(Chr!=Obj)
_While(Chr>Obj)
_While(Chr<Obj)
_While(Chr>=Obj)
_While(Chr<=Obj)
_While(Chr==Const)
_While(Chr!=Const)
_While(Chr>Const)
_While(Chr<Const)
_While(Chr>=Const)
_While(Chr<=Const)
_While(Obj==Obj)
_While(Obj!=Obj)
_While(Obj>Obj)
_While(Obj<Obj)
_While(Obj>=Obj)
_While(Obj<=Obj)
_While(Obj==Const)
_While(Obj!=Const)
_While(Obj>Const)
_While(Obj<Const)
_While(Obj>=Const)
_While(Obj<=Const)
(Description)
#_Do
;***
;Code here is processed once every Game Frame, until the Function is somehow forceably stopped
;***
#_FuncBreak ;Suspend this Functon until the next Game Frame, so other parts of the game are allowed to run
#_Forever
;***
;Code here won't be processed
;***
; ----------
#_Reg=Const ;Initialize a counter for the Do/While loop to manage
: U0 ;(Dest) User Register 0
: 0 ;(Src) 0
#_Do
;***
;Code here is processed 5 times on the same Game Frame
;***
#_Reg++ ;Increase the counter
: U0 ;User Register 0
#_While(Reg<Const)
: U0 ;(Reg) User Register 0
: 5 ;(Const) 5
;***
;Code here begins processing when the Do/While loop ends (when the value of User Register 0 is 5)
;***
; ----------
#_FetchPlayer Fetch the Current Player to all three References
:_Ref_All
:r_Curr_Player
#_Chr=Const ;Reset the counter
: a3 ;(Dest) User-created "Active Variable" 3 of the Player "Fetched" to Reference 2
: 0 ;(Src) 0
#_Do
;***
;Code here is processed as many times as specified by User-created "Active Variable" 4
;of the "Current Player" (which was "Fetched" to all three References), up to a maximum
;of 5 times. This loop is run in its entirety on the same Game Frame
;***
#_Chr++ ;Increase the counter
: a3 ;User-created "Active Variable" 3 of the Player "Fetched" to Reference 2
#_If(Chr==Const) ;Test whether the counter has reached the value 5
: a3 ;(Chr0) User-created "Active Variable" 3 of the Player "Fetched" to Reference 0
: 5 ;(Const) 5
#_BreakDo ;Stop running the Do/While loop if it has
#_EndIf
#_While(Chr<Chr)
: a3 ;(Chr0) User-created "Active Variable" 3 of the Player "Fetched" to Reference 0
: a4 ;(Chr1) User-created "Active Variable" 4 of the Player "Fetched" to Reference 1
;***
;Code here begins processing when the Do/While loop ends (when the value of
;User-created "Active Variable" 3 of the Player "Fetched" to Reference 0 is equal to the
;value of User-created "Active Variable" 4 of the Player "Fetched" to Reference 1), or when
;the loop is broken (when the value of User-created "Active Variable" 3 of the Player
;"Fetched" to Reference 0 is equal to 5)
;***
; ----------
#_FetchObject_Current
:_Ref_All
#_Do
;***
;Code here is processed for as long as the value of "Extra Variable" 1 of the Object "Fetched"
;to Reference 0 is less than the value of User Register 0, but only once per Game Frame. Another
;Function is assumed to be manipulating the Object Variable
;***
#_FuncBreak ;Suspend this Functon until the next Game Frame, so other parts of the game are allowed to run
#_While(Reg>Obj)
: U0 ;(Reg) User Register 0
: E1 ;(Obj0) "Extra Variable" 1 of the Object "Fetched" to Reference 0
;***
;Code here begins processing when the Do/While loop ends (when the value of "Extra Variable" 1 of the Object "Fetched" to)
;Reference 0 is greater than or equal to the value of User Register 0)
;***