Remapping

 
Remappings are defined at the beginning of a script and must be done before the main procedure.  They cannot be executed during run time. 
 
Although they are defined at the beginning of a script, the Virtual Machine does not execute the remaps until the main section has finished its current iteration.  This means that any scripting operations on the remapped entries for inputs should be programmed for the original buttons and without considering the remappings.
 
For example, if you used the remap command to swap the PS4_CIRCLE button with the PS4_TRIANGLE button and wished for the CIRCLE button on the controller to start a combo, you would still use the CIRCLE button in your code, like so;
 
remap PS4_CIRCLE -> PS4_TRIANGLE;
remap PS4_TRIANGLE -> PS4_CIRCLE;
 
main {
    if(get_val(PS4_CIRCLE)) {   //Input commands are not affected by remaps.
        combo_run(My_Combo);    //So to run this combo, you would physically press the CIRCLE button.
    }
}
 
combo My_Combo{
    set_val(PS4_L3, 100);
    wait(200);
    set_val(PS4_L3, 0);
    wait(190);
}
 
However, as remaps are evaluated after the main procedure is finished, any output commands should consider the remappings.  So if you wished for the CIRCLE button to turbo the TRIANGLE button (which it is remapped to) when pressed.  You would ignore the remaps for the get_val command but would consider them when creating the output, like so;
 
remap PS4_CIRCLE -> PS4_TRIANGLE;
remap PS4_TRIANGLE -> PS4_CIRCLE;
 
main {
    if(get_val(PS4_CIRCLE)) {   //Input commands are not affected by remaps.
        combo_run(My_Combo);    //So to run this combo, you would physically press the CIRCLE button.
    }
}
 
combo My_Combo{
    set_val(PS4_CIRCLE, 100);   //When this combo is run, it will turbo the CIRCLE button
    wait(40);                   //However, when the main section has finished its current iteration,
    set_val(PS4_CIRCLE, 0);     //the Virtual Machine will evaluate the REMAPS and will reassign these
    wait(30);                   //commands to the TRIANGLE button.
}
 
Remaps assign the value of the input to the selected output.  So you can have one input controlling several outputs.  This also means that unless something else is remapped to the input, it will still also output its original function.
 
For example, if you were to do this;
 
remap PS4_CROSS -> PS4_SQUARE;
remap PS4_CROSS -> PS4_TRIANGLE;
 
main {
 
}
 
The CROSS button would output as CROSS, SQUARE and TRIANGLE simultaneously.  The SQUARE and TRIANGLE buttons would not output anything.
 
 
Commands and Syntax
 
There are two remapping commands;
 

remap

 
Assigns the value of the input identifier to the output identifier
 

Syntax

 
remap <input identifier> -> <output identifier>;
 
Remaps are based on the output identifier so any subsequent remaps to the same output identifier will override the previous remap.
 
Due how remap alter the output report to the console, they do not consume any additional CPU runtime.
 

unmap

 
Disconnects an input from the output report.  This means that although the Virtual Machine can still see the value of the button/axis on the input report, it will not pass its value onto the console in the output report.  You can therefore still use an unmapped button to run code or start combos in your GPC script without worrying about its original function being sent to the console.  For example;
 
unmap PS4_TRIANGLE;
 
main {
    if(get_val(PS4_TRIANGLE)){
        combo_run(MyCombo);
    }
}
 

Syntax

 
unmap <output identifier>;
 
You can also use the constant ALL_REMAPS to unmap all remappings in a single operation, like so;
 
unmap ALL_REMAPS;