Tap twice to activate button, hold to activate second button
3 posts
• Page 1 of 1
Tap twice to activate button, hold to activate second button
Hello,
Could someone make an usb hid script so when tapped spacebar twice within timelimit 250ms will activate keyboard button (x) and when holding left shift for 250ms or tapping left shift twice within 250ms will activate keyboard button (m)
Could someone make an usb hid script so when tapped spacebar twice within timelimit 250ms will activate keyboard button (x) and when holding left shift for 250ms or tapping left shift twice within 250ms will activate keyboard button (m)
-
Pietu - Corporal
- Posts: 5
- Joined: Thu Oct 08, 2020 6:11 am
Re: Tap twice to activate button, hold to activate second bu
- Code: Select all
#include <keyboard.gph>
init {
const uint8 map[] = {
KEY_LEFTSHIFT, BUTTON_1,
KEY_SPACEBAR, BUTTON_2,
};
mouse_passthru();
keymapping(map);
mousemapping();
}
main{
mouse_passthru();
key_passthru();
if(event_active(BUTTON_1) && time_release(BUTTON_1) < 250) {
key_set(KEY_M, 1);
}
else if(check_active(BUTTON_1, 250)) {
key_set(KEY_M, 1);
}
if(event_active(BUTTON_2) && time_release(BUTTON_2) < 250) {
key_set(KEY_X, 1);
}
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord
- Mad
- Major General
- Posts: 4536
- Joined: Wed May 22, 2019 5:39 am
Re: Tap twice to activate button, hold to activate second bu
Works perfectly, thanks Mad.
-
Pietu - Corporal
- Posts: 5
- Joined: Thu Oct 08, 2020 6:11 am
3 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 58 guests