[LIB] Hotkeys with double click / multiple functions

The place to discuss scripting and game modifications for X³: Reunion.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
User avatar
Gazz
Posts: 12430
Joined: Fri, 13. Jan 06, 17:39
x3tc

[LIB] Hotkeys with double click / multiple functions

Post by Gazz » Fri, 5. Sep 08, 16:58

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
003   
004   if $Nr.of.clicks == null
005   return null
006
007   else if $Nr.of.clicks == 1
008    $Target =  get player tracking aim
009    $Target -> destruct: show no explosion=null
010    
011   else if $Nr.of.clicks == 2
012    [PLAYERSHIP] -> destruct: show no explosion=null
013    
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. =)
Last edited by Gazz on Tue, 11. Dec 12, 18:30, edited 2 times in total.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

madpainter
Posts: 25
Joined: Sat, 6. Dec 08, 05:13
x3tc

Post by madpainter » Sun, 4. Jan 09, 21:23

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.

User avatar
MBD
Posts: 338
Joined: Mon, 27. Mar 06, 17:03
x3tc

Post by MBD » Mon, 5. Jan 09, 03:48

It goes in the script folder in the games' directory. The Script Editor also needs to be activated.
"We always were English and we always will be English and it's because we are English that we're sticking up for our rights to be Burgundians." - Passport to Pimlico 1949

User avatar
s9ilent
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Tue, 13. Jan 09, 13:57

Hey Gazz :)

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

Post Reply

Return to “X³: Reunion - Scripts and Modding”