[Script/software] AP - Overtuning ships, the way of UFJD. Vanilla-friendly toolkit

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

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

kurush
Posts: 4320
Joined: Sun, 6. Nov 05, 23:53
x3tc

[Script/software] AP - Overtuning ships, the way of UFJD. Vanilla-friendly toolkit

Post by kurush » Tue, 6. Mar 12, 23:24

As some people here might already know, we now have engine and rudder tunings in UFJD sectors. It is apparently expected that we map UFJD sectors in 200 km radius and cover them with advanced satellites to get those lucky finds. In practice it is not that exciting :)

I realized that I need to automate the process after jumping to about 20 UFJD sectors manually in search for tuning crates.

Two scripts are included:
  1. A modified version of EJ's script that searches for containers. This version searches ONLY for tunings and also in the current sector ONLY. If it finds something, it opens a text input box to block any further input. You need to type "exit" in this input box or it will re-open. This is to block actions from the second script. It also jumps your ship far away from the sector center to avoid death by Xenons (death will close the input box). The script is named aaaaa.findwares.conditional and should appear as the first script in the list for script editor.
  2. A script for Authotkey (http://www.autohotkey.com/) . This scripts repeatedly jumps you to UFJD sector and back. Once in UFJD, it saves, activates the script editor, runs the first script and then reloads. If the first script is blocking the input, it won't be able to reload and the action will stop with a save available in UFJD sector with a tuning container.
What you will need:
  • Autohotkey installed
  • A lot of salvage insurance (1000+)
  • A lot of EC (1500 should be sufficient to get at least one hit even if you are very unlucky)
  • UFJD mapped to the right windows key (or some other key, but then autohotkey script will need to be changed)
  • A ship to overtune
  • Advanced Satellite
  • A moderately fast computer that can load a save game in less than 30-35 seconds.
Download URL: http://tiny.cc/tunings

Installation.
  1. Copy aaaaa.findwares.conditional.xml to addon/scripts subfolder of X3 installation
  2. Install and start autohotkey
  3. Right-click on autohotkey icon in the system tray and select "Edit this script". Notepad will open, replace what you see in it with the the contents of Autohotkey.ahk and save (you can also just copy this file into your windows Documents folder).
  4. Right-click on autohotkey in system tray and select "Reload this script"
  5. MAKE A BACKUP OF ALL YOUR SAVES
  6. Note that the script will repeatedly overwrite the 1-st save on the list.
  7. Start X3AP, activate the script editor, make sure aaaaa.findwares.conditional.xml is the first script on the list. If not, either rename it with more aaaaa or change the autohotkey script (look for the comments there).

Running
  1. Reload a game that is not modified.
  2. Make sure CAPS LOCK is OFF. The autohotkey script uses CAPS LOCK as a toggle to switch itself off.
  3. Make sure UFJD is mapped to the right windows key (normally, the one right of the right Alt). You can change the key in autohotkey script as well.
  4. Jump into a relatively empty sector that doesn't produce a lot of lag upon entry
  5. press Alt N. You should see SETA being activated after short period of time.
  6. After this DO NOT TOUCH THE KEYBOARD. You cannot minimize the game. If you want to stop the script, turn on CAPS LOCK. Once you activate it, the script will stop running after some time.
  7. Once you see a popup box on the screen saying 1 Engine Tuning or 1 Rudder Optimization in the title, congratulations, you found a crate. Stop the script by activating CAPS LOCK (wait a bit for it to actually stop) and then type "exit" to close the input box. The script will print the coordinates of the tunings container. Write them down or remember them.
  8. Reload the game from the 1-st slot and order your ship to go to the coordinates you recorded. Engine Tuning will become visible once you get close, for rudder optimizations you will need to drop an advanced satellite before you can see them.
  9. Once you collected your crate, jump away manually and save your game to a slot other than the first. It is a good idea to check that your game is still not modified in case something went wrong.
  10. Repeat as needed
Last edited by kurush on Mon, 21. Jan 13, 09:23, edited 5 times in total.

sadron
Posts: 641
Joined: Wed, 28. Dec 11, 09:27
x3tc

Post by sadron » Wed, 7. Mar 12, 00:58

I gotta bookmark this so I remember when I try to use it. Thanks for making this topic.

Lord0bsidian
Posts: 74
Joined: Thu, 31. Dec 09, 22:55
x3ap

Post by Lord0bsidian » Fri, 9. Mar 12, 16:51

nice macro, but i think it can run more efficiently if you make it load from a different save state. for example, before you start the macro, make a save in slot 10 (assuming you have no autosaves) then instead of loading from the top load from the bottom with input (pgdn). then you can cut out the entire part after the load where you jump back into the known sectors. plus this way you don't need a million energy or insurance and you don't waste game time jumping in and out while the rest of your ships start idling or run into enemies.




for anyone who can't figure out what to change, this is what the end of the edited macro looks like starting from after it runs the script, so basically everything from the shift L to the bottom

Code: Select all

SendInput +l
  Sleep 300
  SendInput {PgDn}
  Sleep 300
  SendInput {Enter}
  Sleep 300
  SendInput {Enter}
;Time it takes to load a game
  Sleep 45000
  SendInput {Del}
  Sleep 300
}
return

kurush
Posts: 4320
Joined: Sun, 6. Nov 05, 23:53
x3tc

Post by kurush » Fri, 9. Mar 12, 19:04

but i think it can run more efficiently if you make it load from a different save state. for example, before you start the macro, make a save in slot 10 (assuming you have no autosaves)
I thought about this, but then I like my empire to run while my ships are being overturned. If you didn't plan your empire to run on auto-pilot or want to save on salvage insurance, then yes, you might want to change that. The delay times are rather high as well, it should be possible to tweak them to match the actual performance of your system.
I ended up adding auto-detection for the situation when you find the crate to stop the Autohotkey macro and send me a message :)

sadron
Posts: 641
Joined: Wed, 28. Dec 11, 09:27
x3tc

Post by sadron » Fri, 9. Mar 12, 21:44

I think I did it wrong, I can't get it to work...

kurush
Posts: 4320
Joined: Sun, 6. Nov 05, 23:53
x3tc

Post by kurush » Fri, 9. Mar 12, 21:45

sadron wrote:I think I did it wrong, I can't get it to work...
Would you be able to provide more details what didn't work?

Lord0bsidian
Posts: 74
Joined: Thu, 31. Dec 09, 22:55
x3ap

Post by Lord0bsidian » Sat, 10. Mar 12, 00:28

first tell us what you did. make sure the button presses in the macro matches your in game hotkey setup. then if you feel up to it sit through one cycle and try to see where it's messing up. if you did the setup right, chances are your computer is taking longer to save or jump than the macro allows for so you'll have to change the times. the times in the macro are in milliseconds.

sadron
Posts: 641
Joined: Wed, 28. Dec 11, 09:27
x3tc

Post by sadron » Sat, 10. Mar 12, 05:46

I think the script for autokey isn't being run when I run the ingame script. Plus I don't have whatever is needed for the Alt-N hotkey combo.

kurush
Posts: 4320
Joined: Sun, 6. Nov 05, 23:53
x3tc

Post by kurush » Sat, 10. Mar 12, 06:31

sadron wrote:I think the script for autokey isn't being run when I run the ingame script. Plus I don't have whatever is needed for the Alt-N hotkey combo.
You don't run the ingame script manually (or, rather run it only once to make sure it shows in the first position in the script editor). You need to download and install the free software called autohotkey (the link in the original post, click Download there or use this direct link). This software replays keyboard shortcuts for X jumping you to UFJD and back and it also starts the ingame script. It is activated when the following two conditions are true
a) It is started and is showing in your windows system tray (green H icon)
b) You press Alt-N while in game
It will be stopped if you turn on the CAPS LOCK key

Basically, it does the job of jumping back and forth and running the in-game detection script every time for you. Nothing you couldn't do yourself if you are patient enough ;)

sadron
Posts: 641
Joined: Wed, 28. Dec 11, 09:27
x3tc

Post by sadron » Sat, 10. Mar 12, 07:27

Sorry I should have clarified, I DO have Autokey downloaded. I'm just saying it didn't catch, so as far as I know the script wasn't running.

kurush
Posts: 4320
Joined: Sun, 6. Nov 05, 23:53
x3tc

Post by kurush » Sat, 10. Mar 12, 07:31

sadron wrote:Sorry I should have clarified, I DO have Autokey downloaded. I'm just saying it didn't catch, so as far as I know the script wasn't running.
Check your system tray for this icon:
http://softfive.com/files/uploads/AutoHotkey-icon.jpg
If Autohotkey is started, it should be there . If you have it, right-click on it and in the menu select "Edit this script". Windows notepad with the current script should open. Check that you have my script there and not the default sample script coming with autohotkey.

Lord0bsidian
Posts: 74
Joined: Thu, 31. Dec 09, 22:55
x3ap

Post by Lord0bsidian » Sat, 10. Mar 12, 13:18

sadron wrote:I think the script for autokey isn't being run when I run the ingame script. Plus I don't have whatever is needed for the Alt-N hotkey combo.
autohotkey is basically a separate program that presses buttons for you. in other words, the in game script doesn't run autohotkey, autohotkey is supposed to run the in game script, along with all the jumping in and out of ufjd, saving, loading, etc.

this particular autohotkey macro is supposed to do a series of things in this exact order:

activate ufjd (press whatever hotkey you set for ufjd)
activate seta (press j)
wait until you jump into ufjd
save in slot 1 (press shift s, etc)
wait until you finish saving
turn on script editor (press various menu hotkeys to get to the name change and type in thereshallbewings)
wait for script editor to turn on
run the script (various autopilot menu hotkeys)

-here the in game script puts out a popup that stops the macro if it finds something, but if it doesn't the macro keeps going to:

load (press shift l, etc)
wait until you finish loading
jump out of ufjd (press shift j)
activate seta (press j)
wait until you finish jumping
repeat from top


the things you need to change in the macro file yourself are all the hotkeys for the relevant menu items and the times for all the waiting periods. you should leave 5000-10000ms extra on each time in case of lag spikes.

one more thing to note is that the popup doesn't actually stop the macro per se, just puts out a text box so that the autohotkey button presses become typed letters instead of menu hotkeys so you have to alt tab out and reset the macro before reloading your save and getting the tuning or the macro will keep going while you're trying to do other things

kurush
Posts: 4320
Joined: Sun, 6. Nov 05, 23:53
x3tc

Post by kurush » Sat, 10. Mar 12, 17:29

Lord0bsidian wrote: activate ufjd (press whatever hotkey you set for ufjd)
Small clarification: it is preconfigured with right windows key
[ external image ]
If you don't have it set for your UFJD, macro won't work. You still should see some activity on the screen such as saving the game.
one more thing to note is that the popup doesn't actually stop the macro per se, just puts out a text box so that the autohotkey button presses become typed letters instead of menu hotkeys so you have to alt tab out and reset the macro before reloading your save and getting the tuning or the macro will keep going while you're trying to do other things
You can also press CAPS-LOCK to force the macro switch itself off.

sadron
Posts: 641
Joined: Wed, 28. Dec 11, 09:27
x3tc

Post by sadron » Sat, 10. Mar 12, 18:10

I did try all this, I might have just missed something. I'll go over the steps and see if I can get it running again sometime soon.

User avatar
Gaidin
Posts: 56
Joined: Wed, 28. Apr 04, 10:22

Post by Gaidin » Sat, 17. Mar 12, 22:36

I ran this script for quite a while and nothing showed up. After each run, "NOTHING IS FOUND" message is shown even though i can see Energy cells in sector map. Is this script supposed to list everything in sector but only show a popup if an engine tuning/rudder optimization is found, or list only the engine tuning/rudder optimizations but nothing else?

*edit* ok it works fine, seems i was on a unlucky roll, after 4 hours it gave me 1 engine tuning :)
Last edited by Gaidin on Sun, 18. Mar 12, 08:21, edited 1 time in total.
Death is lighter than a feather, duty heavier than a mountain
Borderlander Saying

kurush
Posts: 4320
Joined: Sun, 6. Nov 05, 23:53
x3tc

Post by kurush » Sat, 17. Mar 12, 22:50

Gaidin wrote:I ran this script for quite a while and nothing showed up. After each run, "NOTHING IS FOUND" message is shown even though i can see Energy cells in sector map. Is this script supposed to list everything in sector but only show a popup if an engine tuning/rudder optimization is found, or list only the engine tuning/rudder optimizations but nothing else?
NOTHING IS FOUND means there are no tunings/rudder optimization in the current sector. I left this message to be able to visually control that things are being checked. So, if you see that message you can be sure your current UFJD sector doesn't have optimization crates. ECs or other wares are not checked. I think it still checks for ammunition though, but there should be no ammunition in UFJD, at least not right after you entered the sector.
The easiest thing to find something is just to leave it running and do some other things :)

DnBrn47
Posts: 197
Joined: Sun, 25. Mar 12, 10:39
x4

Post by DnBrn47 » Fri, 30. Mar 12, 04:30

is this in addition to the tunings that show up randomly in pirate sectors?

whistlinjoe
Posts: 61
Joined: Tue, 10. Jan 06, 00:03
x4

Post by whistlinjoe » Sun, 1. Apr 12, 19:49

Kurush,

Thank you very much for this. It works very well. One quick question though:

Did you notice a lot more rudder optimizations than engine tunings as you were using this? The first container I found was an engine tuning, but the last nine or ten have all been rudder optimizations. Just seems odd (nod to gambler's fallacy and all).

Thanks,

Joe.

kurush
Posts: 4320
Joined: Sun, 6. Nov 05, 23:53
x3tc

Post by kurush » Mon, 2. Apr 12, 05:37

Did you notice a lot more rudder optimizations than engine tunings as you were using this?
Rudder optimization comes twice as frequently as engine tuning. It has 2% chance vs 1% for ET.
is this in addition to the tunings that show up randomly in pirate sectors?
Yes, and it is pretty much unlimited.

DnBrn47
Posts: 197
Joined: Sun, 25. Mar 12, 10:39
x4

Post by DnBrn47 » Mon, 2. Apr 12, 15:06

kurush wrote:
Did you notice a lot more rudder optimizations than engine tunings as you were using this?
Rudder optimization comes twice as frequently as engine tuning. It has 2% chance vs 1% for ET.
is this in addition to the tunings that show up randomly in pirate sectors?
Yes, and it is pretty much unlimited.
Dude.... I'll have to try it ok. Good find.

Post Reply

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