[SCR] [TC/AP] Equip ships v6

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

Post Reply
chms
Posts: 164
Joined: Thu, 21. Oct 04, 19:17
xr

[SCR] [TC/AP] Equip ships v6

Post by chms » Sun, 5. Feb 12, 19:43

This script allows equipment of ships almost automatically:
(Almost because of a few menus to configure equipment)


[ external image ]Version 6

Alternative download link from xdownloads:
[ external image ]

Even there are significant costs for equipment You might see this script as a cheat because there is no check of reputation or availability of goods at the equipment dock.

Screenshots can be found within the German discussion at: http://forum.egosoft.com/viewtopic.php?t=316370


What are the different scripts for?
1. Main-script "CS.LOOP.Schiffe.ausruesten"
Parameter: none

The script runs in an continuous loop and checks two conditions:
Are there more than 100.000 credits at player's account and is the player's ship docked at any station?
In this case You will get a list to select a ship waiting at an equipment dock to be equipped.
The script decides by name of ship whether a ship needs equipment or not (equipped ships carry a '°' in their names).
The selected ship will be equipped using the following scripts and all turrets will be set to 'missile defense' (!turret.missiledefense.std).

If no ship was selected the menu will not re-appear before the player docks at another station.
2. The script for extensions "CS.SUB.Erweiterungen"
Parameter: The ship to be equipped

This script is called from the main script and equips the ship after showing a selection menu.
3. The script for shields "CS.SUB.Schilde"
Parameter: The ship to be equipped

This script is called from the main script and equips the ship with the maximum installable shields.
Weaker shields are removed.
4. The script for lasers "CS.SUB.Laser"
Parameter: The ship to be equipped

This script - the most complicate of all my scripts - is called from the main script and checks for a present configuration which will be shown to the player in order to decide whether to change it - or not.
Without changes the ship is automatically equipped with the pre-set lasers.
To change You'll be shown a menu with all turrets (only by numbers, no directions like 'front' or so) and lasers installed (or not).
For all changes are made within the ship (install and remove) changing of weapons directly will result in costs.
If possible all empty slots can be filled with ONE type.
The menu can only be left if there are no empty slots.
Configuration is stored in a global variable.
Unfortunately I found no way to write AND read configuration to/from a file...
Therefor with EVERY new game You will have to reconfigure.
How are costs calculated?
For every piece of equipment installed the MAXIMUM price is added to total.
For every piece of equipment removed the MINIMUM price is deducted from total.
As a result it can happen the total amount of a laser is 0 costing 100.000 Credits...

As additional charge 20% of the total amount - at least 1000 credits - are added.

If You are unable to pay all the price at once for each hour (in-game-time) there is an interest of 1% to the remaining amount.

As long the order isn't completely payed there no new orders can be given.

How do I install the scripts?
UnZIP the file and put the scripts into TC's and/or AP's scripts-folder(s).
The language file(s) have to be located to the corresponding t-folder(s).

How do I start the scripts?
On activation of the script-editor the script "setup.CS.Schiffsausruester" will ask You if the script shall be run - now, later or not.
Running later as global script can be done by a "Re-Init Script Caches" or executing script "CS.LOOP.Schiffe.ausruesten".

How to uninstall the scripts?
Normally I would say: delete them.
The script checks "Am I still here?" and ends itself if not. (I hope problems are avoided that way.)
Version 5 adds a check for the version of the script engine disabling the file-check for TC.
Therefore there's no warranty deleting of files will be enough or even damage Your savegame. (A hint from experienced scripters would be helpful here. Thanks.)

Does the script run with TC?
With Version 5 it should run on TC (see above)

Problems with other scripts?
Not tested.
But as the equipment is checked only by the name of a ship (with or without "°"), there might be problems with scripts or mods "messing around" with the ship-names.

There was a message like "xxx destroyed". How do I restore my equipment?
Rename the ship by removing the "°". (e.g. make "Your Buster°" "Your Buster"again.)
And - of course - send the ship to an equipment dock.
Warning: If You changed the default armament the lasers will be equipped using the new configuration (additional costs).


Have fun.

BTW: I'd be happy about ANY responses (Happy about ANY? Not really but... ;))

Changelog:
v4.01: In v4 the laser slots where empty or the existent lasers were shown instead of the lasers to be installed when asking to use saved configuration. Fixed.


Edit [1st December 2015]: added alternative download link from xdownloads. X2-Illuminatus
Last edited by chms on Mon, 30. Jul 12, 21:13, edited 4 times in total.

chms
Posts: 164
Joined: Thu, 21. Oct 04, 19:17
xr

Post by chms » Thu, 8. Mar 12, 00:30

Version 5 has arrived - and should run with TC now:

<Link removed - please use recent link>

Changelog:
  • File-check skipped within TC (for use with TC).
Last edited by chms on Mon, 30. Jul 12, 21:19, edited 2 times in total.
Inactive atm due to very slow internet access (via cell phone).

chms
Posts: 164
Joined: Thu, 21. Oct 04, 19:17
xr

Post by chms » Mon, 30. Jul 12, 21:10

Version 6 is available for download.

Changes:
  • In TC the laser configuration was not shown – fixed
  • In case of turrets with no compatible lasers (e.g. „Minotaurus“ in German version) the configuration menu could not be left – fixed
  • There now is an option to put every available equipment into a ship – with a few restrictions (e.g. the „carrier software“ cannot be installed into a ship with less than 10 docking slots)
  • Ships can also be equipped when docked at a shipyard or the player's headquarter
Have fun - and please report errors You discover. Thanks
Inactive atm due to very slow internet access (via cell phone).

User avatar
vukica
Posts: 1744
Joined: Sun, 10. Aug 08, 18:05
x4

Post by vukica » Tue, 28. Aug 12, 15:32

this is what i was looking for! will try it out

EDIT: OK, it works good but i just wish it worked as a ship command, and not something automatic and namechanging. also once it's activated you need to select something for the equipment. would be useful if you could skip any stage.
Split say NEED MORE FIREPOWER!!

chms
Posts: 164
Joined: Thu, 21. Oct 04, 19:17
xr

Post by chms » Tue, 28. Aug 12, 22:54

vukica wrote:i just wish it worked as a ship command, and not something automatic and namechanging.
I was thinking of making this a ship command but when I wrote the script I just ran into trouble with possible destruction of ship and payment - and somehow "ignored" the ability to use global variables. (a)
The namechanging was made for the script AND the user to easily know which ships are already equipped. (b)
vukica wrote:also once it's activated you need to select something for the equipment. would be useful if you could skip any stage.
see (b) as well...
  1. I will check if I can change this.
    If it is necessary to do again from scratch: No way - sorry.
  2. If I do the above I also will try to add commands to make these things optional like
    • View/Change equipment for this ship
    • Equip this ship automatically (if configuration is available)
    • Disable renaming of equipped ships
    • Allow renaming of equipped ships
But it can take some time depending on spare time and mood ;)
Inactive atm due to very slow internet access (via cell phone).

User avatar
vukica
Posts: 1744
Joined: Sun, 10. Aug 08, 18:05
x4

Post by vukica » Tue, 28. Aug 12, 22:55

thanks for the response, i hope you do it :)
Split say NEED MORE FIREPOWER!!

AerrorKen
Posts: 5
Joined: Sat, 25. May 13, 04:34

Post by AerrorKen » Thu, 30. May 13, 02:18

I like the idea of this script. In Vanilla, it seems we are restricted to only a select few ships, when it comes to easily equipping large fleets with attached eq docks. The idea of using this script to experiment with hordes of different ship types is appealing.

However, when I go to download, rapidshare displays an error and then goes to a page with a red box with the following info:

The download for this file has not been enabled. Only the user who uploaded it, can enable the download option.

Pretty please, re-enable the download?

chms
Posts: 164
Joined: Thu, 21. Oct 04, 19:17
xr

Post by chms » Fri, 31. May 13, 22:16

Corrected a setting I can't remember of changing it.


Please try again
Inactive atm due to very slow internet access (via cell phone).

Pontiac
Posts: 12
Joined: Thu, 11. Jul 13, 00:18
x4

Post by Pontiac » Thu, 11. Jul 13, 00:19

Is there a way to see how much more is still owed for the parts purchased, or, do I get a notification when I'm done paying it off?

[Edit] You're notified. WOULD be nice to see a tally while you're paying the thing off so you know how often you get neutered to 10k cr. ;)

Pontiac
Posts: 12
Joined: Thu, 11. Jul 13, 00:18
x4

Post by Pontiac » Tue, 26. Nov 13, 05:16

I found a bug with this script and the Valhalla.

This particular ship has 12 guns available for front, right and left turrets. If I go to equip slot 10 or 11, slot 1 actually gets the upgrade. Now, I'd give this up to just trimming too much of the string and the text "Laser #10" is being seen as "Laser #1". I can deal with that, however, there is a problem with the logic of "Requiring every slot to be filled to "quit"".

The Valhalla uses two different sets of guns for the front, left, and right, versus the top, rear, and bottom. The option to "Fill with a gun of a particular type if possible" will not work. So I can't just default to whatever is available because there are no common guns between the two sets. Ok, fine, however, since the first paragraph indicates a problem with equipping laser #10 and 11, and I'm forced to fill out the load out which I cannot complete, so I'm stuck and cannot abort the script.

So I'm asking for one of two things;

I'm a developer and have looked at your code, but its still murky as I'm not familiar with the language and structure Egosoft is using. First question is, where abouts would I remove the logic that the load out MUST have full guns fitted, or where can I see the error with the slot number its trying to load to? Honestly, the restriction of requiring a full load out kind of seems rather odd since perhaps I just want a fully fitted ship with no guns as it'll be just used for ferrying between two points of interest.

Second, after the fix is done, what is the procedure to unload the script from my current saved game, then re-apply the fix? Do I just use the "delete files, save, load, install, load, re-save" method?

Fortunately, I saved just before I bought the Valhalla, so I'm not screwed yet. ;)

chms
Posts: 164
Joined: Thu, 21. Oct 04, 19:17
xr

Post by chms » Tue, 26. Nov 13, 15:28

Bad timing ;)

As I'm playing X:R and don't have x3 installed at the moment it's hard to detect an error by using a simple xml-editor.

All the stuff referring to the lasers is done within the script "CS.SUB.Laser.xml".

The easiest way to avoid problems here <u>for now</u> might be the following - if You decide to completely ignore the lasers:

Edit (ingame) the file "CS.LOOP.Schiffe.ausruesten.xml"
Make the line calling the script for lasers a comment (should be the key [.])
Increase the version number by 1
Save file and exit the script-editor.

With the increased version number the script will restart itself (as far as I remember)


As soon as I pause X:R and re-install TC/AP I will have a closer look at this problem - but might take a while ;)
Inactive atm due to very slow internet access (via cell phone).

Pontiac
Posts: 12
Joined: Thu, 11. Jul 13, 00:18
x4

Post by Pontiac » Tue, 26. Nov 13, 16:29

I kind of figured that XR would be my downfall the MOMENT I found this problem. ;)

German is probably in my blood from about 5 generations ago, and I barely even remember the swear words I learned from when my family was here so many years ago... If I can't remember swear words, just think of how well I'm going to remember REGULAR words. ;) So, I'mma gunna have fun with translating some of these variable names to figure out what goes where. :]

I have the X3 script editor running, and it seems that the script does get changed periodically. I found out that your script forces an hour delay between refits (Escaping the initial request doesn't count it seems) and I just couldn't wait to refit this ship I stole. So dug in, found the time out, set it to 30 seconds, and saved it without changing the version number. This was a few weeks ago. Today, I just activated the script editor in game and noticed my change.

That all said, I'm going to have to run against the language file to see whats what, and go from there.

The other thing I'm wondering is to set a hot-key to activate this script when docked, but I'll save that for another day.

Edit:
So I found the code, and it skips the laser part. [edit-removed commentary about my screw up]. I just have to go find the weaponry for this, or, mess with the script some more to see if I can get it to quit. ;)

Image

Another question. Would it be possible for the "Autofit" window to list all available guns to the ship, but only fit what is allowed in each slot? So I'll get the list of 7 guns available, but when I select a particular type, the script will loop through all slots with no gun mounted, verify that the slot is able to take the gun, then attach it if it will work.

(Once XR gets to a certain stage, I might buy it. I've been watching video streams and I'm not completely sold on it yet.)

chms
Posts: 164
Joined: Thu, 21. Oct 04, 19:17
xr

Post by chms » Wed, 27. Nov 13, 04:13

Pontiac wrote:Another question. Would it be possible for the "Autofit" window to list all available guns to the ship, but only fit what is allowed in each slot? So I'll get the list of 7 guns available, but when I select a particular type, the script will loop through all slots with no gun mounted, verify that the slot is able to take the gun, then attach it if it will work.
I'm not sure if I understand this right, so I create a simple example ;)
Let's say we have 3 turrets.
#1 can carry type A and B, #2 type A and C, #3 B and C.
If I'm right You want a list showing A,B and C at one time to install Your preferred gun in as many slots as possible.
I'm sure this can be done but I don't know if this will need a simple change only or a complete rewrite.

When I get the time I will also look at this.

So the ToDo reads
correct weaponry for ships like Valhalla
complete list of lasers
create/optimize notification
Inactive atm due to very slow internet access (via cell phone).

Pontiac
Posts: 12
Joined: Thu, 11. Jul 13, 00:18
x4

Post by Pontiac » Wed, 27. Nov 13, 19:34

Yeah, that is what my thought was. If the bug of not being able to fit slot 10 and 11 can't be fixed due to in-game restrictions, I think the "QUIT" option will have to allow the user to continue "as fit", or just allow the user to continue "as fit" as the script stands.

ABSOLUTELY NO RUSH on this. Enjoy XR. I'm probably one of the last few that are playing X3 instead of XR. ;)

If you don't want to do this, that'll be OK with me as well. I can always go through the script and convert the German variables to English so that I can probably work through the logic.

Edit:
Oh, the other thing I think you might want to do is in your "Check.Version" section in the LOOP script is add a title to the error section so that IF something goes missing, the user might be able to figure out what went missing. I had an issue with a script screwing up XRM, and it screwed over the Jonferco station. When I went to restage all my mods, I kept getting the error "Main file missing" error, and I had NO idea what it was. So what I did was modify your version to prefix the "Main file missing" with the name of your script, JUST in case something else gets buggered later on down the road and I have to restage. :]

Code: Select all

if not does script exist: 'CS.LOOP.Schiffe.ausruesten'
[PLAYERSHIP]-> send incoming message: text='Equip Ships - Main file missing. Stopping script for equipment of ships' temporary=[TRUE]

chms
Posts: 164
Joined: Thu, 21. Oct 04, 19:17
xr

Post by chms » Thu, 28. Nov 13, 05:40

Pontiac wrote:ABSOLUTELY NO RUSH on this.
...
If you don't want to do this, that'll be OK with me as well.
I will work over the script as soon as I find the time when the "hot phase" for XR is over - if I don't forget about it ;)
Pontiac wrote:add a title to the error section
Very good idea - I never thought of that because when I started writing the script I didn't think of sharing it.
Inactive atm due to very slow internet access (via cell phone).

Pontiac
Posts: 12
Joined: Thu, 11. Jul 13, 00:18
x4

Post by Pontiac » Tue, 7. Jan 14, 05:09

So how's that XR doin for ya? ;)

Idleking
Posts: 425
Joined: Tue, 15. Aug 06, 15:47
x3ap

DL offline

Post by Idleking » Mon, 14. Apr 14, 14:25

Sorry for the bump, but the download link provided gives me a 404.
As the size of an explosion increases, the number of social situations it is incapable of solving approaches zero.

[ external image ]
Litcube wrote:Don't succumb to the "I figured it'd be ok".

chms
Posts: 164
Joined: Thu, 21. Oct 04, 19:17
xr

Post by chms » Mon, 14. Apr 14, 16:32

Sorry, I will check on weekend.
Changes on script are impossible at the moment as I don't have TC installed and I only have very slow internet right now...
Inactive atm due to very slow internet access (via cell phone).

dfm5000
Posts: 272
Joined: Fri, 12. Oct 12, 20:40

Post by dfm5000 » Wed, 16. Apr 14, 09:08

File no longer available for download.

ARGHouse
Posts: 3
Joined: Wed, 22. Apr 20, 04:15
x4

Re: [SCR] [TC/AP] Equip ships v6

Post by ARGHouse » Wed, 22. Apr 20, 05:45

Could someone please kindly upload a version of v6, I am trying to figure out how to get the script to ignore the missile bays, I don't want to waste my time doing that.

Post Reply

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