With this, we could do all kinds of really neat stuff. I was kind of surprised that this functionality didn't already exist.
Basically so we can define hotkeys and trigger a function in a script. Would be 100 kinds of neato.
Allow bos to capture keypresses when a unit is selected
Moderator: Moderators
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: Allow bos to capture keypresses when a unit is selected
Gadgets create commands. Unit scripts animate upon those commands. Widgets can capture keypresses and can issue commands.
But, rather than capturing a keypress, the widget should make an ActionHandler action and the user can bind a key to it.
But, rather than capturing a keypress, the widget should make an ActionHandler action and the user can bind a key to it.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Allow bos to capture keypresses when a unit is selected
That's fair. Was just pipedreaming 

Re: Allow bos to capture keypresses when a unit is selected
Yeah, you're supposed to use the proper layer structure. I've got that toggle.lua gadget that I use for more or less direct hooks into BOS. One problem with a theoretical key-to-BOS hook is that key presses only go into the local unsynced, to communicate with the synced state you need a command or lua message so that information can be transmitted over the network to all participating players.
- CarRepairer
- Cursed Zero-K Developer
- Posts: 3359
- Joined: 07 Nov 2007, 21:48
Re: Allow bos to capture keypresses when a unit is selected
It's ok, we have a solution in the works. He wants to hook it to a special attack so there's no need for a gadget to create a command. He'll create the unit and weapon and I'll throw together a small widget that issues an attack-ground on keypress.
Re: Allow bos to capture keypresses when a unit is selected
Hell, there's already a fairly universal gadget in Kernel Panic IIRC, it's how the Bug's transformation and the Byte's mine launcher work.
Re: Allow bos to capture keypresses when a unit is selected
tbh this seems shaky on the sync vs desync ground to me at first