Combo Functions

Combo Functions and Commands

A combo (short for combination) is a combination of pre-programmed instructions which are executed in sequence. Just like the main section, commands within a combo are performed in the order they are written. You can run any code you can run in the main section within a combo such as calling functions or setting variables, although this is generally unnecessary and usually results in nothing more than a waste of stack memory and bytecode space.

A combo is ideal suited to setting the output of a button for a specific length of time which is done using the wait command, a command that is unique to combos and cannot be used elsewhere.

Just as with variables, a combos name can start with either an underscore ( _ ) or a letter and can be followed by any combination of letters, digits or underscores.

Function

Description

Zen

Plus

combo_run

Runs a combo

✔️

✔️

combo_running

Checks if a combo is running

✔️

✔️

combo_stop

Stops a running combo

✔️

✔️

combo_restart

Restarts a running combo

✔️

✔️

combo_suspend

Suspends (pauses) a combo

✔️

✔️

combo_suspended

Checks if a combo is in the suspended state

✔️

✔️

combo_current_step

keywords returning the current step

✔️

combo_step_time_left

the time left of the currently executed step

✔️

combo_stop_all

Stops all combos

✔️

combo_suspend_all

Suspends (pauses) all combos

✔️

combo_resume

Resumes the suspended combo or already running combo

✔️

combo_resume_all

Resumes all suspended combos

✔️

main {
if (event_press(XB1_A) {
combo_run(mycombo);
}
if (event_press(XB1_B) {
if(combo_running(mycombo)) {
combo_stop(mycombo);
}
}
if (event_press(XB1_X) {
combo_restart(mycombo);
}
}
combo mycombo {
set_val(XB1_A, 100);
wait(200);
wait(4000);
set_val(XB1_B, 100);
wait(200);
wait(4000);
set_val(XB1_X, 100);
wait(200);
wait(4000);
set_val(XB1_Y, 100);
wait(200);
wait(4000);
set_val(XB1_LB, 100);
wait(200);
wait(4000);
call(mycombo2);
}
combo mycombo2 {
}

combo_run

combo_run does precisely what the name suggests and runs a combo. However, unlike the combo_restart command, it has no effect if the combo is currently running. It will only start a combo is it is not already running.

combo_run(mycombo);

🔴Syntax

combo_run( <combo_name> );

Parameters

<combo_name> : The name assigned to a combo 🔵Returns

Nothing

combo_running

combo_running is a function which can be used in your code to check is a combo is running is not. If the combo named in its parameter is running, then it will return TRUE. If not, it will return FALSE.

combo_running(mycombo);

🔴Syntax

combo_running( <combo_name>);

Parameters

<combo_name> : The name assigned to a combo 🔵Returns

TRUE if the combo is currently running and FALSE if it is not.

combo_stop

combo_stop does precisely what the name suggests and will stop a combo if it is running. As with combo_run, it has no effect if the combo is currently not running.

combo_stop(mycombo);

🔴Syntax

combo_stop( <combo_name> );

Parameters

<combo_name> : The name assigned to a combo 🔵Returns

Nothing

combo_restart

combo_restart will restart a running combo. If the combo started within its parameters is currently running, it will be restarted from the beginning. If the combo is not currently running, it will be run.

combo_restart(mycombo);

🔴Syntax

combo_restart( <combo_name> );

Parameters

<combo_name> : The name assigned to a combo 🔵Returns

Nothing

combo_suspend

combo_suspend command suspends (pauses) a combo from running .

main {
if (event_press(XB1_A)) {
combo_run(mycombo);
}
if (event_press(XB1_B)) {
if(combo_running(mycombo)) {
combo_suspend(mycombo);
}
}
if (event_press(XB1_X)) {
combo_restart(mycombo);
}
}
combo mycombo {
set_val(XB1_A,100);
wait(2000);
set_val(XB1_A,0);
wait(100);
}

🔴Syntax

combo_suspend( <combo_name> );

Parameters

<combo_name> : The name assigned to a combo 🔵Returns

Nothing

combo_suspended

combo_suspended Check to see if a combo is suspended.

main {
if (event_press(XB1_A)) {
combo_run(mycombo);
}
if (event_press(XB1_B)) {
if(combo_running(mycombo)) {
combo_suspend(mycombo);
}
}
if (event_press(XB1_Y) && combo_suspended(mycombo)) {
combo_restart(mycombo);
}
}
combo mycombo {
set_val(XB1_A,100);
wait(2000);
set_val(XB1_A,0);
wait(100);
}

🔴Syntax

combo_suspended( <combo_name> );

Parameters

<combo_name> : Checks the name assigned to a combo if suspended 🔵Returns

Nothing

combo_current_step

combo_current_step keywords returning the current step

int combo_current_step = 100;
main {
if (event_press(XB1_A)) {
combo_run(mycombo);
}
if (event_press(XB1_B)) {
if(combo_current_step(mycombo)) {
combo_suspend(mycombo);
}
}
if (event_press(XB1_Y) && combo_current_step) {
combo_restart(mycombo);
}
}
combo mycombo {
set_val(XB1_A,100);
wait(2000);
set_val(XB1_A,0);
wait(100);
}

combo_step_time_left

combo_step_time_left Checks the time left of the currently executed step.

int combo_current_step = 100;
int combo_step_time_left = 150;
main {
if (event_press(XB1_A)) {
combo_run(mycombo);
}
if (event_press(XB1_B)) {
if(combo_current_step(mycombo)) {
combo_suspend(mycombo);
}
}
if (event_press(XB1_Y) && combo_current_step) {
if(combo_step_time_left == 150){
combo_restart(mycombo);
}
}
}
combo mycombo {
set_val(XB1_A,100);
wait(2000);
set_val(XB1_A,0);
wait(100);
}

combo_stop_all

combo_stop_all Stops all combos from running.

main {
if (event_press(XB1_A)) {
combo_run(mycombo);
}
if (event_press(XB1_B)) {
combo_stop_all(mycombo);
}
}
combo mycombo {
set_val(XB1_A,100);
wait(2000);
set_val(XB1_A,0);
wait(100);
}

combo_suspend_all

combo_suspend_all Suspends all combos that is running.

main {
if (event_press(XB1_A)) {
combo_run(mycombo);
}
if (event_press(XB1_B)) {
if(combo_running(mycombo)) {
combo_suspend_all(mycombo);
}
}
if (event_press(XB1_Y) && combo_suspended(mycombo)) {
combo_restart(mycombo);
}
}
combo mycombo {
set_val(XB1_A,100);
wait(2000);
set_val(XB1_A,0);
wait(100);
}

combo_resume

combo_resume Will resume a combo if it is suspended or a running combo.

main {
if (event_press(XB1_A)) {
combo_run(mycombo);
}
if (event_press(XB1_B)) {
if(combo_running(mycombo)) {
combo_suspend(mycombo);
}
}
if (event_press(XB1_Y) && combo_suspended(mycombo)) {
combo_resume(mycombo);
}
}
combo mycombo {
set_val(XB1_A,100);
wait(2000);
set_val(XB1_A,0);
wait(100);
}

combo_resume_all

combo_resume_all Will resume all combos if it is suspended or a running combos.

main {
if (event_press(XB1_A)) {
combo_run(mycombo);
}
if (event_press(XB1_B)) {
if(combo_running(mycombo)) {
combo_suspend(mycombo);
}
}
if (event_press(XB1_Y) && combo_suspended(mycombo)) {
combo_resume_all(mycombo);
}
}
combo mycombo {
set_val(XB1_A,100);
wait(2000);
set_val(XB1_A,0);
wait(100);
}

Combo Specific Commands

wait

wait command instructs the Virtual Machine within the Cronus on how long the last set of commands should be executed for. The length of time they instruct the VM to execute the commands for is represented in milliseconds and can rand from 1ms to 32 767ms (That's 1 millisecond to just over 32 seconds).

The commands executed during the wait time are those placed between the current wait and the previous wait time, the current wait time and previous call command or the start of the combo, whichever comes first. As shown in the example below:

combo mycombo {
set_val(19, 100);//¯¯|
set_val(18, 100);// | These two buttons will be held
wait(1000); //←_| for 1000 milliseconds (1 second)
set_val(3, 100);//¯¯|
set_val(7, 100);// | These two buttons will be held
wait(1500); //←_| for 1500 milliseconds (1.5 seconds)
set_val(9, -100);//¯¯| This axis will be held
wait(2000); //←_| for 2000 milliseconds (2 seconds)
}

The wait command can only be used within a combo and must be at the first level of the combo block, it cannot be nested.

wait(300); // wait 300ms

🔴Syntax

wait( <time> );

Parameters

<time> : The length of time the last commands should be executed for represented in milliseconds ranging from 10 to 4000.

🔵Returns

Nothing

call

call command can only be used in combos and pauses the current combo to execute the combo called. Once the combo has finished, the previous combo is resumed.

combo _1st_combo {
set_val(XB1_B, 100);
wait(100);
wait(200);
call(_2nd_combo); //_1st_combo is paused until _2nd_combo is finished
set_val(XB1_Y, 100);
wait(100);
wait(200);
}
combo _2nd_combo {
set_val(XB1_RB, 100);
wait(100);
wait(200);
} //Once this combo has ended, the combo is was called from can resume

🔴 Syntax

call( <combo_name );

Parameters

<combo_name> : The name assigned to a combo

🔵 Returns

Nothing