Compiling issues Gtuner
Posted: Thu Jan 05, 2023 9:22 pm
I have a titan one and wanted to make a script which allows for the following functions:
Recording a series of inputs, then replaying them in a loop until stopped.
I wanted it to trigger recording of the input loop with L1+R1, to then start/stop the loop with Cross + Circle, and then reset with Triangle + Square.
*edit, I also tried to get it to flash the LED red while recording the sequence, and green when looping it.
The idea was to be able to automated repeated tasks in many games.
Unfortunately the code keeps failing for various reasons.
The latest iteration of the code is as follows:
Errors:
GPC: GPC Compile ABORTED with 0 warning(s) and 19 error(s).
GPC: ----- GPC Compile: Automate inputs 3.gpc -----
GPC: Preprocessor started.
GPC: First-pass started.
GPC: Variables: Global: 7, Local: 0, Parameters: 1, Pointers: 0, Constants: 0, Labels: 0, Functions: 5, Combos: 0
GPC: Memory usage: Static: 16 bytes (1.56%), Dynamic: 4 bytes (0.39%)
GPC: Second-pass started.
GPC error: Automate inputs 3.gpc(29): Identifier not declared 'SetControllerLED'.
GPC error: Automate inputs 3.gpc(29): Illegal operation 'arg:1'.
GPC error: Automate inputs 3.gpc(29): Illegal operation 'arg:1'.
GPC error: Automate inputs 3.gpc(29): Illegal operation 'arg:1'.
GPC error: Automate inputs 3.gpc(29): Illegal function call, near ')'
GPC error: Automate inputs 3.gpc(34): Identifier not declared 'SetControllerLED'.
GPC error: Automate inputs 3.gpc(34): Illegal operation 'arg:1'.
GPC error: Automate inputs 3.gpc(34): Illegal operation 'arg:1'.
GPC error: Automate inputs 3.gpc(34): Illegal operation 'arg:1'.
GPC error: Automate inputs 3.gpc(34): Illegal function call, near ')'
GPC error: Automate inputs 3.gpc(54): Identifier not declared 'StartRecording'.
GPC error: Automate inputs 3.gpc(54): Illegal function call, near ')'
GPC error: Automate inputs 3.gpc(65): Identifier not declared 'StopRecording'.
GPC error: Automate inputs 3.gpc(65): Illegal function call, near ')'
GPC error: Automate inputs 3.gpc(73): Identifier not declared 'GetButtonState'.
GPC error: Automate inputs 3.gpc(73): Illegal operation 'arg:1'.
GPC error: Automate inputs 3.gpc(73): Illegal function call, near ')'
GPC error: Automate inputs 3.gpc(73): Incompatible return value 'ButtonPressed'.
GPC error: Automate inputs 3.gpc(77): syntax error, unexpected WHILE 'while'.
GPC: GPC Compile ABORTED with 0 warning(s) and 19 error(s).
Please can anyone offer any advice how I can fix this code?
Recording a series of inputs, then replaying them in a loop until stopped.
I wanted it to trigger recording of the input loop with L1+R1, to then start/stop the loop with Cross + Circle, and then reset with Triangle + Square.
*edit, I also tried to get it to flash the LED red while recording the sequence, and green when looping it.
The idea was to be able to automated repeated tasks in many games.
Unfortunately the code keeps failing for various reasons.
The latest iteration of the code is as follows:
- Code: Select all
define true = 1;
define false = 0;
// Initialize the variables with the button IDs
int trigger_input = 30;
int reset_input = 48;
int start_input = 7;
int stop_input = 8;
// Declare and initialize the flag to track the state of the loop
int loop_enabled = false;
// Declare and initialize the flag to track the state of the recording
int recording_enabled = false;
// Declare and initialize the counter to keep track of the current loop iteration
int loop_counter = 0;
// Create a function to handle the trigger input
function handle_trigger_input()
{
// Toggle the state of the loop
loop_enabled = !loop_enabled;
// If the loop is being enabled, reset the loop counter and set the LED to red
if (loop_enabled)
{
loop_counter = 0;
SetControllerLED(1, 0, 0);
}
// If the loop is being disabled, set the LED to green
else
{
SetControllerLED(0, 1, 0);
}
}
// Create a function to handle the reset input
function handle_reset_input()
{
// If the loop is enabled, reset the loop counter
if (loop_enabled)
{
loop_counter = 0;
}
}
// Create a function to handle the start input
function handle_start_input()
{
// If the loop is enabled and not currently recording, start recording the loop
if (loop_enabled && !recording_enabled)
{
StartRecording();
recording_enabled = true;
}
}
// Create a function to handle the stop input
function handle_stop_input()
{
// If the loop is enabled and currently recording, stop recording the loop
if (loop_enabled && recording_enabled)
{
StopRecording();
recording_enabled = false;
}
}
// Define the ButtonPressed function
int ButtonPressed(int button)
{
return GetButtonState(button);
}
// Set up an event loop to run the script
while (true)
{
// Check for the trigger input
if (ButtonPressed(trigger_input))
{
handle_trigger_input();
}
// Check for the reset input
if (ButtonPressed(reset_input))
{
handle_reset_input();
}
// Check for the start input
if (ButtonPressed(start_input))
{
handle_start_input();
}
// Check for the stop input
if (ButtonPressed(stop_input))
{
handle_stop_input();
}
// Sleep for a short time to avoid overloading the CPU
Sleep(10);
}
Errors:
GPC: GPC Compile ABORTED with 0 warning(s) and 19 error(s).
GPC: ----- GPC Compile: Automate inputs 3.gpc -----
GPC: Preprocessor started.
GPC: First-pass started.
GPC: Variables: Global: 7, Local: 0, Parameters: 1, Pointers: 0, Constants: 0, Labels: 0, Functions: 5, Combos: 0
GPC: Memory usage: Static: 16 bytes (1.56%), Dynamic: 4 bytes (0.39%)
GPC: Second-pass started.
GPC error: Automate inputs 3.gpc(29): Identifier not declared 'SetControllerLED'.
GPC error: Automate inputs 3.gpc(29): Illegal operation 'arg:1'.
GPC error: Automate inputs 3.gpc(29): Illegal operation 'arg:1'.
GPC error: Automate inputs 3.gpc(29): Illegal operation 'arg:1'.
GPC error: Automate inputs 3.gpc(29): Illegal function call, near ')'
GPC error: Automate inputs 3.gpc(34): Identifier not declared 'SetControllerLED'.
GPC error: Automate inputs 3.gpc(34): Illegal operation 'arg:1'.
GPC error: Automate inputs 3.gpc(34): Illegal operation 'arg:1'.
GPC error: Automate inputs 3.gpc(34): Illegal operation 'arg:1'.
GPC error: Automate inputs 3.gpc(34): Illegal function call, near ')'
GPC error: Automate inputs 3.gpc(54): Identifier not declared 'StartRecording'.
GPC error: Automate inputs 3.gpc(54): Illegal function call, near ')'
GPC error: Automate inputs 3.gpc(65): Identifier not declared 'StopRecording'.
GPC error: Automate inputs 3.gpc(65): Illegal function call, near ')'
GPC error: Automate inputs 3.gpc(73): Identifier not declared 'GetButtonState'.
GPC error: Automate inputs 3.gpc(73): Illegal operation 'arg:1'.
GPC error: Automate inputs 3.gpc(73): Illegal function call, near ')'
GPC error: Automate inputs 3.gpc(73): Incompatible return value 'ButtonPressed'.
GPC error: Automate inputs 3.gpc(77): syntax error, unexpected WHILE 'while'.
GPC: GPC Compile ABORTED with 0 warning(s) and 19 error(s).
Please can anyone offer any advice how I can fix this code?