Page 1 of 1

[LIB] Hotkeys with double click / multiple functions

Posted: Fri, 5. Sep 08, 16:58
by Gazz
Download file contains versions for both Reunion and Terran Conflict.

Scripters have been doing a good job of conserving command slots (for obvious reasons =) but several scripts use a bucketload of hotkeys instead of grouping several functions, that thematically belong together, onto one hotkey.

Scripts can get a lot easier to use if you only need one hotkey for a group of features instead of several.
(Select weapon config 1, Save weapon config 1.... could be single and double click of the same key.)
That's a lot easier to remember and seldom used functions can be put on a double or triple click layer, freeing up keys on the already cramped keyboard.

I wrote this library for my [SCR] Target Lock Hotkey when it got messy to add one more function to my "hardcoded" hotkey script, that had 3 functions per hotkey at the time.

Now this library supports an infinite number of hotkeys, each with an infinite number of keypresses.
Why only double click when you can quad click?

Image Download (ZIP)

Now it is that easy to let one hotkey do 2 completely different things:

Code: Select all

001   $HK.Name = get script name
002 @ $Nr.of.clicks = $Null -> call script 'lib.gz.multi.hotkey' :  hotkey name=$HK.Name  keypress delay=400
004   if $Nr.of.clicks == null
005   return null
007   else if $Nr.of.clicks == 1
008    $Target =  get player tracking aim
009    $Target -> destruct: show no explosion=null
011   else if $Nr.of.clicks == 2
012    [PLAYERSHIP] -> destruct: show no explosion=null
014   end
015   return null
Line 001 is the easiest and most maintainance free way of generating a solid identifier for a hotkey script.
There are other ways but this one always works. =)

Posted: Sun, 4. Jan 09, 21:23
by madpainter
Hi I am hav'ing trouble using this Is there a specific place I should extract it to or is it simply just a tool for scripters. It seems really useful but I suspect I'm missing something in how to apply it.

Posted: Mon, 5. Jan 09, 03:48
by MBD
It goes in the script folder in the games' directory. The Script Editor also needs to be activated.

Posted: Tue, 13. Jan 09, 13:57
by s9ilent
Hey Gazz :)

Just wanted to say, this script is the awesomeness :P
I can now control many things with just a single button