Log in

View Full Version : [HotKeyNet] Requested Feature



Vreejack
11-20-2012, 10:43 AM
I just discovered that HKN can fill a role for even single-client use that lotro has so far not bothered to provide: flavor emotes.

When I play WoW I like to add a little text script to certain actions for flavor, but if the action is used a lot you need a random function to reduce the frequency of the emote. This would be a nice feature for HKN so that I can do it in other games as well.

MiRai
11-20-2012, 11:07 AM
While I'm not saying you are wrong to put in a request for HKN features, I will say that it's likely to go unfilled. HKN has (had) its own forum (http://hotkeynet.com/) for things such as this, but Freddie has stopped supporting HKN and therefore, most likely, won't be adding anything new.

However, I don't use HKN and what you're actually asking might be able to be accomplished w/o the need for a new feature. There are a few HKN gurus that wander these forums so, you might just have to be patient and see if they reply.

Bettysue
11-20-2012, 12:25 PM
I just discovered that HKN can fill a role for even single-client use that lotro has so far not bothered to provide: flavor emotes.

When I play WoW I like to add a little text script to certain actions for flavor, but if the action is used a lot you need a random function to reduce the frequency of the emote. This would be a nice feature for HKN so that I can do it in other games as well.
You can make a hotkey with a key combo you would never press by accident, within that hotkey, place several toggles, and one of them has your emote code. Then on the hotkey to want to physically press, call the toggle key with dorandomtoggle.
<hotkey 4>
//do stuff
<dorandomtoggle hotkey lshift rshift q>
<hotkey lshift rshift q>
<toggle>
<toggle>
<toggle>
//emote stuff
You can use more or less blank toggles to adjust frequency. It will be random working several times in a row, and then not for a while type of thing, if you want a fixed rate, use dohotkey instead of dorandomtoggle.

Khatovar
11-21-2012, 10:42 AM
As Bettysue says, what you want can already be done with DoRandomToggle (http://www.dual-boxing.com/threads/47966-Priority-and-Random-Casting-in-HotKeyNet) and the Text (http://hotkeynet.com/ref/text.html) command.


<Hotkey 2>
<Toggle>
<SendLabel w1>
<Key 2>
<Toggle>
<SendLabel w1>
<Key 2>
<Toggle>
<SendLabel w1>
<Key 2>
<Toggle>
<SendLabel w1>
<Key 2>
<Toggle>
<SendLabel w1>
<Key 2>
<Toggle>
<SendLabel w1>
<DoRandomToggle Hotkey Oemax 1>


<UseKeyAsModifier OemAX>

<Hotkey Oemax 1>
<Toggle>
<SendLabel w1>
<Text /em doom>
<Key 2>
<Toggle>
<SendLabel w1>
<Text Duck and Cover!>
<Key 2>
<Toggle>
<SendLabel w1>
<Text /em dance>
<Key 2>
<Toggle>
<SendLabel w1>
<Text Mad dog! Kill it, Kill it!>
<Key 2>



Starting at the top of the code, we create a hotkey for 2. You'll see I have repeated 2 several times as a toggle. You can do it without toggles in the main key, but you will get too many calls for a random emote and you'll end up spamming them. Using the toggle like this means that the random will only go off once in every 6 presses. You can add more toggle steps here to further reduce the frequency of emote calls.

The second toggle calls DoRandomToggle, which as you see below that will call a random emote + key 2. If you wanted, you could also add "blanks" here by tacking in toggles for Key 2 or increase the frequency of certain emotes in relations to others by duplicating their toggle.

Vreejack
11-21-2012, 03:24 PM
well for crying out loud that was exactly what i was looking for, thanks

Is there a system variable for current window so i can just feed keystrokes through if i am not focused on the game ?
For example if i switch over to the editor i always forget to turn off HKN.

otoh, if hkn is not suppotyed any more perhaps i should switch.

Khatovar
11-21-2012, 03:29 PM
You can use If ActiveWinIs. I put it directly in my keylist


<Hotkey CapsLockOff MyList; CapsLockoff Shift MyList; CapsLockOff Alt MyList; CapsLockOff Ctrl MyList; CapsLockOff Ctrl Alt MyList; CapsLockOff Shift Ctrl MyList; CapsLockOff Shift Alt MyList>
<If ActiveWinIs WoW>
<SendLabel w1, w2, w3, w4, w5>
<Key %Trigger%>
<Else>
<SendPC Local>
<TurnHotkeysOff>
<SendFocusWin>
<Key %Trigger%>

This way if I am in my WoW1 window it broadcasts as normal. If I am in any other window {IM client, browser, other wow windows, notepad, etc.} it toggles off HotKeyNet broadcasting {just like pause} and then sends the key.

Edit - I don't see a reason to switch. Just because Freddie isn't actively developing HKN doesn't mean the program is going to just up and die. He hasn't had to add anything to HKN in a few years and the only thing that has changed is he no longer has support forums. You'll get plenty of assistance here and he has no plans so far (http://www.dual-boxing.com/threads/47336-HotKeyNet-Forum-Closed) to stop allowing HotKeyNet to be used.

Freddie
11-21-2012, 04:41 PM
I've stopped providing user support (answering questions) but I still support HotkeyNet in terms of bug fixes. If anybody finds a new serious bug, I'll fix it. People can still PM me on the HotkeyNet forum, and I still read email sent to the address for reporting HotkeyNet bugs. But nobody has reported a new bug in years. The program is seven years old and back in its day, it had thousands of users. After a while, with an old program like this that had lots of users, practically all the bugs get found,

Luckily, Khat and BettySue and others still give excellent user support for HotkeyNet. User support doesn't have to come from the programmer.

Vreejack
11-22-2012, 10:25 AM
All good news, thank you.

I am still having a serious problem, however, in getting windows to focus properly. Is there a trick to this? For example, this simple hotkey:


<hotkey a>
<SendLabel w1>
<Key a>
<SendLabel w2>
<Key F2>
<Wait 50>
<Key a>
<restore>


What almost always happens is that w2 never gets focus and instead the taskbar flashes a tab for w2 needing attention. Then all the keys which were supposed to go to w2 go to w1 instead. I tried inserting a delay after the first sendlabel but that did not help. The error I am actually getting is "1400 invalid window handle" Though previously I would often see the same problem with an error of "0 Completed successfully"

Khatovar
11-22-2012, 10:57 AM
What sendmode (http://hotkeynet.com/ref/send_modes.html) settings are you using? What script are you using? It sounds to me like you are trying to use SendWinM or something like that, it needs to be simply SendWin.

Vreejack
11-22-2012, 01:24 PM
No, it's SendWin. I have never used SendWinM. It usually works, but sometimes fails. Sometimes it fails many times in a row. Curiously, It tends to happen on the very first time I use a particular macro for a while after using other macros.
For example, I have a hotkey to tell the partner to follow the leader. If I have not used it for a while then it has a high chance of failing the first time, which is not a big deal as it always works the second time.

settings are:
background focus delays 50/50
modifier delays 50/50

Vreejack
11-22-2012, 01:38 PM
I figured out a contributing factor. If I use the modifier keys on my mouse instead of using the keyboard this happens almost every time. Unfortunately I must use the mouse keys.

It must have something to do with the way X-mouse button control works with HKN'

Or not, as the keyboard is doing it too, just less often. has to be a timing thing.

Something to do with X-mouse generating simulated LAlt and LCtrl signals is confusing HKN. Darn subtle.

Vreejack
11-22-2012, 04:11 PM
SOLUTION!

Everything works perfectly if I use SendWinX instead of SendWin.

:)

Bettysue
11-22-2012, 04:31 PM
It sounds a lot like some focusfollowsmouse is causing or could be used to fix. Odd I know but if you are using it and your mouse hits a non-hidden taskbar or random window, it can cause weird effects. If you don't use it clicking another window and a slow response time to the key can cause undesireable effects. In order to help further we would have to see your script. Just make sure you remove passwords and usernames from your script if you have them in there. Enclose the script in code tags to maintain formatting, and help out the forum mods so they don't have to do it for you.

Freddie
11-23-2012, 01:11 AM
What almost always happens is that w2 never gets focus and instead the taskbar flashes a tab for w2 needing attention. Then all the keys which were supposed to go to w2 go to w1 instead. I tried inserting a delay after the first sendlabel but that did not help.
Thanks for the excellent description of what you're seeing. Here's why this is happening. When HotkeyNet sends a keystroke with SendWin to a background window, the first thing it does is tell the operating system, "Please raise the target window to the foreground." Usually when a background program makes this request (HotkeyNet is in the background), Windows refuses to do it as a matter of design to prevent background programs from taking control of your screen and annoying you. So what the operating system usually does in this situation is blink the task bar icon (as you describe) to alert you so you can decide yourself which program should be in the foreground.

Normally, when SendWin is working properly, HotkeyNet plays a sort of trick on the operating system to force it to carry out the request. In this case, based on what you describe, the trick isn't working. Delays can't help because the problem isn't caused by time. It's caused by the operating system making a decision to refuse the request.


SOLUTION!

Everything works perfectly if I use SendWinX instead of SendWin.
Glad to hear it.