Combos
Combo (short for combination) is a term that designates a set of actions programmed to be automatically performed in sequence. The wait command must be used at the end of each set of actions, it will inform to GPC for how long the actions must be execute. A combo routine has a name and must be defined after the main procedure. A GPC script can have several combos, being the stack memory and the bytecode size, the limit of how many combos can be defined.
A combo is defined using syntax such as the following:
combo foo {
set_val(PS3_CROSS, 50);
wait(100);
set_val(PS3_START, 100);
wait(250);
}
|
The wait command sets for how long the last set of actions (commands) must be execute; it's expressed in milliseconds and can range from 10 to 4000.
wait( <time> ) : Keeps executing the last set of actions until the timeout set by the given number of milliseconds
The command wait is only allowed directly into a combo routine block, for example, you can not use wait into the main block, or as a statement of a if.
main {
wait(500); // Incorrect
}
combo foo {
if(get_val(WII_B)) {
wait(100); // Incorrect
}
wait(250); // Correct
}
|
Combo Calls:
A combo to be invoked from another by using the command call.
call( <combo name> ) : Run and wait the execution of the combo indicated by the parameter
Recursive calls are not allowed and, as the wait, the command call is only allowed directly inside a combo routine block.
combo foo {
call(foo2);
set_val(PS4_CROSS, 50);
wait(100);
}
combo foo2 {
set_val(PS4_START, 100);
wait(250);
}
|
The main difference between using call and the command combo_run is how each one returns. The first waits for the combo execution, while the other not.
Related GPC Functions:
The GPC language provides a set of functions to operate with combos, so you can start, restart and stop the execution of a combo, as well as test if a combo is running or not.
1. combo_run
Starts the execution of a combo. Has no effect if the combo is already running.
Prototype:
combo_run ( <combo name> )
Parameters:
<combo name> : name of a defined combo
Return:
None
Example:
combo_run( foo );
|
2. combo_stop
Stops the execution of a combo.
Prototype:
combo_stop ( <combo name> )
Parameters:
<combo name> : name of a defined combo
Return:
None
Example:
combo_stop( foo );
|
3. combo_running
Returns TRUE if the combo is running.
Prototype:
int combo_running ( <combo name> )
Parameters:
<combo name> : name of a defined combo
Return:
TRUE if the combo is running, FALSE otherwise
Example:
if( !combo_running( foo ) ) {
combo_run( foo );
}
|
4. combo_restart
Restarts the execution of a combo.
Prototype:
combo_restart ( <combo name> )
Parameters:
<combo name> : name of a defined combo
Return:
None
Example:
combo_restart( foo );
|