[BETA] T.E.S. - Target Empty Ships

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

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

User avatar
Toastysoul
Posts: 81
Joined: Fri, 3. Feb 06, 05:00
x4

[BETA] T.E.S. - Target Empty Ships

Post by Toastysoul »

I wrote this in response to a script by ITFUncleDave. UncleDave wrote a script to target unclaimed wares & ships. Unfortunately due to what I consider a abnormal behavior of the script engine, Dave's script would often target astronauts when trying to target an empty ship. You can specifically add a flag in his script to reject astronauts & spacesuits, and the script engine still targets it. The script itself was a great idea, but often not very useful. I took a different approach script wise, on his idea, and wrote a script that invariably targets the nearest empty ship and never anything else. I have some ideas to extend & balance this a bit, but I want to make sure that this works (for others), and the community has a desire to get more out of it before I invest more time to add features.

In summary, this script will target the nearest empty ship to the player ship, in the player's current sector using a definable hotkey. FYI: Hotkey name is "Target Empty Ships MK2".

This script is still in BETA. During the development process I have locked-up my game countless times. I am confident that I have ironed these bugs out, but use this at your own risk.



[ external image ]
Current Revision: 0.8

This script requires Cycrow's plug-in manager to install.
Last edited by Toastysoul on Fri, 26. Jun 09, 04:34, edited 1 time in total.
User avatar
Toastysoul
Posts: 81
Joined: Fri, 3. Feb 06, 05:00
x4

Post by Toastysoul »

***Reserved***
Ejjarufaf
Posts: 4
Joined: Tue, 16. Sep 08, 22:58
x3tc

Post by Ejjarufaf »

Amazing script, this makes my pirating sooo much easier!
fragma
Posts: 28
Joined: Sat, 5. Sep 09, 08:15
x3tc

Post by fragma »

Thanks a lot for this. It works perfectly, no more need to shoot down those astronauts who always like to come between me and my loot :D .

However, I'm getting like 7+ "Target Empty Ships MK2" hotkey entries in my hotkey configuration menu. I'm sure there was just 1 entry when I first installed. Have you encountered this problem? Is there anything I could do to fix this weird behavior?
User avatar
Nividium
Posts: 800
Joined: Tue, 21. Aug 07, 01:31

Post by Nividium »

Sounds like the setup script has some mal-formed code in it. The Global Variable used to control the creation of the hotkey is not being used properly. So, every time you start the game a new instance of the hotkey is being created and will continue to do so over and over (you will eventually have hundreds of duplicate hotkey configuration locations). Unless the code is revised to stop this. For refer sake, a typical sample of hotkey creation code is shown below:

Code: Select all

001   $hotkey.status = get global variable: name='target.empty.ship.script.registered'
002   if not $hotkey.status
003    $hotkey.status =  register hotkey 'Target Empty Ship' to call script 'My.target.empty.ship.script'
004    set global variable: name='target.empty.ship.script.registered' value=$hotkey.status
005   end
fragma
Posts: 28
Joined: Sat, 5. Sep 09, 08:15
x3tc

Post by fragma »

Yeah, I looked around and found that the setup script didn't check for an existing hotkey before creating a new one. So everytime I load a game it creates a new one.

I read up on hotkey scripts at http://cycrow.thexuniverse.us/scripts/h ... index.html and added a "if not" check in the setup script and now I don't get more hotkeys being created.

But...I've tried several variations of the example unregister hotkey script on that page but I can never get rid of the 18 old hotkeys already flooding my config menu...any idea how I might do that? I got as far as unregistering the currently created hotkey (before I simply fixed the script to check before creating anymore) but all the others just sit there no matter how many times I run the unregister script.
User avatar
Toastysoul
Posts: 81
Joined: Fri, 3. Feb 06, 05:00
x4

Post by Toastysoul »

*I know this is an old topic, but I wanted to reply anyway.

Sorry about all the extra hotkeys. Shortly after I was working on this, I went on a long vacation and when I came back, forgot about X3 altogether. :oops:

I picked up X3TC recently, so hopefully I'll be spending some more time here. I appreciate the thanks I received, and sorry again about the hotkey thing. :oops:

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