[SCRIPT] Hotkey Manager : V1.11 : 2010/01/03

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24949
Joined: Sun, 2. Apr 06, 16:38
x4

Post by X2-Illuminatus » Wed, 28. May 14, 00:11

At a guess, the script you're calling runs on [THIS]. That way when the script is called via the command console of a ship, the script will run (locally) on this specific ship. However, if you call the script via a hotkey the script will run globally ([THIS] == null), which means that the script won't have any reference to work with.

If what I described above is the case, an easy solution would be to ask the player for an input value (the ship in question) when the script is called using the <RetVar/IF><RefObj> get user input: type=<Script Reference Type>, title=<Var/String> command (can be found in the Other Commands) and to replace all instances of [THIS] with the return variable of said command.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22197
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Wed, 28. May 14, 10:32

Also, if the script has arguments on it, then it wont work directly as a hotkey.

When a script has arguments and is run from the command, it'll display an input for each of those arguments, but if run from a hotkey, those arguments will be NULL.

Also, as X2, says, most command scripts will assume its being run on an object, and hotkey scripts are run globablly.

So to fix this, and for Darth-Wayners question, you can create an intermediate script that you attach the hotkey too, and this script will then call the script you want on the correct object and with the correct arguments.

If you want the command to run on your current ship, simply use [PLAYERSHIP] as the object.

any arguments you may need, you can get using the get user input command for each one, and pass them to the script you are running.

Darth_Wayner, if you are still around, all commands have a !ship.cmd script, so you just have to call the corerct one from the intermediate script.
You cant get the ship thats highlighted in the property menu to use with the hotkey, but you can get the current target, then just run the command script on the current target object. You will also need to get the destination station, use the get user input command to display the menu to select it

Spihc
Posts: 2
Joined: Thu, 12. Sep 13, 18:03
x3ap

Post by Spihc » Wed, 28. May 14, 20:20

Volltreffer X2-Illuminatus!

The script doesn't have arguments but starts with a check that returns null if [THIS] is not of class Ship, so I guess I was actually running it but exiting at the second line...

Thanks for the tip Cycrow, I did as you suggested and that gives me even more flexibility that I'd hoped! I've added a check so that the script runs on my target if it's a ship, and on [PLAYERSHIP] otherwise. Works like a charm! (I'll have to make sure there's a check that prevents me from running it on ships that are not mine though :D )

Thanks to the both of you! :)

KRM398
Posts: 1556
Joined: Wed, 6. Nov 02, 20:31
xr

Re: [SCRIPT] Hotkey Manager : V1.11 : 2010/01/03

Post by KRM398 » Tue, 24. Aug 21, 17:50

download button is dead, so that means this mod is too..lol

Sylevar
Posts: 11
Joined: Sun, 3. Feb 13, 05:45
x3ap

Re: [SCRIPT] Hotkey Manager : V1.11 : 2010/01/03

Post by Sylevar » Wed, 9. Aug 23, 21:09

Sorry to necro post, but since this is still relevant to me and some other people according to, albeit 1 year old, posts, I decided to help out.

The link to the file is still active, but the download button isn't. So, using my knowledge of HTML I managed to track down the link and am sharing it below, just right click it and copy the link location:

http://xpluginmanager.co.uk/tcscripts/H ... 1.2010.spk

Have a good day everyone!

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24949
Joined: Sun, 2. Apr 06, 16:38
x4

Re: [SCRIPT] Hotkey Manager : V1.11 : 2010/01/03

Post by X2-Illuminatus » Wed, 9. Aug 23, 21:12

I fixed the download button in the opening post.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”