Time based input for keyboards? Need help

GPC2 script programming for Titan Two. Code examples, questions, requests.

Time based input for keyboards? Need help

Postby pablosscripts » Tue Dec 11, 2018 10:57 pm

I'm using this to register key presses:

Code: Select all
    if(key_status(ASSIGNED_STIM_TOGGLE)) {
        if(stim_toggle_key_ready) {           
            // my code here
        }
    } else {
        stim_toggle_key_ready = 1;
    }



I would like to change this so it only registers for the first 40ms. This is how I've accomplished it for regular button presses:

Code: Select all
if(time_active(STIM) > 40


How do I apply the same thing to key presses? I take it I can't use the time_active() function for key presses?
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR

My R6 script: https://youtu.be/x-9NtxyySVM
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am

Re: Time based input for keyboards? Need help

Postby Sillyasskid » Wed Dec 12, 2018 12:41 am

You should take a look at Scachi's xkeys.gph he published it in the GPC library,
https://www.consoletuner.com/greslib/?w500

Once included you should be able to use the function xkeys_time_active().

pablosscripts wrote:I would like to change this so it only registers for the first 40ms. This is how I've accomplished it for regular button presses:
Code: Select all
if(time_active(STIM) > 40

hmmm.... Don't you mean
Code: Select all
if(time_active(STIM) < 40
?
User avatar
Sillyasskid
Captain
Captain
 
Posts: 574
Joined: Sat May 14, 2016 3:07 am

Re: Time based input for keyboards? Need help

Postby pablosscripts » Wed Dec 12, 2018 5:51 am

Sillyasskid wrote:hmmm.... Don't you mean
Code: Select all
if(time_active(STIM) < 40
?


Thanks and...yes you're right :)
Setup: XIM Apex, T2, K780 keyboard, G Pro Wireless mouse, SteelSeries 4HD pad, DXRacer armrest, LucidSound LS30 headset, Netduma router, Ubiquiti UniFi AP LR

My R6 script: https://youtu.be/x-9NtxyySVM
User avatar
pablosscripts
Brigadier General
Brigadier General
 
Posts: 1976
Joined: Tue Nov 24, 2015 6:27 am


Return to GPC2 Script Programming

Who is online

Users browsing this forum: No registered users and 68 guests