[SCR] Station Financial Manager Mk2
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
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.
(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.
[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
This might help, it has a list of all the local/global variables
And... the priority calculations
and other misc junk
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.
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.
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)
, 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)
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)
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)
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
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
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 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
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 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.
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...
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...
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..
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..
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...
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...
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.
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.
I must pull my statement back
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.
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.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
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.