PDA

View Full Version : Hot-Key Attacks



Ken L
December 2nd, 2017, 09:06
This is something present in d20pro and I'm curious if it's possible through extensions here.

Currently the Chat window soaks up the key strokes. I haven't looked terribly deep here, but my goal here is if I press 'A' I can select the first attack of the selected token. completely bypassing the tracker. 'F' can then select the full attack variant, for all other attacks I can perform the standard highlight-attack.

Why is this useful? It's more for the GM, if I have an array of baddies, I can quickly run through the mooks by getting their default attack action out of the way without having to peek into the CT or open a stat block.

Key hurdles are:

1. Preventing the chat box from absorbing all normal keystrokes outside of designated text areas
2. Classifying attacks using the ruleset's attack parser.

Area 2 is interesting as attacks appear to be 'classified' on hover as the xml database only stores them as a string, so these are parsed on the fly it appears. I'm sure there's something more interesting happening but these are casual observations. I'm not entirely sure if this is possible to hook the 'A' hotkey to the first classifiable attack.


Regarding the 'selected token' alluded to, I earlier did a slight rework of the Combat Tracker and as part of that, I've gained a memory for 'selected tokens'. Combining these two, I wish to have the ability to perhaps select tokens on the map, press the A key, and either drop attack dice on a target token or control click for each attacker. All without consulting the Combat Tracker. A side goal here is to multi-select N tokens, and press A to select the default action to attack for all of them at once on a target of my choice. This is handy for mass readied attacks or mass opportunity attacks, or even quickly processing 5 enemies at once (perhaps multi-selecting through the combat tracker).

So I ask, before I start poking around here, is this possible?

Bidmaron
December 2nd, 2017, 13:14
I know very little about the CT, but this should be possible. If you have selected a token and not been back to the CT, the map window should be active, and I am not even sure how the CT can be sucking up keystones at that point (unless it is intercepting low-level key events). Without intercepting keystroke events, a window and controls within it will not get keystrokes, so something doesn't seem right about what you are saying.

damned
December 2nd, 2017, 13:34
The Chat Window is pretty much always grabbing your keystrokes unless you are in an editable field.

Bidmaron
December 2nd, 2017, 14:05
Good point, damned, but I don't see how the CT would do that too. That would guarantee contention. If both the chat and CT are open, who gets the keystrokes? I believe (again confessing I don't know much about CT) the CT is like other windows and only captures keystrokes when the cursor is in a field that takes keystrokes.

Now that you mention the chat box, I guess the challenge would be to determine if the map window is the front-most (danged I wish SW would expose the z-order of their windows so we can tell which window has the focus. Right now, I think there is no effective way to find out which window is at top of z-order). Then you could intercept keystrokes and do what Ken L wants.

Ken L
December 2nd, 2017, 15:02
Windows don't accept keystrokes on their own. You need to give focus to a particular control which will take priority from the chat window. I'll take a look at this later today, but I'm a bit more curious about classifying attacks.

Bidmaron
December 2nd, 2017, 15:30
Right, Ken, but if there was a way to know the map window were frontmost, you could just intercept key events, process any that were attack-related, and return the others for the system (chat window) to process. Unfortunately, I know of no way to tell whether the map window is frontmost.

LordEntrails
December 3rd, 2017, 01:16
Why not just look at overriding the Function keys? They already have the non-chat box behavior you want, and does it matter if you hit F for full attack of F1 for full attack? Heck, with the Function keys you can even put a description in the hot bar as to what the key does.

Ken L
December 3rd, 2017, 06:13
hmm, what's annoying is that even if you hide the chat pane, it still grabs the keystrokes. I have a tabbed chat window that still takes keystrokes even if I'm on another tab.

Ken L
December 11th, 2017, 02:44
After poking around a bit, this simply isn't possible due to how FG routes their input.