New Script:AutoStationV1.1

The place to discuss scripting and game modifications for X²: The Threat.

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

JumperBR
Posts: 163
Joined: Wed, 6. Nov 02, 20:31
x2

New Script:AutoStationV1.1

Post by JumperBR »

I know, I know, there are many Manager for Stations, like that nice one, the AS.cashier, which goes from station to station...

But, what I have is different, see what it does (I assume that you use a Boron Manta as Transporter):

* Let´s say, your BoGas Factory has 4000/5000 EC at 16c, how much this factory needs to work? needs at maximum 16000 credits, right? And 4500/5000 its 8000 credits, right? Right! And 3000/5000? Needs 32000, right? No!! The maximum cargo per time is 1000! So, the maximum is constant here at 16000 credits, which changes according to the cargo. If there is multiple resources, it will check for the bigger value and set it ahead.
* Now, the good point, tired of replacing your transporters? The problem is solved, the script buys new ships as soon as they are lost... and set it to work right away. I have fixed the value at 2 per factory, but it can be changed.

I havent figured how to buy ships via script, I create the ship and reduce the player account accordingly, along with all the equipaments used. So, it cant be cheating... I think... if I find a better way, the next versions will have it.

This script buy the ships from the closest shipyard to your station and add default equipments to it.

Also, you can set a ship to protect your freighters (jump and protect).

To use it is simple, it will add commands to the Trade submenu:
Station Report: How much profit this station gained.
Jump and Protect Freighters: The ship will stay in Stand By mode, and will jump if any freighter is attacked.
Stop AutoManage in a Factory: The factory stops the automanagement
Set a factory to AutoManage: Factory will manage it automatically
Set all factories to AutoManage: same for all

It needs:
* FATE auto buy/sell script

Download:
http://www.xscripting.com/index.php?nam ... tationV1.1

Althrough, I recomend to test it in a separated save game, if the results are apropriated for you, just continue.
Any wish?
Last edited by JumperBR on Fri, 23. Jul 04, 21:42, edited 3 times in total.
Mai ingrish iz gud?
XeHonk
Posts: 1087
Joined: Sun, 7. Mar 04, 23:03
x3tc

Post by XeHonk »

Now, the really bad point: I found no way in finding ALL the ships belonging to a certain factory, so, if you set it to a existent factory, it will just ignore the existent ships and buy new ones... I will try to fix it in the next versions...
there's no way to do that
just connect a script to the ship_killied signal instead, works fine ^^ (and prevents quite a lot of cpu-eating loops)

but you should make the script independend of ship-type, that sucks ;) (not everyone uses a boron manta, you know?)

and dont forget a command to stop executing that script on certain factories :P
JumperBR
Posts: 163
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JumperBR »

I will this signal_killed, maybe it´s a best option...
I know about the Boron Manta, until next version I will have best solution for this, maybe adding a "Set ship type" command...

I added the command to stop right now. It´s already on the package.

bye
Mai ingrish iz gud?
JumperBR
Posts: 163
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JumperBR »

I was thinking about the signal_killed, to work, it need to connect every ship from every factories to it, right?
If so, I am back to the first problem, the one in which I cant find all ships which belong to a given factory, since some of the ships can be docked. This signal_killed would work fine, if this problem is solved, but as it is now works fine too...
It checks if any ships in the array have been destroyed (which is rather simpler) and replace as needed...
Unless I can find a way to retrieve ALL ships from a given factory, the way as it is now will work just fine.

Another thing, there is any way to rename a ship by script? Instead of lots of 'Your Boron Manta' I would like to see '$factory.name ship$id'.

I will be working on a way to add the ships visible to the array of ships, which would incur in less ships to be bought.

bye
Mai ingrish iz gud?
XeHonk
Posts: 1087
Joined: Sun, 7. Mar 04, 23:03
x3tc

Post by XeHonk »

just connect the signal whenever you buy a new ship :]
you cant rename objects in 1.3 ^^
JumperBR
Posts: 163
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JumperBR »

With new ships, the actual solution works fine, I allways know when a ship was destroyed, no need to change now.
The problem is connect ALL the existent ships to the signal, allowing me to replace them as they are lost.

I will try to find a better solution, maybe a check running from time to time connecting ships to the signal...
Mai ingrish iz gud?
XeHonk
Posts: 1087
Joined: Sun, 7. Mar 04, 23:03
x3tc

Post by XeHonk »

i'd suggest waiting for 1.4 before doing any evil hacks that wont work anyway =)
JumperBR
Posts: 163
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JumperBR »

wont work? evil hacks?
Mai ingrish iz gud?
XeHonk
Posts: 1087
Joined: Sun, 7. Mar 04, 23:03
x3tc

Post by XeHonk »

looping every few minutes to test if there's a new ship in the universe is a hack imho :)
especially if there might be functions to get docked ships (or even ships with a certain homebase? would be nice :P) in 1.4..
JumperBR
Posts: 163
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JumperBR »

the loop is to check if the ships of the station are still there, it´s not a hack, its a solution, since nothing is forced and the check is inside the script to automanage the credits needed.
The hack is to buy ships, here I would appreciate too much new functions.
I don´t believe that will be functions to get all ships from a station on 1.4, but if so, I will use then... just wait and see, I think.
Mai ingrish iz gud?
XeHonk
Posts: 1087
Joined: Sun, 7. Mar 04, 23:03
x3tc

Post by XeHonk »

it's a hack to do something with a function that's not supposed to do what you're doing (heh :P)
foldoc wrote:<jargon> 1. Originally, a quick job that produces what is needed, but not well.
you want to see test if new ships are there for a certain factory..
that'll be slow (compared to using a proper function (which isnt there, yet :() but it can work (hence it's a hack :P)

using that loop to see which ships are >still there< (i.e. not killed) is surely no good idea, cuz it cannot work
JumperBR
Posts: 163
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JumperBR »

Its more of a replacement, and it´s not slow, since the ships are in a array,
I just do this to check if the ship exist:
$ship=$ships[$c]
$exists=$ship->Exists
if ($ship==null) or ($exists==false)
$ship=call script to replaceShip
$ships[$c]=$ship
end

see? I dont have to check all ships in the game are from the factory, just have to see if the ships in the array exists.
Also, it works very fine, I just dont buy any more replacements for my 35 factories.

bye
Mai ingrish iz gud?
XeHonk
Posts: 1087
Joined: Sun, 7. Mar 04, 23:03
x3tc

Post by XeHonk »

that's quite a different approach :] (not particularly what i was talking about)

i was talking about
If so, I am back to the first problem, the one in which I cant find all ships which belong to a given factory, since some of the ships can be docked. This signal_killed would work fine, if this problem is solved, but as it is now works fine too...
It checks if any ships in the array have been destroyed (which is rather simpler) and replace as needed...
Unless I can find a way to retrieve ALL ships from a given factory, the way as it is now will work just fine.
(first sentence)

btw.. connecting a signal is easier than looping through an array :]
JumperBR
Posts: 163
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JumperBR »

I see, well, that check for all ships would be done just one time per factory, adding these ships to the array.
Yes, maybe a signal is a good idea, but it is needed to know the ships from each factory... let´s see.

By what I already see on the script changes, there is still no way to get the ships from a factory...

But, the good news is that there is a way to change ship names, this is fine.
Mai ingrish iz gud?
JumperBR
Posts: 163
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JumperBR »

Well, the command to get all ships from a station is there! good!
Im doing some new changes to the script:
* it will now recognize existents ships on the factories and replace them as they are lost.
* It will use signal_killed to replace lost ships
* It will buy a TS from the sector race where is the factory (but,if its pirate, xenon or khaak, it will be Argon), I´ve made templates for each race.
* Added a ship command to set a fighter to mode Protect Ships, allways that a ship is attacked, it will jump to protect
* A command will be available on station to auto manage (still have to manage this)

I will test for more a few days and then release it...
Bye
Mai ingrish iz gud?
JumperBR
Posts: 163
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JumperBR »

New version released, now it will buy new ships from the closest shipyard.
I created a template for each race, so no need for set it.

Basically, set a station and forget... the station will run by itself.

bye
Mai ingrish iz gud?
Wurzelseppi
Posts: 56
Joined: Fri, 26. Dec 03, 13:26
x3tc

can´t get the script working

Post by Wurzelseppi »

Hi All,

i copied the files into the right folder and started the game, but there´s no special thing available in the gooner temple....

i read then, that the FATE buy/sell script is required, but i didn´t find that either.....

can anyone help me please...

Thanks alot....

Greetings from Germany,

Wurzelseppi
hutchim
Posts: 8
Joined: Tue, 7. Jun 05, 19:13
x3

Post by hutchim »

This is exactly what I've been looking for... however the site hosting the download has shutdown!
rainbowman
Posts: 26
Joined: Sat, 21. Jun 08, 14:31

Post by rainbowman »

There is a Player-Owned Shipyard (by Babyface, etal) floating around. However, it doesn't create ships, so I have been working on the equivalent of a Ship Factory. Scripting for free ships is pretty simple, but I would prefer something that might stand a chance of getting signed.

My version of the factory takes the stock as a Virtual value, running stock control and then creating the ships accordingly. The factory still needs resources providing. Is there anyone else working on anything similar?
Got a couple of problems...
(i) some of the ships are producing too much stock at the same time so exceeds the maxstock value, hence don't even start producing. I am using equivalent timebase and splitting production into several shifts for multipart which are combined at the end. (eg Raptors treated as 4074 shield1mw time increments instead of the full 16 days each, or 814 days for the 48 (!!!) it tries to build...) I am adding the shield first to set the time interval, then removing it and adding the shiptype as product instead. Any other solutions?
(ii) problems having enough stock space for resources for the larger items. Harriers will run without any problems in an Alpha Hept factory, and all the other factory shells that I have tried. But the larger ships need too many resources for a single production, so I use a bigger factory which annoyingly scales up and produces more items per cycle. Grrr. Trying to arrange a solution similar to the one I am using for problem (i).
(iii) the automatic and, as it happens, incorrect voiceover, telling me that an Advanced Satellite factory is such and such, when it is ACTUALLY my Teladi Harrier factory, is starting to do my head in... Is there any way to change the info in the voiceover so that it is accurate re the product of the factory?

I am trying to gather as much info on resources required per shiptype as pos, so I can simulate the deduction of res after a suitable time has elapsed. Any help in shiptype to factoryshell combinations would be appreciated. Thanks.
(I am also going to try and sort out some sort of ship repair system built into the Babyface shipyard, as well. And I have ideas for ST factories - requiring a player to own a TL.)

Edit - As this thread is a few yrs sold, it has disappeared for a while. Those viewing for the first time may wish to read further up for the original station management script for this thread.

Return to “X²: The Threat - Scripts and Modding”