[SCRIPT] UTProfit (v 1.0 28-04-09)

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

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 10032
Joined: Sun, 15. Feb 04, 21:12

[SCRIPT] UTProfit (v 1.0 28-04-09)

Post by euclid » Fri, 24. Apr 09, 18:38

What it does:

A trader utility script for those of you who run lots of MK3 traders. Thanks
to the new menue features it's a bit more comfortable than the X3R version.

Just execute it from your ship to get a list of all your MK3 traders, then
click on any in the list to get the overall profit. Hit Esc to get back to the
list and select another of your traders or hit Esc again to quit the script.


Installation:

Copy the 7006-L044.xml into you t folder, copy the setup.UTProfit.xml and the
UTProfit.xml into your scripts folder.


Resources:

It uses trade command 41, t-file 7006 with pid 2010 (tid 441) and (also in
the 7006 file) pid 9900 (tids 01-03).


Where to get it?

Updated version 1.0: local trader added, info on current sector and status added.


Image

(Big THANKS to all that helped to sort the URL out, in particular to Giskard
who finally solved the puzzle).


Example

Execute UTProfit from the trade menue of your ship to get
Image

then select one MK3 trader and click to get further details like this
Image


Feedback

Please don't hesitate to post any feedback. I'm currently improving the info and have added trader's current location (the sector he's in atm) and the trader's status (local, sector or universe trader). Any other useful info to be added?





Hope you will find it useful.


Cheers Euclid

Edit: images added.E.
Edit2: version 1.0 info added.E.
Edit3: tested with X3:TC and AP - works just fine; even no need to activate SE. Just install as instructed and use it. E.
Last edited by euclid on Wed, 9. Jan 13, 20:06, edited 8 times in total.
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

Scoob
Posts: 5587
Joined: Thu, 27. Feb 03, 23:28

Post by Scoob » Fri, 24. Apr 09, 20:38

Hi,

Useful script!

Have downloaded and will try later...

Cheers,

Scoob.

User avatar
arcana75
Posts: 2158
Joined: Tue, 2. Dec 03, 10:28

Post by arcana75 » Tue, 28. Apr 09, 14:23

Hi, need help with this install.

I have the 2 files in scripts folder and 1 file in t folder, and run the trade command Profit.

But the result is a blank window with an Info word on the top right. Hitting ESC gives me a new window saying:

Trader: Unknown Object
ship: null
profit: 0

Any suggestions?

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 10032
Joined: Sun, 15. Feb 04, 21:12

Post by euclid » Tue, 28. Apr 09, 15:03

It should happen only if you don't have any MK3 trader. How many MK3 trader do you have?

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

User avatar
arcana75
Posts: 2158
Joined: Tue, 2. Dec 03, 10:28

Post by arcana75 » Tue, 28. Apr 09, 15:19

6, all ST traders but all >L8 and all are currently running ST when the command is fired.

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 10032
Joined: Sun, 15. Feb 04, 21:12

Post by euclid » Tue, 28. Apr 09, 15:23

Could you please check which script is running on any of them? To do that enable additional script info in the SE and then find one of your STs and get the ship's info, scroll down and you should see all scripts running on that ship.

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

User avatar
arcana75
Posts: 2158
Joined: Tue, 2. Dec 03, 10:28

Post by arcana75 » Tue, 28. Apr 09, 15:49

I wrote to my logbook the array size in your original script. Start was 25 ships. After scanning thru *.galaxy and *.sector the value is 0.

I did a hack job:

Code: Select all

$ships =  get ship array: of race Player class/type=Moveable Ship
002   $nships =  size of array $ships
003   while $nships
004   |dec $nships = 
005   |$ut = $ships[$nships]
006   |$gain = $ut -> get local variable: name='Gain'
007   |if $gain > 0
008   ||$sgain =  convert number $gain to string
009   ||$pilot = $ut -> get pilot name
010   ||write to player logbook: printf: pageid=9900 textid=4, $pilot, $ut, $sgain, null, null
011   |end
012   end
013   return null
It was able to print into my log showing all my STs' name, ship and profit.

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 10032
Joined: Sun, 15. Feb 04, 21:12

Post by euclid » Tue, 28. Apr 09, 16:22

That's very odd. Every MK3 trader should have either plugin.autotrade.sector (sector trader) or plugin.autotrade.galaxy (universe trader) running.

Please check which scripts are running on any of your traders. Can you see either of the above?

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

User avatar
arcana75
Posts: 2158
Joined: Tue, 2. Dec 03, 10:28

Post by arcana75 » Tue, 28. Apr 09, 16:28

plugin.autotrade.local and plugin.autotrade.local.start

8)

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 10032
Joined: Sun, 15. Feb 04, 21:12

Post by euclid » Tue, 28. Apr 09, 16:50

Thanks :-)

Okey, there are 3 types of MK3 traders: local, sector and universe. Atm UTProfit covers only the last two. I will upload a new version that adds the local trader.

Any further info that I should add to the info screen (see first post)?


Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 10032
Joined: Sun, 15. Feb 04, 21:12

Post by euclid » Tue, 28. Apr 09, 17:21

New version uploaded. Please try this one arcana75 and thanks again for the feedback :thumb_up:

Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

User avatar
arcana75
Posts: 2158
Joined: Tue, 2. Dec 03, 10:28

Post by arcana75 » Tue, 28. Apr 09, 17:44

Thanks for the fix! I'll try it out tomorrow as it's abit late here.

What's the diff between local and sector trader? FWIW my STs run Sector Trader with 3 Jumps.

As for info, I dunno if the data is available but the following would be nice to have:

- Total runtime (good for benchmarking)
- Current load (eg e-cells) or maybe current command (eg buy ware best price... e-cells)

A suggestion not sure if possible, maybe divide the MK3 Trader list in the menu to Universe, Sector and Local traders? Then in the individual trader display there is no need to display "trader status" and it's a quicker way to sort out a player's traders.

User avatar
ScRaT_GER
Posts: 1958
Joined: Tue, 8. Jan 08, 19:19

Post by ScRaT_GER » Tue, 28. Apr 09, 19:00

I would add the sector the trader is in and his id code to the main menu.
So entries like this would be generated:

Argon Prime: Mistral UT 13 (YRKS-23)

Would give a better overview, in my opinion.

It would also be interesting to see, how the numbers my script 'Trade Overview' gets, differ from the numbers your script gets directly from the merchants.
I think I'll have to check that. =)

Greets,
ScRaT

User avatar
euclid
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 10032
Joined: Sun, 15. Feb 04, 21:12

Post by euclid » Wed, 6. May 09, 12:16

arcana75 wrote: .........What's the diff between local and sector trader? FWIW my STs run Sector Trader with 3 Jumps.
I think if you restart a sector trader of level +8 it requires a max jump range and that makes him a local trader.
arcana75 wrote: ......As for info, I dunno if the data is available but the following would be nice to have:

- Total runtime (good for benchmarking)
- Current load (eg e-cells) or maybe current command (eg buy ware best price... e-cells)
.........
The script is very simple and accesses the already available local variable $Gain. The total runtime is not recorded and would require additional variables. It's also tricky because the player may decide to stop his trader for a while which is next to impossible to detect via scripting. However, the current load/command is easy to add.

Thanks for the feedback.


Cheers Euclid
"In any special doctrine of nature there can be only as much proper science as there is mathematics therein.”
- Immanuel Kant (1724-1804), Metaphysical Foundations of the Science of Nature, 4:470, 1786

Ezuku
Posts: 140
Joined: Sat, 21. Jan 06, 01:31

Post by Ezuku » Wed, 20. May 09, 06:32

Looks cool, haven't tried it out yet (no UTs in my current game), but I think you could improve it by having a profit / hour display, overall profit isn't nearly as important.

Post Reply

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