Engine02 Script Commands - If Conditionals (General)
"If Blocks" test for certain conditions, and cause the code within to be processed only if
that condition is true. They start with any available "If" Command to define the condition,
and must be ended with an "EndIf" command.
If the condition is true,
processing continues through the code within the "If Block", through the "EndIf", and beyond.
If the condition is not true, the code within the Block is skipped, and processing
resumes with the Command that immediately follows that Block's "EndIF".
Also available is the "Else" Command, which causes code to execute when the
condition is not true. An "IF"/"Else"/"EndIf" Block starts with the desired "IF" Command,
followed by code to execute if the condition is true, and then the "Else" Command, followed by the
code to execute if the condition is not true, and finally, the "EndIf" Command.
Index:
If Terminators:
| 63 | (D) (E) | Func_Else |
| 64 | (D) (E) | Func_EndIf |
Miscellaneous Conditions:
| 323 | (D) (E) | Func_If_KeyState |
| 325 | (D) (E) | Func_If_Object_Range |
Descriptions:
If Terminators:
63 - Func_Else
(ALL) (Example)
Signifies an "Else" Block to complement an "If" Block. If the "If" condition
wasn't satisfied, the Commands in the "Else" Block are processed
Parameters:
None
64 - Func_EndIf
(ALL) (Example)
Signifies the end of "If" and "Else" Blocks. All "If/Else" blocks must be
terminated with an "EndIf" Command. If an "If Block" contains an "Else", the "Else" marks the end
of the "If", and the "EndIf" marks the end of the "Else"
Parameters:
None
Miscellaneous Conditions:
323 - Func_If_KeyState
(ALL) (Example)
325 - Func_If_Object_Range
(OBJ) (Example)
"If" condition performed on an Object and the Screen/Activity boundaries.
The test is based on whether or not the Object's X/Y position is within the given area
The Object being tested must be "Fetched" to Reference 0
Parameters:
- Range
During a range test, the object is tested against Screen/Activity ranges for both
players 1 and 2 if in split-screen mode. Otherwise, only player 1's screen area is tested
0 - Test object against the on-screen area
1 - Test object against "Activity Range"
- In/Out
0 - Test if object is outside this range
1 - Test if object is inside this range
Examples:
If Terminators and Miscellaneous Conditions:
This section lists examples of complete sets of "If"/"Else"/"Endif" Commands, because they have no individual use
63 - Func_Else
(Description)
64 - Func_EndIf
(Description)
323 - Func_If_KeyState
(Description)
325 - Func_If_Object_Range
(Description)
# 323 ;If KeyState
: PT3 ;Current Player KeyMap, Tapped Key 3
: 1 ;On
;***
;Code here is processed only if key 3 in the KeyMap corresponding with "CurrPlayer" was tapped during this Game Frame
;***
# 64 ;EndIf
; ----------
# 323 ;If KeyState
:M0H1 ;KeyMap 0, Holding Key 1
: 0 ;Off
;***
;Code here is processed only if key 1 in KeyMap 0 is not being held
;***
# 64 ;EndIf
; ----------
# 325 ;If Object Range
: 1 ;(Range) "Activity Range"
: 1 ;(In/Out) Inside Range
;***
;Code here is processed only if the X/Y position of the Object "Fetched" to Reference 0 is inside "Activity Range"
;***
# 63 ;Else
;***
;Code here is processed only if the X/Y position of the Object "Fetched" to Reference 0 is not inside "Activity Range"
;***
# 64 ;EndIf
; ----------
# 325 ;If Object Range
: 0 ;(Range) Screen
: 0 ;(In/Out) Outside Range
;***
;Code here is processed only if the X/Y position of the Object "Fetched" to Reference 0 is outside of the visible screen area
;***
# 64 ;EndIf