This section is about the basic macro usage only 1) to record your inputs as macros and use them in scripts. The maximum length of a single macro file is 24 days. 2)
While using a macro file directly in a script requires a sd-card you can still use this without one to record your input and convert it to a combo for playback.
You can playback one macro at a time only.
Converting a macro to a combo has some limitations.3) 4).
There are other reason to use a combo instead of a macro.5)
For simple short actions you may want to stick to using combos created manually or by converting a macro to a combo.
macro_run(“<filename>.gmk”);
Run the macro file named <filename> stored on the SD-Card.macro_rec(“<filename>.gmk”);
Record the controller outputs to the macro file named <filename> on the SD-Card.macro_time();
Get the time in milli-seconds the macro file is running or recording since initiated by macro_run
or macro_rec
.macro_stop();
Stop the execution or recording of the macro file initiated by macro_run
or macro_rec
.To record a macro via GTuner IV you need to have:
In GTuner IV switch to the “Device Monitor”. It will look like this, the areas of interest are marked green:
The steps to do are:
You need a sd-card to playback a macro. If you have no sd-card continue here
main { if(event_active(BUTTON_4)) { // replace Example.gmk with the name of yourfile.gmk // your filename must have 8 characters or less macro_run("Example1.gmk"); } }
Here is another script example to play a macro in endless loop when BUTTON_4 is pressed. Hit BUTTON_4 again to stop the playback loop:
bool bplay=FALSE; main { if(event_active(BUTTON_4)) { bplay=!bplay; // inverses the value FALSE<->TRUE } // replace Example.gmk with the name of yourfile.gmk // your filename must have 8 characters or less if (bplay) macro_run("Example1.gmk"); else macro_stop(); }
To get gpc combo code it needs some additional steps. But it is not that complicated or different.
Keep in mind that you can't convert a long macro completely to a combo because of the scripts size limitation.
The steps to do are:
set_val(GPC_Designator,0);
main { if (event_active(BUTTON_9)) combo_run(Macro2Combo); }
Macro File (*.gmk) BUTTON
when you only need the button actions