Forums » Community Projects

ClickCommander Plugin

May 29, 2017 meridian link
Introducing the ClickCommander plugin, which allows you to bind multiple commands to a single key. It differentiates between a long press, single-click, double-click, etc.

Download: ClickCommander v1.0

Example usage:
/cc add mybutton
/bind key +mybutton
/alias mybutton_hold FlyModeToggle
/alias mybutton_tap1 RadarNextNearestEnemy
/alias mybutton_tap2 RadarNextFront
/cc refresh

This will make it so the key bound above toggles the fly mode on a long press, targets the nearest enemy on a single press, or targets the object in front on a double-press. It actually supports triple clicks and above, so you could even create an alias for mybutton_tap17 if you wanted (but why would you want to???).

Obviously "mybutton" can be whatever you want, and you can setup multiple commands, just choose names that don't conflict with any existing commands. If you set up a lot of them, keep the names short. The names get saved to config.ini as a spickled list that has a max length of 256 characters.

For additional in-game help do: /cc help

Could someone confirm for me whether this works in conjunction with DroidButtons? If DB supports +commands like +Shoot2, then there's no reason it shouldn't work.

To the lua experts out there:
1) Does anyone know of a way to check whether an alias exists in lua? Currently the plug-in simply attempts to execute the alias whether it is defined or not. And if it isn't defined then a "no such command" text is printed to the chatbox.

2) Does anyone know of a way to read back the string associated with a given alias in lua? I'd like to make an iup dialog that makes the setup easy, which would include writing the aliases. Parsing wgaf.cfg isn't viable because it only gets updated when the client exits.
May 30, 2017 draugath link
Executing "/alias" triggers CHAT_MSG_PRINT events for the relevant aliases. These are subsequently passed to the chatreceiver. You could hook the chatreceiver:OnEvent() to capture and not display the aliases when querying them.

The main thing to consider with commands like +Shoot2 is that if they aren't bound to a key or touch_region, then you'll need to manually turn them off.
May 30, 2017 meridian link
I posted an update using draugath's suggestion for using the /alias command. Thanks for that. I always try to use "/alias name" in-game (which doesn't work), and I tend to forget that you can do just /alias.

Note that you now have to run the following command whenever you modify your aliases (or reloading the interface works too): /cc refresh

The one problem I'm having right now is that the /alias command prints the text to both the chatbox and the console. I can suppress the chatbox text through the use of the hooked chatreceiver function, but I haven't come up with a good way to suppress the console text. It's fairly annoying too since [my aliases at least] are long enough to fill the console buffer.

The plug-in is usable in its current state provided you don't mind the console spam. I'm going to continue pondering a fix before releasing it for prime time.
Jun 02, 2017 CatLady_ link
Awesome idea! Please, put it into VOPR. It is much easier to track updates via unites plugin repository.
Jun 02, 2017 meridian link
I'm holding off posting to VOUPR right now because the plugin is not up to my standards yet. I don't like uploading plugins that haven't been thoroughly tested since there is no way to remove it later if found to be unstable or buggy.

The latest update is a little better in regard to the console spam. Instead of checking the list of aliases right away at PLAYER_ENTERED_GAME, it now checks one time only at the first use of /cc refresh or the first time a button is pressed. So at least now the loaded plugin info in the console doesn't get overwritten immediately on interface reload.

There is now a /cc delay command to change the delay times in-game. Setting the value too low will make it not work very well.

Added support now for aliases ending in _tap (without a number specified). This could be useful if you only want to distinguish between a long press and fast presses (i.e. don't care about triple presses or above). The response time is slightly better too.

Also extended the list command so that if a binding is specified then all the aliases associated with it are listed, e.g. /cc list mybutton

This version will probably end up becoming the initial release, but I'm going to give it a bit more testing in the meantime. Download link in first post updated.
Jun 12, 2017 Hailey's Comet link
omg I need this! Testing now....
Jun 15, 2017 Xeha link
Thanks for this aswell.
Jun 25, 2017 meridian link
I fixed some case-insensitivity issues and did some minor clean-up. Version 1.0 is now official and available above. It will likely be a while before it gets another update.