Typematic repeats

Questions and conversations about programming.

Typematic repeats

Postby Cardinal_Ximinez on Fri Oct 29, 2010 11:17 am

Knowing that HKN doesn't really send typematic keys, I was wondering if this script would cause any problems? I wasn't sure if your scripts would allow recursion and if it would cause any stack problems in the long run. Just trying to figure out a way to do movement keys in Lotro in a typematic way.

Code: Select all
<Hotkey w>
   <Toggle>
      <DoHotKey HotKey Junja>
   <Toggle>
      <Cancel>

<Hotkey Junja>
   <SendLabel w1, w2, w3>
   <Key w>
   <wait 1>
   <DoHotKey Hotkey Junja>
Cardinal_Ximinez
 
Posts: 84
Joined: Fri Jan 22, 2010 6:28 pm

Re: Typematic repeats

Postby HotkeyNet on Fri Oct 29, 2010 12:17 pm

Cardinal_Ximinez wrote:Knowing that HKN doesn't really send typematic keys, I was wondering if this script would cause any problems? I wasn't sure if your scripts would allow recursion and if it would cause any stack problems in the long run.

This won't cause stack or recursion problems. You can run this kind of hotkey indefinitely.

Just trying to figure out a way to do movement keys in Lotro in a typematic way.

I would be surprised if Lotro handles movement with typematic repeats because there's a delay before they begin and they have a variable rate. There are better ways for game developers to handle movement keys.

If you want to try anyway, here's how you can emulate typematic repeats with HotkeyNet. Unlike real typematic, this emulation doesn't have an initial delay, although you can add it if you want.

In your example, you have a single trigger hotkey that toggles typematic on and off. But real typematic is a hold-down action, not a toggle. This is the exact same issue that we just discussed in the Ventrilo thread and the solution is the same. To perform a hold-down action (whether it's push to talk or typematic repeats) you need two separate trigger hotkeys, one for the finger press and one for the finger release.

Code: Select all
<Label x 192.168.1.103 SendFocusWin>

<Hotkey W> // TRIGGERED BY FINGER PRESS
   <DoHotkey Hotkey Junja>

<HotkeyUp W> // TRIGGERED BY FINGER RELEASE
   <SendLabel x>
      <KeyUp W>
   <SendPC Local>
      <Cancel>

<Hotkey Junja>
   <SendLabel x>
      <KeyDown W> // TYPEMATIC EVENTS ARE PURELY PRESSES WITHOUT RELEASES
   <SendPC Local>
      <Wait 67> // APPROXIMATE DEFAULT TYPEMATIC INTERVAL
      <DoHotkey Hotkey Junja>
-- Freddie
HotkeyNet
Site Admin
 
Posts: 5684
Joined: Fri Mar 28, 2008 8:36 pm

Re: Typematic repeats

Postby Cardinal_Ximinez on Wed Nov 03, 2010 11:40 am

Thanks Freddie, Ill give it a try this weekend!
Cardinal_Ximinez
 
Posts: 84
Joined: Fri Jan 22, 2010 6:28 pm

Re: Typematic repeats

Postby HotkeyNet on Wed Nov 03, 2010 12:20 pm

You're welcome, good luck!
-- Freddie
HotkeyNet
Site Admin
 
Posts: 5684
Joined: Fri Mar 28, 2008 8:36 pm

Re: Typematic repeats

Postby BloodCloud on Tue Nov 16, 2010 6:01 am

hi,

I tried this in the past, but it didn't work.
It completely froze up HKN and it ONLY did the loop (yes I did have a wait in there).

I am waiting for the multi threaded version of HKN before I try again.

for the rest HKN is still my tool of choice, with AWESOME possibilities even though that solutions sometimes look very complex :)
User avatar
BloodCloud
 
Posts: 78
Joined: Tue Mar 17, 2009 12:52 pm
Location: Netherlands

Re: Typematic repeats

Postby HotkeyNet on Tue Nov 16, 2010 9:52 am

BloodCloud wrote:I tried this in the past, but it didn't work.

The sample that I posted above works fine.

While it's running, HotkeyNet can't do anything else because by design, Hotkeynet executes only one hotkey at a time.

That doesn't mean the sample doesn't work. It means that by design, HotkeyNet can't do anything else while it's running.

It completely froze up HKN

It doesn't freeze up HotkeyNet. You need a <Cancel> hotkey to stop the loop. The loop continues indefinitely until you stop it with <Cancel>. As soon as you press the <Cancel> hotkey, the loop stops. That's why I provided a <Cancel> hotkey with the sample above.
-- Freddie
HotkeyNet
Site Admin
 
Posts: 5684
Joined: Fri Mar 28, 2008 8:36 pm

Re: Typematic repeats

Postby BloodCloud on Tue Nov 16, 2010 10:50 am

HotkeyNet wrote:
While it's running, HotkeyNet can't do anything else because by design, Hotkeynet executes only one hotkey at a time.

That doesn't mean the sample doesn't work. It means that by design, HotkeyNet can't do anything else while it's running.


Sorry for my bad choice of wording. You explained exactly what happened when I tried it. I was also not meant in a typematic approach :)

I don't have the exact code anymore, what I did was along the lines of:

Code: Select all
<Hotkey 1>
   <sendlabel x>
      <Toggle>
         <SetVar START 1>
         <dohotkey hotkey 2>
      <Toggle>
         <SetVar START 0>

<Hotkey 2>
   <If START Is 1>
      <sendlabel x>
         <key 2>
         <wait 1000>
         <dohotkey hotkey 2>


Basically had a loop which pressed 2 every second, and tried to influence (start/stop) by pressing 1.
Which didn't work and just completely froze up HKN

HotkeyNet wrote:It doesn't freeze up HotkeyNet. You need a <Cancel> hotkey to stop the loop. The loop continues indefinitely until you stop it with <Cancel>. As soon as you press the <Cancel> hotkey, the loop stops. That's why I provided a <Cancel> hotkey with the sample above.
User avatar
BloodCloud
 
Posts: 78
Joined: Tue Mar 17, 2009 12:52 pm
Location: Netherlands

Re: Typematic repeats

Postby HotkeyNet on Tue Nov 16, 2010 12:02 pm

Basically had a loop which pressed 2 every second, and tried to influence (start/stop) by pressing 1.

You have to send <Cancel> to stop it.

Which didn't work and just completely froze up HKN

HotkeyNet isn't frozen during a loop. As soon as you trigger a hotkey with <Cancel>, the loop stops.
-- Freddie
HotkeyNet
Site Admin
 
Posts: 5684
Joined: Fri Mar 28, 2008 8:36 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 2 guests

cron