[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
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent » Fri, 16. Jan 09, 14:48

reuploaded

No mucking about with anything, just copy them over, and reload your game.

elayeth
Posts: 136
Joined: Fri, 11. Apr 08, 17:16

Post by elayeth » Fri, 16. Jan 09, 14:56

Like a month ago I asked for some statistics script. Nobody knew one back then. I am happy that there is something done around. Thanks!
Is it also possible to apply this kind of scripto onto UTs?
The true sign of intelligence is not knowledge but imagination.

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

Post by s9ilent » Fri, 16. Jan 09, 15:02

Re: Ut's
Probably. Although, from the amount of effort it makes for the same effect, you may as well just change the UT's homebase to the station running the financial recording.

I don't particularly want to write ANOTHER overwatch script for UT's as they are already fairly computer intensive, and the more comprehensive option would require replacing stock scripts, which requires a mod (or the mod manager? -haven't tested with !xxxx.xml scripts)


So.. yeh, homebase, station. Awesomeness
I homebase all of mine, simply to hide them from in the properties window (With homebase display = no).

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

Post by Idea » Fri, 16. Jan 09, 15:11

I reloaded it and everything looks all right :D

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

Post by s9ilent » Fri, 16. Jan 09, 23:20

I don't suppose any one wants to help debug/test the station financial manager?

Req: You need to know how to use the script editor, probably the message log or incoming messages or stuff like that.
I stuck in waits, pretty much everywhere I could think of so... it shouldn't kill the computer (I hope)

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

Post by Idea » Sat, 17. Jan 09, 09:08

I could but I have one exam from mat today and day after tomorrow another one from economic mat.I could try it tonight if I have free time.If I don't try tonight then for two or three days.I can not do better than that.
I know to open scipt editor,I know to make some simple scripts but I am in lower lige than you.Is that enough for this job?
Last edited by Idea on Sat, 17. Jan 09, 09:10, edited 1 time in total.

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

Post by s9ilent » Sat, 17. Jan 09, 09:10

Its ok :)

Conc. on your exams and GL.


I'm almost done with making a proto type. I finally moved all the text into the tfile.. (Huge pain.....) now all I have to do is cross my fingers, and hope the loop works

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

Post by Idea » Sat, 17. Jan 09, 09:13

I will hold my my fingers cross for you and ME :D
Catch you later.Bay

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

Post by s9ilent » Sat, 17. Jan 09, 15:54

*Laaaaaa-A Golden ray of light shines down with the sounds of angelic sirens*


I've managed to debug it enough, so it worked :O:):D
It did its first trade run! At an astounding 16 sectors away, it found the target and traded. (And it seems to be working properly, as initially 16 sectors was to far away until I bumped up the energy, and that was ok, so yeh, perfect!)
Spoiler
Show
*notes to others don't set up adv sat facts in omicron lyrae... majaglit... is far far away...*
Although its still a ways from being finished, its now at a fairly stable proto type (filed with message logs thou...)

And the generic search flags are working better then expected, they only return sensible results (eg. Known stations, non enemy stations, etc). And due to the fact that I've made this script jump drive orientated, I can just forget about "safe path finding" astar and that stuff.

Any way, theres a boatload of changes and i can't be bothered to upload my post atm. But considering its day 2 and its working (just) already, I'd hope it'd be fully functional with all the tid bits by tommorow

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

Post by Idea » Sat, 17. Jan 09, 17:19

Man you are like a robot.From my point of view you gona relese two BIG SCRIPTS in 4 days.
So you said it work.It looks like that fingers cross worked :D
I must go on exem now :(
FINGERS CROSS
Wish me luck :D

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:

Post Reply

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