Need to improve supply script so ship doesn't overflow.

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

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

Yonder
Posts: 322
Joined: Wed, 24. Mar 04, 22:53
x3

Need to improve supply script so ship doesn't overflow.

Post by Yonder »

I wrote a script to have one of my TS's go from (all mine) SPP to Cattle Ranch to Cahoona Bakery to Crystal Fab and back to SPP in order to keep the entire loop supplied. It picks up a full load of Energy at the SPP and drops a third of it off at each of the other factories, picking up the other products as it goes. What ended up happpening is the stations all fill up with energy and the TS is unable to unload, it then can't pick up enough beef/cahoonas to keep the others facs running.

I have increased the wait time between runs, and decreased the amount of energy transferred with each loop, and while these have pretty much taken care of the problem I would like to know a more effecient way of doing this.

Is there a script command which returns the number of a particular ware needed by a factory, and where are the basic operands (+-/*)

If it would help you guys to take a look at my script now I can post it, well, I guess I'll just do that anyways.
Yonder
Posts: 322
Joined: Wed, 24. Mar 04, 22:53
x3

Post by Yonder »

Script FactoryLoop01
Version: 0
for Script Engine Version: 24

Description
Script commanding ship to supply part of a factory loop
Arguments
1: ship , Var/Ship owned by Player , 'Ship completing loop'
2: SPPstation , Var/Station owned by Player , 'SPP of factory loop'
3: CRstation , Var/Station owned by Player , 'CR of factory loop'
4: CBstation , Var/Station owned by Player , 'CB of factory loop'
5: CFstation , Var/Station owned by Player , 'CF of factory loop'
Source Text

001 Start:
002
003 @ = $ship -> fly to station $SPPstation
004 = $ship -> unload 99999 units of Crystals
005 = $ship -> load 900 units of Energy Cells
006
007 @ = $ship -> fly to station $CRstation
008 = $ship -> unload 300 units of Energy Cells
009 = $ship -> load 125 units of Argnu beef
010
011 @ = $ship -> fly to station $CBstation
012 = $ship -> unload 300 units of Energy Cells
013 = $ship -> unload 125 units of Argnu beef
014 = $ship -> load 99999 units of Meatsteak Cahoonas
015
016 @ = $ship -> fly to station $CFstation
017 = $ship -> unload 400 units of Energy Cells
018 = $ship -> unload 99999 units of Meatsteak Cahoonas
019 = $ship -> load 99999 units of Crystals
020
021 @ = wait 60000 ms
022
023 goto label Start
024
025 return null
User avatar
JustHere4Coffee
Posts: 1075
Joined: Wed, 6. Nov 02, 20:31
x2

Post by JustHere4Coffee »

there's commands that check how much of a ware is on the ship or station, you could use those to see if they're needed and then just load onboard what's wanted

all stations except mines and SPPs have fixed duration cycles, and these have been calculated and posted by burianek I believe... the SPP and mine cycles vary depending on sunlight and yield respectively. using this info, and the time it takes to travel around your loop (based on you being OOS, it'll be slower when you visit due to the docking dance), you should be able to pin it down exactly

just one thing, where is your wheat coming from? that presents a potential weak link in your timing no matter how accurate you make your round-robin supplier
User avatar
Burianek
Posts: 2981
Joined: Mon, 29. Dec 03, 03:29
x3tc

Post by Burianek »

if you need station information, get X2EconModv2.xls (X2 Economy Modeler) from here.
All the info you should need.
"Nature's first green is gold" . . . stay golden.
Yonder
Posts: 322
Joined: Wed, 24. Mar 04, 22:53
x3

Post by Yonder »

Thanks for the link.

hmm, wheat, I don't have any of that right now, which factory needs that as a secondary resource? And won't my loop continue working out ok even without the secondary? I've had it going for a few hours and there hasn't been a shutdown except for the above problem.

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