[SCR] Station Financial Manager Mk2

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
User avatar
Idea
Posts: 516
Joined: Fri, 24. Oct 08, 12:14
x4

Post by Idea » Sat, 17. Jan 09, 21:22

I am back.What's new.Do you need help in something?

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sat, 17. Jan 09, 23:41

I need to do a bit more internal testing first

(And I want to actually make the command, add ship to station, cos I'm sick of doing it via the script editor, considering half the time the ship has flown off to god knows where) Hopefully by lunch (3-4hours?) , I'll have finished a satisfactory alpha.


But should you find your self completely unable to study (Be warned, Procrastination is dangerous!!!)
BE WARNED!!!, it will over write Financial recording, as its like v15 of it (no v11-14), most of the new features do work (remove all stations, add all complexes-needs work to find individual stations)

first you have to init the ships local variables, (note can't be run on player ship as their homebase = null even if they have a home base... so debugging is just adding LOTS of message logs round the place), by running the script
plugin.stat.fm.ship.add.xml on THIS (being w/e ship your testing it on, make sure HB exists first)
Next, run the actual script,
plugin.stat.fm.ship.loop.xml (Also on this)
And it should -fingers crossed- work

(Oh and make sure you've started financial what ever on the station first)


Quick run down of the loop script

Lines < 30, Does some basic checks, homebase exists, hb is saved on one of the local vars (from the add script) and its checked somewhere else. Currently the script restores the original homebase.

Line 35, Findware, This is... like the super awesome multipurpose script with 500 tools and tidbits included. It returns an array {ware,station,buy,amt,destination}
ware -next buy/sell ware (picks the best from an equation, in short, which ever is needed to be bought/sold the most, and is in range (and 2-jump range if jumper), oh and if a buy station exists.
station the station your will be buying/selling to
buy -boolean variable, whether to buy or sell the ware (this gets saved in local var plugin.stat.fm.config[1], i might consider changing to cmd target 2 thou, simply because saving it to the config[1].
amt (jump fuel adjusted if ware is energy and ship is SUPPOSE to be jump capable, ie jump is turned on)
destination where we are heading now (homebase, or station)


Line 44, setobj, sets all those configs on the ship, tells the station your landing on it
Line 50, moveone, If not in dest sect, move to next sector (or jump to sector if jumper- note self, bug, no escort jump check). If in destsect, but not in dest, dock, else do nothing. If it did nothing, it will return null, and it will skip the continue, otherwise, it'll continue, and re-findware (hopefully, its current ware should still be the highest priority, otherwise it'll fly off to the new ware)

Line 53 to seventy. TRANSACT!!! (finally?). returns null if "issues" arose (couldn't sell all, couldn't offload all, bug?).
64-68 Ill take these out later, but they are staying in for debugging atm.

Line 74+ This is run once the ship has exhausted all ware choices. Basic RTB command.
Bug note.... I haven't put in my moveone script in here yet... it's still using the stock script..



A super quick rundown of the script is
1. run checks (version, hb, etc)
2. logic check, (gets ware)
3. fly one step
4 logic check
repeat 3-4, until docked at destination (might not be original destination any more, its just what ever find ware priorities)
5. trade
6 repeat 1-5, if nothing then...
7 homebase

Known (fixed?) buglist
stat.fm.ship.add
FIXED line 4ish, pulling stat local var configs now pulls from correct array
futuremax
Fixed, line 70+, pulling shiplist array, from wrong variable
fixed did not factor buying/selling into eqn
---------------------------
future ideas list
Ships prioritze current ware, if HB is full, to prevent being looped, dump all wares into a single ship (if size >=2) prevents multiple ships being stuck with the same cargo (this way at most only one will be)will need to retask the return on... transact script (or write it into the actual transact script.. probably this way instead actually)
modify moveonescript, if docked *run fly away first* prevents crowding around the station when jumping.
Last edited by s9ilent on Sun, 18. Jan 09, 08:42, edited 5 times in total.

User avatar
Idea
Posts: 516
Joined: Fri, 24. Oct 08, 12:14
x4

Post by Idea » Sun, 18. Jan 09, 00:09

I take the job :D :D :D

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sun, 18. Jan 09, 00:19

[url]http://members.optuszoo.com.au/whyistha ... /scrfm.xls[/url
This might help, it has a list of all the local/global variables
And... the priority calculations
and other misc junk

User avatar
Idea
Posts: 516
Joined: Fri, 24. Oct 08, 12:14
x4

Post by Idea » Sun, 18. Jan 09, 00:39

One thing.
I started the scripts but the ship dock on the homebase and do nothing.
First I stop recording on stations then start it agen.I set the homebase and start the sript.I have a lot messages logs they look like this every minute.
ARRAY(Energy Cells,Crystals,Silicon Wafers,Measteak Cahoonas)
ARRAY(0,0,0,0)
Nothing to do

My homebase is Crystal Fab M race Argon sector Argon Prime.
They station do not have ware on it.It is empty.
Last edited by Idea on Sun, 18. Jan 09, 00:50, edited 1 time in total.

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sun, 18. Jan 09, 00:46

Hrm... set the ship to idle (so it leaves the station)
, and run the script


$ret = plugin.stat.fm.findware on the ship
write to logbook $ret


One of the things about how the script works, is that it ALWAYS works on wares in its inventory first. So if the station is full and it has wares, it will just sit there, trying to continuously unload. Thats the usual culprit for me


It should return the current objective, and also it might print off an array of all wares of the station, and a list of numbers with it.
Tell me what it gives you (Oh and whats the homebase)

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sun, 18. Jan 09, 00:52

Are there stations within the stations max range, with the good prices?


From the ouput, it's saying that all tasks have priority 0. So they are either all at 100% stock (or 0 from products) (which is unlikely), or there are no stations within range

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sun, 18. Jan 09, 01:10

Yeh, just double checked my script, priority = 0 is returned when.. either the priority IS 0 (i.e stock is near 100 and/or distance is far away enough)
or when there is no station.

I'm going to change the no station priority to -1 thou to make it more distinguishable (Although the ship still won't act unless prio > min prio)

User avatar
Idea
Posts: 516
Joined: Fri, 24. Oct 08, 12:14
x4

Post by Idea » Sun, 18. Jan 09, 01:14

I set command on idle,the shup come out of the station and he do nothing.I start the script plugin.stat.fm.findware and still nothing.Then I start form
beginning plugin.stat.fm.ship.add.xml after that plugin.stat.fm.ship.loop.xml
And he start to go for Silicon Wafers in Silicon mine in Duke's Vision.
Message logs:
ARRAY(Energy Cells,Crystals,Silicon Wafers,Measteak Cahoonas
ARRAY(5,0,171,129)

765

null

416

764 then agen

ARRAY(Energy Cells,Crystals,Silicon Wafers,Measteak Cahoonas
ARRAY(5,0,171,129)

765

null

413

764 then he found the station were the ship go to
ARRAY(Silicon Wafers,Silicon Mine M beta(Duke's Vision) 1,764 Silicon Mine M beta(Duke's Vision))

Silicon Mine M beta(Duke's Vision)

flyin to sect

can jump

Then the ship jump 5 sectors form Argone Prime to Emperor Mines
I will be watching the behavior of the ship.The jump range I set is 20.Sory for my slow answer English is not my nativ language so I have difficulties to answer fast :(

User avatar
Idea
Posts: 516
Joined: Fri, 24. Oct 08, 12:14
x4

Post by Idea » Sun, 18. Jan 09, 01:28

:evil: :evil:
At the moment the ship come through the gate from Preacher's Void to Duke's Vision agen log meesage:

ARRAY(Energy Cells,Crystals,Silicon Wafers,Measteak Cahoonas)

ARRAY(0,0,0,0)

Nothing to do

Crystal Fab 1(Argon Prime) an the he turn around and heed back to homebase. :evil:

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sun, 18. Jan 09, 01:34

Hrm... something is wrong with my ware finder... Hold one.. I'll have to find it..

User avatar
Idea
Posts: 516
Joined: Fri, 24. Oct 08, 12:14
x4

Post by Idea » Sun, 18. Jan 09, 01:38

I check with Universal buys/sells and in Duke's Vision was the closest with best price of 232 for Silicon Wafers but also Silicon Mine M gama had the same price and that mine was closer to the North gate then Silicon Mine M beta.

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sun, 18. Jan 09, 01:46

Hrm..
I haven't made an in sector distance checker yet. I just assumed the command would automatically do it.

(Found the problem I was having earlier... i was running on THIS and not on the ship :S no wonder why I kept getting 0's)

But yeh... I see what you mean.. its randomly flying backwards and forwards between the stations....
Mines stuck between majaglit alpha and beta
Ill have to refine the find sta list

bug fix, future max no longer counts current ship
(prevents wierdness with with amt)

Ill try to fix up this multiple stations business, then I'll re upload
Last edited by s9ilent on Sun, 18. Jan 09, 01:57, edited 2 times in total.

User avatar
Idea
Posts: 516
Joined: Fri, 24. Oct 08, 12:14
x4

Post by Idea » Sun, 18. Jan 09, 01:50

I accidentally increased the price for buying wares in station and my EST fill it up.That probably trigger the ship to go back.I will reduce it ageen :oops:

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sun, 18. Jan 09, 02:04

Ok I worked out "why" the ship is bouncing around different stations.

It is finding the closest station BUTTT, I make it recheck when docked, and when its docked, it has no co-ordinates (position null). So the nearest is just the nearest to 0-0-0, but if i make the ref obj the station, then it doesn't count it in the search.

So... *sigh* dodgy work around required...

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sun, 18. Jan 09, 02:06

Ok I worked out "why" the ship is bouncing around different stations.

It is finding the closest station BUTTT, I make it recheck when docked, and when its docked, it has no co-ordinates (position null). So the nearest is just the nearest to 0-0-0, but if i make the ref obj the station, then it doesn't count it in the search.

So... *sigh* dodgy work around required...

Bah wait.. ... i set the ref object.. but i forgot to make the search use the refobj var..

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sun, 18. Jan 09, 02:16

Ok I worked out "why" the ship is bouncing around different stations.

It is finding the closest station BUTTT, I make it recheck when docked, and when its docked, it has no co-ordinates (position null). So the nearest is just the nearest to 0-0-0, but if i make the ref obj the station, then it doesn't count it in the search.

So... *sigh* dodgy work around required...

User avatar
Idea
Posts: 516
Joined: Fri, 24. Oct 08, 12:14
x4

Post by Idea » Sun, 18. Jan 09, 02:23

Something is hapening.
Becouse I increased the prices in station Crystal Fab 1 game-ships just poping up and fill the station with wares not my EST.
So I used the Cycrow cheat script and creat new Crystal Fab 2 to speed the proces.Then I stoped the command on my Tester 1 ship,set his homebase to Crystal Fab 2, start the fin recording and start station manager ageen.Then my ship Tester 1 start to fly to Light Weapons Complex in Elena's Fortune.The ship goes to the station but not docking and then moved to second target Photon Pulse Canon Forge :? :? :? :?
I restart the proces several times and it is same thing.
Last edited by Idea on Sun, 18. Jan 09, 02:33, edited 1 time in total.

User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Sun, 18. Jan 09, 02:28

Yeh that's a bug in the find station command at the moment, I'm trying to find a work around at the moments... Well not a bug.. but an undesirable feature...

For the moment I'm going to stop using the find nearest and post on dev net. about it, and then Ill try it again.

User avatar
Idea
Posts: 516
Joined: Fri, 24. Oct 08, 12:14
x4

Post by Idea » Sun, 18. Jan 09, 02:57

I must pull my statement back
I accidentally increased the price for buying wares in station and my EST fill it up.That probably trigger the ship to go back.I will reduce it ageen Embarassed
The reason is because the ship is returning to homebase irrelevant to the stations supplyes.I check.The ship is going back to homebase in moments after the ship enter the sector.It do not buy just enter the sector and turn back to homebase.That is in the case when target is station which have goods which are needed to the homebase.
One issue:Is script allows more than one station manager for a one station?
Second issue:The ship target Solar Power Plant in Bala Gi's Joy to buy energy cells for 12 credits even when in homesector(Argone Prime) i have my one Solar Power Plant with energy cells at price 12.Only difference is the one in Bala Gi's Joy has more energy cells.Is that how suposed to be.
Edit'Ageen ship turn back to his homebase immediately when enter the sector Bala Gi's Joy and didn't buy anything ageen.
That is all from me tonight.I am going to sleep.

Post Reply

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