Can't get xkeys or key_event headers to work.
3 posts
• Page 1 of 1
Can't get xkeys or key_event headers to work.
Hi all,
I'm new here and still getting familiar with GPC2 and GTuner software. I've successfully written a few simple scripts for xbox one, but I am stuck on this one. I am trying to write a script that simply strafes left and right as long as I am pressing and holding down KEY_J.
My setup is:
Titan Two (Older version)
Input A: Xim Nexus dongle
Input B: IKKEGOL 3-pedal footswitch >>(Mappings: 1. (KEY G), 2. (KEY J), 3. (KEY H))
I would like to use the functions included in either the xkeys.gph or key_events.gph headers. More specifically, I just want to be able to use key_event_active and ket_event_release functions to run and stop the combo.
The combo works in the original version, but it runs 4 or 5 left and right strafe cycles (as I wrote it) by just tapping KEY_J and completes.
I just want it to run as long as I have my foot on the KEY_J pedal and stop when I let off.
I followed the instructions on using the above listed header files, made sure to save them in the same directory as the script I'm writing, etc., but I still the error " Can't open 'xkeys.gph' OR 'key_events.gph' .
The path is E: > lastname > Documents > gtuner_scripts_headers
All scripts and downloaded (from online library) headers are in this folder
So my question is, how can I achieve this without using either of those headers and just using the keyboard.gph header
OR, what might I be doing wrong when saving these downloaded headers?
Here is the combo:
Here is the code using the <key_events> header:
I'm new here and still getting familiar with GPC2 and GTuner software. I've successfully written a few simple scripts for xbox one, but I am stuck on this one. I am trying to write a script that simply strafes left and right as long as I am pressing and holding down KEY_J.
My setup is:
Titan Two (Older version)
Input A: Xim Nexus dongle
Input B: IKKEGOL 3-pedal footswitch >>(Mappings: 1. (KEY G), 2. (KEY J), 3. (KEY H))
I would like to use the functions included in either the xkeys.gph or key_events.gph headers. More specifically, I just want to be able to use key_event_active and ket_event_release functions to run and stop the combo.
The combo works in the original version, but it runs 4 or 5 left and right strafe cycles (as I wrote it) by just tapping KEY_J and completes.
I just want it to run as long as I have my foot on the KEY_J pedal and stop when I let off.
I followed the instructions on using the above listed header files, made sure to save them in the same directory as the script I'm writing, etc., but I still the error " Can't open 'xkeys.gph' OR 'key_events.gph' .
The path is E: > lastname > Documents > gtuner_scripts_headers
All scripts and downloaded (from online library) headers are in this folder
So my question is, how can I achieve this without using either of those headers and just using the keyboard.gph header
OR, what might I be doing wrong when saving these downloaded headers?
Here is the combo:
- Code: Select all
combo BAGSTRAFE {
set_val(STICK_2_X, 100);
wait(150);
set_val(STICK_2_X, -100);
wait(300);
set_val(STICK_2_X, 100);
wait(300);
set_val(STICK_2_X, -100);
wait(300);
set_val(STICK_2_X, 100);
wait(300);
set_val(STICK_2_X, -100);
wait(300);
set_val(STICK_2_X, 100);
wait(300);
set_val(STICK_2_X, -100);
wait(300);
set_val(STICK_2_X, 100);
wait(300);
set_val(STICK_2_X, -100);
wait(300);
set_val(STICK_2_X, 100);
wait(300);
set_val(STICK_2_X, -100);
wait(300);
set_val(STICK_2_X, 100);
wait(150);
}
Here is the code using the <key_events> header:
- Code: Select all
#include <keyboard.gph>
#include <xb1.gph>
#include <key_events.gph>
#define XB1_RX STICK_1_X
#define XB1_RY STICK_1_Y
#define XB1_LX STICK_2_X
#define XB1_LY STICK_2_Y
main{
if (key_event_active(KEY_J)){
combo_run (BAGSTRAFE);
}
if (key_event_release(KEY_J)){
combo_stop (BAGSTRAFE);
}
}
-
AJ2K1024 - Private First Class
- Posts: 2
- Joined: Thu May 12, 2022 5:56 pm
Re: Can't get xkeys or key_event headers to work.
AJ2K1024 wrote:I just want it to run as long as I have my foot on the KEY_J pedal and stop when I let off.
Those headers are are for single key presses so it'll only run once.
- Code: Select all
#include <keyboard.gph>
init { keymapping_reset(); }
main {
if(is_release(STICK_2_X) * is_release(STICK_2_Y)) {
if(key_status(KEY_J)) combo_run(BAGSTRAFE);
else combo_stop(BAGSTRAFE);
}
}
combo BAGSTRAFE {
set_val(STICK_2_X, 100);
wait(150);
set_val(STICK_2_X, -100);
wait(300);
}
ConsoleTuner Support Team || ConsoleTuner Discord || InputSense Discord (2K / FPS)
- Mad
- Major General
- Posts: 4533
- Joined: Wed May 22, 2019 5:39 am
Re: Can't get xkeys or key_event headers to work.
Mad wrote:AJ2K1024 wrote:I just want it to run as long as I have my foot on the KEY_J pedal and stop when I let off.
Those headers are are for single key presses so it'll only run once.
- Code: Select all
#include <keyboard.gph>
init { keymapping_reset(); }
main {
if(is_release(STICK_2_X) * is_release(STICK_2_Y)) {
if(key_status(KEY_J)) combo_run(BAGSTRAFE);
else combo_stop(BAGSTRAFE);
}
}
combo BAGSTRAFE {
set_val(STICK_2_X, 100);
wait(150);
set_val(STICK_2_X, -100);
wait(300);
}
Thank you Mad. That worked!!!
-
AJ2K1024 - Private First Class
- Posts: 2
- Joined: Thu May 12, 2022 5:56 pm
3 posts
• Page 1 of 1
Return to GPC2 Script Programming
Who is online
Users browsing this forum: No registered users and 118 guests