[SCR] Station Financial Manager Mk2

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

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

Post Reply
User avatar
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45

[SCR] Station Financial Manager Mk2

Post by s9ilent » Wed, 14. Jan 09, 16:57

Station Financial Manager
Mk 2 Version 2
Feel free to give feed back.
No really.. FEEDback ME!!!

Station Financial Manager MK 2
  • Much like the Station Manager (SM) from X3R and X2, the SFM is capable of controlling and directing all your transporters. The main improvement over the SM, is the capability to use the jump drive. You can also individually configure each ship to not trade certain wares, or to have a custom distance
The short and fast of what this script does is:
  • Auto deposit and withdraw money for stations
  • Station Manager like actions (buy and sells wares)
  • Records financial data and generates reports
  • Limited ship renaming ability
  • Uses jump drives
  • Automate Assist Features
Updated: 20/06/2011
Station Financial Manager

http://members.optuszoo.com.au/whyistha ... fm_mk2.rar

Station Financial Manager

http://members.optuszoo.com.au/whyistha ... fm_mk2.zip
(The rar is smaller, and unpacks quicker, so is generally more awesome)

Station Financial Manager

http://members.optuszoo.com.au/whyistha ... fm_mk2.spk
(SPK's are just generally awesomecake)

Graphical Tutorial Click the picture
Feed back on the tutorial would also be much appreciated
Note, this is the mk1 tutorial, I have yet to make the MK 2 tutorial

Cost: Free installation. 0.5% commission for all transactions, +7.5% on transactions at premium levels (see bottom for deatils) (Works out to be about ~1-2% of profits)
Requires Trade Com. Soft. Mk II
Recommended Navigation Com. Soft. Mk I, Jump Drive

To Install, Unzip to your X3 folder, e.g. C:\Program Files\EGOSOFT\X3 Terran Conflict

If you are upgrading from SFM Mk 1 to SFM Mk 2.
1. Stop SFM Mk 1 from the universal commands menu
2. Go into the ship command menu, and open up the script editor
3. Check the global tasks, make sure that SFM is really stoped, if it isn't then highlight it, and press delete and end task it
4. Now you can install SFM Mk 2.
5. Enjoy


Financial Services
  • The SFM system can monitor the credit levels in your station, as well as record all financial data and provide reports and statistics
Station Automation Assist Features
  • Global Price settings
  • Global Trader Settings
  • Automatically blacklist sectors with enemy ships of your choosing
  • Exclude Sectors, by sector and by race
  • Default Jump range
  • Dock ware control (add, remove, set max)
Advanced Trader Features
  • Excluded Wares
  • Custom Jump Distances
  • Ship equipment (e.g. Fighter Drones)
  • Toggle ignoring blacklisted/excluded sectors
    And of course, Generally smart trade AI
Jump Drive usage
  • With the advent of the jump drive, there is nothing stopping you from trading from all corners of the Commonwealth (Or Empire if your LV)
  • Your ships need a Jump Drive, and Navigational Command Software Mk I
  • Your ship must have auto jump on
Limited Auto Ship re-naming ability
  • If you've added a ship, and its name is still the default one (Your .....) then it renames it for you to "## SHIPTYPE STATION" eg 1 Mercury Miner Mysuperdoopermine'sname. Not the robust naming feature in the world.. nor the prettiest but hey, this is designed for making money, and plaques charge my the letter!

Cost: Commissions explained
I've set it such that you can't loose money at average levels.
  • By transaction, I mean when money physically changed hands. So you don't get charged when dropping of goods at your home base. However, you WILL be charged if trading with other stations owned by you.
What if I can't afford the commissions?
  • Then the ship will continue, but keep taking money until its been paid in full, it will take funds off the home base, and from your main account.

How much do I get charged?
  • First up, a quick definition. Premium: Below average price when buying OR above average when selling
    0.5% Average Commission Charge
    7.5% Premium Commission Charge

Out of the money commissions
  • As said above, your charged a 0.5% / 7.5% commission on all transactions. So if you bought 100 Crystals (with average price 1684) at or above 1684 credits each. You will be charged 0.5% of 100*1684. i.e. 0.5%*1684=842
  • Similarly, if selling 100 Crystals, at 1684 or below, you will be charged 0.5% * 100 * 1684 = 842
In the money commissions
  • If you bought 100 Crystals (with average price 1684) at 1600 credits each. You will be charged 1% of 100*1684 PLUS 7.5% of (1684 - 1600) * 100
    0.5% * 100*1684 + 7.5% * 84 * 100 = 842 + 630 = 1472
  • Similarly, if your selling 100 Crystals, at 1700, you will be charged 0.5% * 100 * 1684 PLUS 7.5% of 100 * (1700-1684)
    0.5% * 100*1684 + 7.5% * 100 * 16 = 842 + 120 = 962

So at a minimum, the trader earns 0.5% of the average transaction, and for every 100 credits at premium level, they takes 7.5 of those, and gives you 92.5.

Technical Tidbits
  • PageID 7740 7741
    Text 7740 7741
Last edited by s9ilent on Sun, 19. Jun 11, 23:52, edited 149 times in total.

User avatar
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45

Post by s9ilent » Wed, 14. Jan 09, 16:58

To Do list
"Global" traders

Sort ware lists

Implement desired stock levels (buy when below, sell when above)

Centralize Findware task.

Try out the new menu system used in the 2.... 5? 2.5? (beta)
Adapt existing menus to it

Replace destroyed ship/Ship template

Add in more complex ware inclusion/exclusion
e.g. Trade only Tech goods, excluding xyz. or Trade only food goods, including xyz, excluding xyz

Recent Changes
Apparently the excluded sectors feature was not scripted in.. (at all?!) so I've fixed that up

Same fix as the 23rd, exception applies to SFM running on non stations. (i.e. docks hq's etc.)

Fixed critical show stopping bug in the futuremax script. (Adding ware.future, outside of the if instead of inside, resulting in int->string, and other consequences)
Last edited by s9ilent on Sun, 19. Jun 11, 23:53, edited 48 times in total.

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

Post by Idea » Wed, 14. Jan 09, 17:01

downloading now :D :D :D :D :D :D :D :D

Posts: 25
Joined: Sat, 6. Dec 08, 05:13

Post by madpainter » Thu, 15. Jan 09, 00:23

On first impressions it seems to work ok for the first setup but seems to reject the command when you edit a setup unless you use the stop command and start fresh.
I don't think this is a huge issue as other than that it seems to work fine.
I like the way you can set a stations lower limit very useful :wink:

EDIT-----If you change your settings on a new command slot the original command will adopt the new settings and remain in action, not totally user friendly but absolutely functional, now to clock up a few hours play and see how the useful the reports are.
so far I'm impressed, nice script :)

User avatar
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45

Post by s9ilent » Thu, 15. Jan 09, 03:24

Ok v2 is released

1) No longer "hides" command when running it on top of it self
2) Automatic command restarting. Once installed, this script has taken the command slot for life!!! (or until you uninstall it)
Every 60 seconds (ie, when it banks), or every time you open and close another menu, it will set the command slot back to what it was.
(And obviously, it only uses 1 command slot at a time)
3) Auto deliminates, eg 123456 -> 123,456
4) Now auto colours all credit values properly (green>0, red<0, yellow =0)

5) Decreased the waiting time on generating reports. But it should still take about half a second to bring up a report per station. (more or less depending on the stations current recorded service life)

6) Auto patcher. If you where running and older version, on the next start up, it will restart the command on all stations.
This patcher is doing the auto command restarting thing.

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

Post by Idea » Thu, 15. Jan 09, 10:56

I have a problem.I works but it do not show me
Average profit/loss per hour
Average profit (only) per hour
Number of profit (only) hours
Average loss (only) per hour
Number of loss (only) hours
It only shows 0 all the time.I instaled the new version 2.
One question, is script monitoring my ships that dock on my station and take goods as profit gain?
Regardless I loved the script.Now I can monitor my gains/losses.
I must say one more time.Thanks s9ilent :D

User avatar
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45

Post by s9ilent » Thu, 15. Jan 09, 11:38

The script has to record a full hours worth of data before it can show non 0 figures in the report (for most of the items, if not all)

And no it doesn't monitor when ships dock and trade etc. It only monitors the auto deposit/withdraw.

Out of curiosity, which ones does it show you? (All of the rest?)
From what your saying, I'm guessing that you current recorded life is less then 1 hour. (i.e. 0 hours)
And the av proffit per hour is just total proffit / hours (and of course, if you divide by 0 you get infinity, so I made it give you 0 proffit/hour if you had 0 hours)

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

Post by Idea » Thu, 15. Jan 09, 12:18

I fixed it now.Thanks

User avatar
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45

Post by s9ilent » Thu, 15. Jan 09, 12:53

Wait, you fixed it?? I found a bug in it? how did you fix it?

073 |||[THIS] -> set local variable: name=$d1 value=$d1
That line should've been (x2)
073 |||[THIS] -> set local variable: name=$scr.var.d1 value=$d1

I also found another bug in that script :S, I put the is credit valid check after the data saving, so it might save, then invalidate the data...

If you where running V2 previously, then the auto patch will:
1. On game load, pop up a window
2. Disable the script on all stations
3. Wait 75 seconds
4. Restart the script everywhere (saving all your configs, but reseting the data, although I dont think there should've been any yet, considering the severity of the typo in v1/v2...)
5. Your not at v3

If you where running v1, then the auto patch will silently patch to v2, then do the same as above, and patch to v3.

If this is your first install, then it will work fine right away. (And you'll be at v3)

*edit* Ok re-uploaded, and it works now. (I did a proper debug test this time, accelerated its time to 10ms, then saw it make the data. It makes the data, the data is pretty, and it works fine afaik)
Last time I just created an object with pre-set random data (as opposed to generated by actually sitting there waiting and making the scripts them selves make it). Oh well, a lesson for the future I guess.

*ick... this is possibly.. one of my worst scripts thou... My failed context sensitive script was pretty bad considering it didn't work and had hugely spaghetii code (but I did fix the spag by the end, but it still didn't work)... But this should've been avoidable!
Note to self, if i EVER write a command again. ALWAYS run loops on 100+, and ALWAYS include a .running, and .version variable for easy termination and patching! (probably in an array, and make sure you make the array contain ALL possible future values.. as updating an array is finicky)
(The v1 and v2 fixes where simply 1 liners... but I had to write 200 codes just to make an auto patcher!!!)

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

Post by Idea » Thu, 15. Jan 09, 14:26

I must correct my self.I didn't fix it.I just reinstale it and exspect to fix it self.
I believed that you are correct and that i was wrong.Sorry for disinformation.
I am update it to v3
I report if something pops up.Again I apologize for my mistake :oops:

Don't be so hard on your self.I like the script and his features.

User avatar
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45

Post by s9ilent » Thu, 15. Jan 09, 14:37

Out of curiosity, how many people so far are running the script?

I don't have enough time today... but I really want to re-write it. As right now its a little bit messy with variables (amongst other things), and I was really hopping to submit this script for possible bonus packing (but DEFIANTLY not in its current state...)

If I do re-write it, I should be able to include a command restarted too. It should be able to keep all the information you have so far.

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

Post by Idea » Thu, 15. Jan 09, 20:48

One issue:I have two Solar Plants.Reports say for one that it have profit(green) but for other say loss (red).Now i dont undersdand how is that possible.I use script lazcorp_crystal_free_spp_v1_01 so both stations should have profit (green).Lower limite(10000) and upper limite(50000) are same for both stations.

User avatar
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45

Post by s9ilent » Thu, 15. Jan 09, 22:37

Grrr :S I made another mistake...

I thought I had gotten the values reversed, so I switched the sign....
Now looking at it.. I had gotten it right the first time..

As to why one was on the opposite sign then the other, I can only guess then when you first started the script, you put the lower bound higher then its current money, so it withdrew money?

Ill re-edit this post when I've re-uploaded (should only take a moment, I can just copy-paste the patcher this time)

User avatar
Posts: 313
Joined: Fri, 21. Nov 03, 18:23

Post by klaatu » Thu, 15. Jan 09, 22:37

Hey snineilent, I was looking for something like this just the other day. Didn't find your 'cause I find scripts by going to the Community Script & Mod Download Library thread and look for something there, but this script isn't listed. I see you have a couple other things there (Vocal Control and something else I think), but not this. Just a suggestion, but you might get more users by having it included there.

I'll install this tonight and give it a try. Looks good by the description. :D

User avatar
Posts: 2011
Joined: Wed, 29. Jun 05, 01:45

Post by s9ilent » Thu, 15. Jan 09, 22:47

I only finished writing it yesterday/day before, and I put it on the submission list, it just takes a few days for it to come up :)

(p.s Dont try v3, wait till v5) (as v4 will just have the hotfix. it will clear the data -again *sorry- then restart it in 75 seconds again, put it will save your config)

Ok, v4 is up. Now to re-writing for a .. Ill start at 10 probably, just so there is a clear distinction between the two.

Post Reply

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