Specify a button to loop?
3 posts
• Page 1 of 1
Specify a button to loop?
This topic is more or less just to confirm whether or not this is possible. I've got a few games where it's useful to press a single button in a loop. I thought it'd be useful to set an int to whatever button was pressed next, then loop that. The idea for the script was to press dpad down, then press whichever button I would want to loop, but have made little progress (most I've got so far was the script ending after pressing dpad down, but a regular loop script for one button is fine lol). The code below is essentially all that I know to work so far, so any help is appreciated, even if this isn't possible
- Code: Select all
int toggle;
int button;
main {
button = -1;
if(event_press(14))
{
//Logic to specify button to loop
toggle = !toggle;
}
if(toggle)
combo_run(Loop);
}
combo Loop {
set_val(button, 100);
wait(50);
set_val(button, 0);
wait(50);
}
-
Citrine - Private First Class
- Posts: 2
- Joined: Sat Oct 31, 2020 10:29 pm
Re: Specify a button to loop?
Welcome.
If we do a while loop and watch for event_press we can store it to the button variable.
Something like this:
If we do a while loop and watch for event_press we can store it to the button variable.
Something like this:
- Code: Select all
int i;
int toggle;
int button;
int time_to_loop;
main {
if(event_press(14)) {
toggle = !toggle;
if(!toggle) time_to_loop = 0;
}
else if(toggle) {
i = 0; // start button 0
if(!time_to_loop) {
while(i < 24) {
if(event_press(i)) {
button = i;
time_to_loop = 1;
break;
}
i++;
}
}
else {
combo_run(Loop);
}
}
}
combo Loop {
set_val(button, 100);
wait(50);
set_val(button, 0);
wait(50);
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
- Mad
- Major General
- Posts: 4536
- Joined: Wed May 22, 2019 5:39 am
Re: Specify a button to loop?
Mad wrote:snip
Works like a charm, thanks!
-
Citrine - Private First Class
- Posts: 2
- Joined: Sat Oct 31, 2020 10:29 pm
3 posts
• Page 1 of 1
Return to GPC1 Script Programming
Who is online
Users browsing this forum: No registered users and 111 guests