[Script] Autotransfer Alternative and Station Profit Monitoring v1.23 7-3-06

The place to discuss scripting and game modifications for X³: Reunion.

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

fortysix2nz
Posts: 84
Joined: Wed, 3. Dec 03, 09:48
x3

[Script] Autotransfer Alternative and Station Profit Monitoring v1.23 7-3-06

Post by fortysix2nz » Thu, 2. Feb 06, 12:07

This piece of scripting has two functions. The first is an autotransfer credits alternative to run on your stations. I've released this before but now I've gotten rid of some bugs and am making it v1.0. The second is a profit monitoring tool, which outputs to a txt file that can be imported into a spreadsheet (or the like) and displayed nice and graphically. Full descriptions below.

1) Autotransfer Alternative 1.2:

This handy function replaces the built in "Autotransfer Credits to Player" station command with "Autotransfer Credits". This functions the same as the official script except it keeps a record of how much credits have been transfered. Using the "Request Update" station command, a readout of the stations total credits made and credit making rate is made to the players logbook.

For example:
EXAMPLE COMING SOON

I like this script because I can keep track of which stations are pulling their weight and which are languishing behind. The script remembers how many credits have been made and how long the script has run for, even if deactivated, thus allowing top ups to be made.

IMPORTANT (fixed in v1.2 but still applicable): Top ups cause problems. Because the only way in which the script can monitor the amount of credits the station has made by keeping track of the amount of credits transfered to player, it will not be able to tell the difference between credits you have added and credits it has made. Thus transfereing 1 trillion credits with a credit limit of 100k will give you quite a large spike in the stations profits!!! (Yes I realise 1 trillion credits can't be obtained in this game easily. Shame on you for picking that up!)

The best way I have for topping up stations is switching temporarily to the official transfer credits until you're willing to leave the station alone. This includes new stations, wait till they're trading independently before using this script.

2) Profit Monitoring 1.0

This is quite a simple tool. It requires you to be running Autotransfer Alternative to work. Choose Monitor Station in the station commands to activate. You will be asked for a 5-digit number for the log file name and how many minutes between updates. I like 5 minutes.

The script will make sure you have not duplicated log book entries between stations, and if so will not run and leave a message in the log book with details of the station using that particular log file. At this stage, you can only use a log number once for ever, until I can figure out a (elegant) way around it. You can deactivate the script on a station and then activate the script on the same station, and this will accept the same log entry as previously used on the station.

The output file is located in the X3 directory on your computer in a file named logXXXXX.txt, where XXXXX is the 5-digit number choosen for that station. The file consists of two headings and two columns of data. The left column is the time in minutes while the right column is the credits made. The columns are seperated by comma delimiters. Below is an example:

COMING SOON

I'll check tomorrow how to load the data in to Excell, I think you choose import data somewhere. In OpenOffice, open up Calc and then go FILE - OPEN and choose the file type as Text CSV (*.csv, *.txt) and choose comma delimiters from the options.

I'm not going to go into how to display the data, unless I'm begged to. Pretty standard method for plotting graphs. In either Excell or Calc, choose scatter graph with lines, not line graph. I will say however, to display the "run-rate" (think cricket) which is total credits / total time, start in row 1 and do something like:

=B1 / A1

then fill it down to bottom.

And lastly, here are links to the scripts. I recommend Cycrows installer because I'm liable to decide its all wrong and needs a complete overhaul, and it'll make life easier for everyone. But I include a zip and a rar anyways.

Updated Links
Autotransfer and Profit Monitor Package v1.23 SPK
Autotransfer and Profit Monitor v1.2 RAR - Currently out of service (due to extreme laziness
Autotransfer and Profit Monitor v1.23 ZIP

Note: Autoupdate not working

Update Notes:
v1.23

- Actually fixed the problems. Finally.

v1.22

- Fixed conflict with DDRS, added no functionality so don't update if you don't have a problem

v1.2
- New option to set lower credit limit for station. If station goes below this threshold, credits are deducted from the players account and recorded as a negative transfer by the script. If you enter null for this value, then no lower limit is set. This feature enables you to transfer credits to the station and have it recorded correctly.

v1.1
- Fixed a wrong commenting out of code which left the script writing to the log book rather than log file when station monitoring was on.

v1.0
- Initial release


NB:

I have included extra scripts for removing or starting the autotransfer script for every station. They so far must be run from the script menu. Ask me if you need a better interface. The scripts are:

JR.StartAuto.AllStations :- Will start script in every player owned station with the same initial values as set when running the script

JR.CancelAuto.AllStations :- Will stop script in every player owned station and start the original transfer script (official) with choosen initial value. Second input is for a number, if 1 is entered, then the script will also set the local variables used (importantly the variables holding the time run for and the total credits saved) to null, thus if scipt is run again, it will start from 0,0.


Planned Updates:

- Stuff I'm asked for. Please ask. I want to feel needed :wink:


STATION COMMANDS USED: 41,42,43
TEXT FILE USED: 7700
Last edited by fortysix2nz on Tue, 7. Mar 06, 09:57, edited 12 times in total.

fortysix2nz
Posts: 84
Joined: Wed, 3. Dec 03, 09:48
x3

Post by fortysix2nz » Thu, 2. Feb 06, 12:10

Here are two graphs I prepared earlier. As links so they don'y fill up your screen. only like 8kB each. These are from my Solar Power Complex in a :wink: :wink: sector

Profit Rate
Profits

User avatar
Stevio
Posts: 2271
Joined: Sat, 4. Jun 05, 10:36
x3tc

Post by Stevio » Thu, 2. Feb 06, 13:26


Elibriz
Posts: 5
Joined: Sat, 3. Dec 05, 18:30
x3

Post by Elibriz » Thu, 2. Feb 06, 16:39

that's a good idea you had, especially the first one, that tells you how much each station has transferred to your account. allows you to filter out the lazy stations, without quitting X3.

downloading it right now

fortysix2nz
Posts: 84
Joined: Wed, 3. Dec 03, 09:48
x3

Post by fortysix2nz » Thu, 2. Feb 06, 21:51

Fixed the RAR and ZIP links. Was getting late last night and couldn't be bothered checking them properly. Hope its working alright for anyone that has downloaded it. I included a bunch of scripts with it, most are not really necessary, they're helpful if people run into troubles and I need to give a hand. If you use Cycrow's installer, a couple of scripts are marked as "shared". Unless I release any other scripts, just ignore, you're safe to remove. Its just that a few of my scripts could end up using those.

Its a shame stations cannot really run into the red, that would give the graphing side a bit more of a reason to exist. But it is fun anyway

djssuk
Posts: 183
Joined: Thu, 11. Dec 03, 21:43
x3tc

Post by djssuk » Fri, 3. Feb 06, 11:33

An idea regarding the autotransfer.

How about a global command to set all stations t the same transfer amount. for instance, if you have 70 stations but only have a handful where the auto amount for transfer would be different, then this would help. You would set them all globally and then amend the handful instead of setting each one manually (and often duplicating).

Or, how about global for all stations of the same type. For instance, if you do the command on a SOlar Plant, the option to 'Set for all Solar Plants'.

fortysix2nz
Posts: 84
Joined: Wed, 3. Dec 03, 09:48
x3

Post by fortysix2nz » Sat, 4. Feb 06, 00:59

I included a scipt to do that, but can't remember which one. It'll set this autotransfer to every station you own. It might be called JR.StartAuto or something. I am not at my computer for a few days so I can't be specific. If you are happy deciphering scripts, you could check to see if its there

djssuk
Posts: 183
Joined: Thu, 11. Dec 03, 21:43
x3tc

Post by djssuk » Sat, 4. Feb 06, 18:32

Thanks

I probably will if time (wife) permits.

Anyway, another thought.

How about minimum transfer... so if my station drops below 20k, it will dip into my deep pockets for a handout automatically, deducting this from the profit sheet?

Thanks and keep up the good work.

fortysix2nz
Posts: 84
Joined: Wed, 3. Dec 03, 09:48
x3

Post by fortysix2nz » Mon, 6. Feb 06, 10:46

Yup. Back from holiday.

Good idea, will put that 'dip into' one in. How would you want it done? I can either turn the Print Report or whatever it is into a multi-option selection so you'd say choose 1 for Print, 2 to set lower cap, 3 etc for anything else I think of, or I can have a seperate option for it so there would be three commands in the station menu for this script (not ideal cause there's only a limited number of station commands for scripts) or, I could make it an option when you set the script running on a station, so you'd have to select max and min amount for the station to hold, or lastly I could have a hardwired lower bound.

Sorry for the lack of formatting, but anyone prefer any in particular?

I was also thinking of making a command to add credits to a station that would mark itself on the total amount saved. Would be more cumbersome but would do the job.

Anyways, will get onto it tomorrow sometime. To tired now. Also, in my haste I forgot to mention that I updated to v1.1 cause v1.0 wasn't writing to a logfile, it was writing to a logbook for the Monitor command. Whoops :oops:

fortysix2nz
Posts: 84
Joined: Wed, 3. Dec 03, 09:48
x3

Post by fortysix2nz » Tue, 7. Feb 06, 09:01

UPDATE

v1.2

New option to set lower credit limit for station. If station goes below this threshold, credits are deducted from the players account and recorded as a negative transfer by the script. If you enter null for this value, then no lower limit is set. This feature enables you to transfer credits to the station and have it recorded correctly.

djssuk
Posts: 183
Joined: Thu, 11. Dec 03, 21:43
x3tc

Post by djssuk » Wed, 8. Feb 06, 19:41

thanks fortysix2nz

Sorry for not responding to your question. However, your final solution seems good to me.

I did just have q uick test and couldn't get the minimum amount input. It seems when i run the command it asks for the 'high' amount but at no point asks for th e'low' amount.

I have not tried rerunning the script though, so it may be that. Any other ideas or thoughts?

Keep up the good work.

fortysix2nz
Posts: 84
Joined: Wed, 3. Dec 03, 09:48
x3

Post by fortysix2nz » Wed, 8. Feb 06, 20:40

Hey, you may need to go into the script editor and schoose to Reinit Scripts or whatever the option is. I thought it would've reinit when you reloaded X3, shows what I know. Which version did you try? RAR, ZIP, SPK?

Cycrow
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 22227
Joined: Sun, 14. Nov 04, 23:26
x4

Post by Cycrow » Wed, 8. Feb 06, 20:52

scripts get reinit when ever you load a saved game ;)

loading a game is better than reinit caches

fortysix2nz
Posts: 84
Joined: Wed, 3. Dec 03, 09:48
x3

Post by fortysix2nz » Thu, 9. Feb 06, 06:00

Was it the ZIP file you downloaded? Looks like when I updated it it didn't actually update. The file up now should be right

djssuk
Posts: 183
Joined: Thu, 11. Dec 03, 21:43
x3tc

Post by djssuk » Fri, 10. Feb 06, 13:39

It was the .SPK.

However, I will try the ZIP version.

Thanks for the update.

fortysix2nz
Posts: 84
Joined: Wed, 3. Dec 03, 09:48
x3

Post by fortysix2nz » Fri, 10. Feb 06, 23:24

Weird, I use the SPK myself, and it works fine. You downloaded v1.2. If you go to the scripts directory and doubleclick on JR.AutoMoneyTransfer.xml the top should read:

Script JR.AutoMoneyTransfer
Version: 2
for Script Engine Version: 31
Description
Autotransfers credits to player, keps record of credits transfered
Arguments

* 1: UpperCap , Number , 'Transfer at:'
* 2: LowerCap , Number , 'Lower credit cap:'

Did ZIP work?

djssuk
Posts: 183
Joined: Thu, 11. Dec 03, 21:43
x3tc

Post by djssuk » Sun, 12. Feb 06, 14:22

Yep, I have that version as above.

Just tried again and I only get one screen asking or upper limit. Tried on many station types.

I think it would be useful if someone else had a quick test as it may be my game which is corrupt (I use over 20 other scripts).

Still, I do hope to get it working when I next reinstall :)

Mailo
Posts: 1901
Joined: Wed, 5. May 04, 01:10
x3

Post by Mailo » Sun, 12. Feb 06, 14:43

How did I miss this the whole time? THANK YOU, this is something that is sorely missed in the original game. No idea why this feature was taken out of the trade software MK3.

fortysix2nz
Posts: 84
Joined: Wed, 3. Dec 03, 09:48
x3

Post by fortysix2nz » Sun, 12. Feb 06, 20:35

@djssuk

the line-
* 2: LowerCap , Number , 'Lower credit cap:'

should ensure you get asked for a lower cap. Since its an argument. I really don't know what is wrong if you have the line on the script you downloaded. PM me if you want and I'll give you an email address you can send a save too.

@Mailo

Cheers. I felt the same and it worked out to be a good first script for me to write.

cragganmore
Posts: 19
Joined: Sat, 12. Nov 05, 05:54
x3

Post by cragganmore » Sun, 5. Mar 06, 08:07

Hi fortysix2nz,

I'm running into an odd issue when running DDRS at the same time as your Autotransfer Alternative and Station Profit Monitoring v1.2, and I wanted to see if you'd heard of this happening before.

Whenever I try to assign a station a new command (Station->"Command Console"->Add a new command), in the list of available commands a couple of your commands are replaced with DDRS commands. Specifically, the "Autotransfer Credits [AutoT.St]" command is replaced by "Build Ship [BuSh]" and the "Request Update [AutoT.Pr]" command is replaced by "Remodel Ship [ReSh]" If I do a "Reinit Script Caches," everything is fine (the DDRS scripts disappear and yours appear in the correct location). But I have to reinit the cache every time I run the game (the fix isn't persistent).

Are you aware of any way to fix this? I can't remove the DDRS mod, as all my current save games are using this mod. And I'd really like to use your scripts - they add so much value to my play!

Thanks for any input.

Post Reply

Return to “X³: Reunion - Scripts and Modding”