[Script] Satilite Limited MK3 Universal Trader, ready for download.

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

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

Post Reply
Zzyn
Posts: 77
Joined: Sat, 31. Jul 04, 00:08
x3

[Script] Satilite Limited MK3 Universal Trader, ready for download.

Post by Zzyn » Wed, 14. Dec 05, 04:16

Edit: updated with .spk version

She's all done and ready to fly. I'll post you some release notes here, some technical stuff and a link. I've made some really good cash of these guys. I really luv how they are actually capable of buying fuel in all cases now(at a higher price, of course).


Description : Satilite Limited MK3 Trade Extention - limit trading area with properly named satelites in sectors where the trader is allowed to trade. Naming and UnNaming commands added. NOTE: The original MK3 trade is untouched, unchanged, and still available via the same trade menu.
Version : 1.0
Date : 12/12/2005
Author : Zzyn
Buttons added: "Satilite Limited Universal Trader," "Active Trade Beacon," "Deactivate Trade Beacon"

Download Link: SatBasedMK3.zip
UPDATE: .spk version here: SatBasedMK3.spk

Purpose: To limit the area in which the MK3 traders do their business, keeping them from buying and selling in sectors you don't want them in. Can also be used to increase specific faction by activating just the beacons in that race's sector, for instance. Many other applications.

Use: You will need satellites in any sector in which you would like your MK3 traders to trade. Once you've run a trader for a bit, the cost is really minimal. :-) Either type of satellite works fine. To activate a satellite to be used by the new trader mode, use the Activate Trade Beacon command from the trade menu, and browse to that satellite. The same applies to deactivate the satellite. *The code looks for standard named Sat's only. If you have custom named yours, you will need to manually name them. Feedback into the logbook with sound notification will occur when you attempt to name or uname an object that is not already named correctly. (e.g. 'Your Navigation Satellite' or 'Your Advanced Satellite' are eligible to have the rename command used on them. Likewise, deactivate only works on 'Trade Beacon' and 'Adv Trade Beacon.')

Scope: This script set changes the behavior of your MK3 traders (when placed in this mode) so that they only buy/sell in sectors that contain Satellites named as indicated above. The script set also updated the fuel request routines to guarantee a delivery ship big enough to carry enough to fuel for you folks with superfreighters and such. As a result the cost of this service has increased from 10% to 12.5%. (The old routine would, in some cases, try to call a harrier for fuel! That's not much fuel! If you've ever gotten the error, 'could not deliver that much fuel' you'll love this change)

Also updated the number of times a trader will attempt to find a valid buy/sell location, since their area may be far more limited than before. Buy and Sell range have been increased to 20. This is because in the original the buy range was roughly 1/4 of the sell range at each level tier. In this case, we assume that the trader is linked into *your* trade network via these beacons, and therefore is allowed to trade there.

The script will check up to 5 satellites of each type in each sector to find one with the proper name. I assume no one has more than this, and frankly if you do, I'd really like to know why in the world you did that! :-)

This is my FIRST script, so i'd really appreciate any feedback you have. I must say, I have made a LOT of money and lost zero ships since I started using it. Happy Trading!

-Zzyn


Other stuff, some it a repeat, posted below:
002 * --------------------------------------------------------
003 * Added check after buy and sell station decisions to confirm properly named sat
004 * is in sector. Increased tries significantly
005 * Routed to updated delivery routine when requesting fuel
006 * Old routine had wildly different sized posible devilery ships, casuing failure
007 * on occasion. Ships in that routine normalized and cost for delivery increased
008 * from 10 to 12.5 to acomodate.
009 * New Button in Trade Command Menu to enable 'Sat Limited Univ Trader'
010 * To be eligible a sector MUST contain a satellite of either type, but
011 * it must be named 'Trade Beacon' or 'Adv Trade Beacon' as appropriate based on
012 * type of Sat it is. The script will check up to 5 satilites of each type per
013 * sector to find a properly named target.
014 * To accomodate easy naming of the sat's, two comands have also been added
015 * to the trade menu(not linked to any ware). 'Activate Trade Beacon' and
016 * 'Deactivate Trade Beacon.' When selected you must input a target to be renamed
017 * or, 'un-named' as appropriate.
018 * As a final note, the buy range and sell range have been normalized for a trader
019 * in this mode. The buy dist is roughly 1/4 of the possible sel dist in the
020 * original script. However, When seting buy locations based on satitlites, this no
022 * longer made sense. I set them to be equal per expereience level, but did not
023 * exceed the max buy/sell distance parameters set in the original.
024 * -------------------------------------------------------------
Last edited by Zzyn on Sun, 9. Jul 06, 21:58, edited 1 time in total.

User avatar
Red Spot
Posts: 3461
Joined: Fri, 4. Feb 05, 13:44
x3

Re: [Script] Satilite Limited MK3 Universal Trader, ready for download.

Post by Red Spot » Wed, 14. Dec 05, 11:35

Zzyn wrote: *The code looks for standard named Sat's only. If you have custom named yours, you will need to manually name them. Feedback into the logbook with sound notification will occur when you attempt to name or uname an object that is not already named correctly. (e.g. 'Your Navigation Satellite' or 'Your Advanced Satellite' are eligible to have the rename command used on them. Likewise, deactivate only works on 'Trade Beacon' and 'Adv Trade Beacon.')

let me guess your script is looking for objects with 'name' ...

why not change this to look for object .. 'object class 'satelite (MK2)''

this way names dont matter .. than when found .. for instance set a local var on it ..

than when deactivating look for that local var .. and turn it 'off' ..
(maybe change the name .. anyhow the name doesnt matter for your script anymore at this point ..)


just a bit a friendly advise ..;)


G

User avatar
Birdman
Posts: 508
Joined: Sat, 10. Jan 04, 09:07
x3

Post by Birdman » Wed, 14. Dec 05, 18:26

I can understand why Zzyn did it that way. He is LIMITING the trade area, so if you have sats in most sectors, the way he did it limits the trade areas to those with the renamed sats.

As Zzyn staed, this can be useful to increase your notoriety with a specific race, as it limits your trader to that races area. :)

Myros
Posts: 176
Joined: Sat, 13. Dec 03, 00:23
x3

Post by Myros » Wed, 14. Dec 05, 18:43

Aye thats why he added the name condition, for people who want sats in many many sectors but still want to limit the trade network, its a great idea.

Quick question ... did you figure a way to get the script to check the sat status before searching for products? Otherwise it could end up stuck in a logic loop

ie search for product ... found ... oops no sat
search for product ... found same one ... oops no sat
etc

Rikaelus
Posts: 223
Joined: Tue, 29. Nov 05, 04:03
x3

Post by Rikaelus » Wed, 14. Dec 05, 19:05

Awesome! I was hoping for something like this. The Paranid seem to have a large hatred for my UTs, so this will keep them safe. Of course the challenge will now be finding enough sats to purchase for the network =P

Zzyn
Posts: 77
Joined: Sat, 31. Jul 04, 00:08
x3

Post by Zzyn » Wed, 14. Dec 05, 19:56

Red Spot wrote: let me guess your script is looking for objects with 'name' ...
why not change this to look for object .. 'object class 'satelite (MK2)''
this way names dont matter .. than when found .. for instance set a local var on it ..
Myros wrote:Aye thats why he added the name condition, for people who want sats in many many sectors but still want to limit the trade network, its a great idea.

Quick question ... did you figure a way to get the script to check the sat status before searching for products? Otherwise it could end up stuck in a logic loop

ie search for product ... found ... oops no sat
search for product ... found same one ... oops no sat
etc
The command it uses to 'find product at best price' doesn't allow input parameters like that.. Oh man if I could input a n array of sectors to that command to limit it, that'd be great. At the moment, if you have only 2 sectors 'turned on,' for instance, it would take many more 'rolls' for it to find a valid location, since I can't quantify the search area, I can only limit the accepted area. I suggest having a number of sectors activated, as having too few could cause him to be less effective.

Rather, I had to simply check for a sat after each time it said 'I think I want to buy here.' Same for sell sector.

And, no.. it doens't get in an infinite loop checking the same ineligile station over and over. It actually works quite well. :-)

As for the 'local variable' that wouldn't work unless the 'sat check routine' passed back an array of 'active sats' or something. That's just not feasible. Also, I wanted the user to be able to tell quickly which sectors were active and which ones weren't. The name does that rather effectively.

The one part I find unfortunate is that the rename command has to be executed from the ship you are in, and there is no option to add a command the to the satellite's menu, well, becuase sat's don't HAVE a command menu. I could find a way to add a command button to them at all.

Oh, the code in the original and in the mod'd one do a random roll for what type of ware to search for. This helps prevent an enending loop. Also, I upped the number of tries before he give up LIBERALLY.

It truly is very effective. I have all of the Main Argon sectors surrounding argon prime, the north line of boron sectors, the paranid sectors just under that argon section, and the boron section all the way south(barren shorers and such) all activated. I had three traders running in this mode last night and made many millions.

Thanks,
Zzyn
Last edited by Zzyn on Wed, 14. Dec 05, 20:26, edited 2 times in total.

Zzyn
Posts: 77
Joined: Sat, 31. Jul 04, 00:08
x3

Post by Zzyn » Wed, 14. Dec 05, 20:18

Sector sat check routine, for reference:

001 * Parses an array of all sats found in the sector.
002 * Returns true if one of them is named as a Trade Beacon
003 * I ASSUME that no one has more than 5 of each type of Satellite in each sector.
004 $bReturn = [FALSE]
005 $SatArraySize = 5
006 $NavSat = array alloc: size=$SatArraySize
007 $AdvSat = array alloc: size=$SatArraySize
008 $Targetstation.sector = $Targetstation -> get sector
009 $i = 0
010 $SatInSector = 0
011
012 * Check to see if Properly Named Sat is present in Station's Sector
013 $NavSat = find ship: sector=$Targetstation.sector class or type=Navigation Relay Satellite race=Player flags=[Find.Multiple] refobj=null maxdist=null maxnum=5 refpos=null
014 $AdvSat = find ship: sector=$Targetstation.sector class or type=Advanced Satellite race=Player flags=[Find.Multiple] refobj=null maxdist=null maxnum=5 refpos=null
015
016 while $i < $SatArraySize
017 $SatName = $NavSat[$i]
018 $SatName = $SatName -> get name
019 $AdvSatName = $AdvSat[$i]
020 $AdvSatName = $AdvSatName -> get name
021 if $SatName == 'Trade Beacon'
022 inc $SatInSector =
023 end
024 if $AdvSatName == 'Adv Trade Beacon'
025 inc $SatInSector =
026 end
027 inc $i =
028 end
029
030 if ( $SatInSector > 0 )
031 $bReturn = [TRUE]
032 end
033
034 return $bReturn

Zzyn
Posts: 77
Joined: Sat, 31. Jul 04, 00:08
x3

Post by Zzyn » Wed, 14. Dec 05, 20:21

Also, as far as name checking, I 'could' add a check to the beginning of this routine to make SURE that the input is a satellite and not a ship, however, if someone has a ship out there named 'your navigation satellite,' and they run this command on it, it'll rename their ship to 'trade beacon.' Not a likely circumstance, not a likely result.

:-)

Rename code below for reference:
001 $C = [FALSE]
002
003 $SatName = $ExactSat -> get name
004
005 if $SatName == 'Your Navigation Satellite'
006 $ExactSat -> set name to 'Trade Beacon'
007 $C = [TRUE]
008 end
009
010 if $SatName == 'Your Advanced Satellite'
011 $ExactSat -> set name to 'Adv Trade Beacon'
012 $C = [TRUE]
013 end
014
015 if $C == [TRUE]
016 START speak text: page=13 id=1100016 priority=1
017 else
018 START speak text: page=13 id=1357 priority=1
019 $Feedback1 = 'A Satellite must be selected and must have the name 'Your Navigation Satillite' '
020 $Feedback2 = 'or 'Your Advanced Satilite.' '
021 $Feedback3 = 'Select a properly named Satellite or rename it manually. '
022 $FinalFeedback = sprintf: fmt='%s %s Your target: %s does not qualify. %s', $Feedback1, $Feedback2, $SatName, $Feedback3, null
023 send incoming message $FinalFeedback to player: display it=[TRUE]
024 end
025 return $C

andysonofbob
Posts: 263
Joined: Sun, 23. Jan 05, 17:58
x3

Post by andysonofbob » Wed, 14. Dec 05, 20:46

Hello mate

I installed your script mainly for the UT fuel shindigs but i am still getting the poxy out of fuel msg - grrrrrrr!. Am i doing something wrong?

I have activated the limiter but i havent bothered choosing satelites. Is that what the problem is?

ta

bendyspex
Posts: 837
Joined: Tue, 13. Apr 04, 10:39
x3

Post by bendyspex » Wed, 14. Dec 05, 22:20

Sounds great. Is there a way to set more than one sattelite as a beacon at once, as I already have quite a few placed around the universe. I really don't think I want to go through each one and change it.

Zzyn
Posts: 77
Joined: Sat, 31. Jul 04, 00:08
x3

Post by Zzyn » Thu, 15. Dec 05, 01:22

andysonofbob wrote:Hello mate

I installed your script mainly for the UT fuel shindigs but i am still getting the poxy out of fuel msg - grrrrrrr!. Am i doing something wrong?

I have activated the limiter but i havent bothered choosing satelites. Is that what the problem is?

ta
The trade will have no where to go if you don't have a newtork of properly named satellites. The normal universe trader option does not use my updated fuel routines. I left that intact. This isn't intended to a be a mod, but instead, an add-on. :-)

When you say 'activated the limiter' what do you mean? Do you mean that you selected 'Limited Universe trader' as his mode? If so, then he'll basically not be able to do anything, since he has no valid but or sell sectors.

I'll recheck my script real quick to make sure the updated ships are being called int he delivery routine.. And... Yup, the delivered script: plugin.autotrade.deliverysat.zz.xml has the following update:
118 $upgrade.ship.type = Mercury
119 skip if not $upgrade.race == Argon
120 $upgrade.ship.type = Mercury
121 skip if not $upgrade.race == Boron
122 $upgrade.ship.type = Dolphin
123 skip if not $upgrade.race == Split
124 $upgrade.ship.type = Caiman
125 skip if not $upgrade.race == Paranid
126 $upgrade.ship.type = Demeter
127 skip if not $upgrade.race == Teladi
128 $upgrade.ship.type = Vulture
129 skip if not $upgrade.race == Pirates
130 $upgrade.ship.type = Pirate Ship

All of those ships have around 3K of space at base cargo size.

Let me know what else you see!

Thanks,
Zzyn

Zzyn
Posts: 77
Joined: Sat, 31. Jul 04, 00:08
x3

Post by Zzyn » Thu, 15. Dec 05, 01:25

bendyspex wrote:Sounds great. Is there a way to set more than one sattelite as a beacon at once, as I already have quite a few placed around the universe. I really don't think I want to go through each one and change it.
Unfortunately, no. I thought of a 'name all' command, but I didn't want to clutter the menu with yet another command. :-)

Its really quick though, using the numbers, rather than clicking int he menus. I found the longest part to be physically browsing from my ships current sector to the sector that contained the sat. That's why I wanted to be able to put the command ON the satilite itself, so this could be done from the property screen.

Although, you can still do it from the property screen, you just have to use 'm' to rename them manually: Trade Beacon for nav sats, and Adv Trade Beacon for advanced sats.

Thanks!
Zzyn

Myros
Posts: 176
Joined: Sat, 13. Dec 03, 00:23
x3

Post by Myros » Thu, 15. Dec 05, 02:11

Seems to be working well Zzyn.
I do notice it frequently scanning for goods and redoing it over and over a lot ... ie normaly you can watch it run through the list and pick one, whereas with your script it will run through the list pick one ...pause, start over pick one ..pause ...start over etc
I only have 5 UTs going so it no strain on the game but for those running many many UTs this extra load could add up.

For my game its perfect though, works nicely and makes sense to me having my ships limited to knowing/trading only where the info is available via sats just like me :) Somehow seems like a far more 'honest' way to do things, as well as giving me precise control of my trade networks.
If a sector gets invaded by pirates etc then I can just switch of the trade beacon until I get a chance to deal with them and I can rest knowing that no dumb UT will wander in there ... love that part.

Thanks for your work on this Zzyn, this really should become the signed version of UT.

Myros

Zzyn
Posts: 77
Joined: Sat, 31. Jul 04, 00:08
x3

Post by Zzyn » Thu, 15. Dec 05, 16:49

My next project for this piece may be to rewrite the 'check sector for best price' routine to acutally use an array accepted sectors. I could make it check the array values in a random order to keep it from always hitting the same few over and over.

This will be a bit more work, though, as I can't seem to find or unpack the script code for that particular fucntion. A full rewrite of that funtion will be fun, but could really be useful.

ALSO, suggestions on how to flag the satellites from the satellites menus themselves would really really be useful. But, since they have no 'commands' menu, or 'actions' menu, I'm not sure what I can do to successfully add a command to thier interface specifically(rather than to your ship)

NOTE: I suggest this script in conjustion with the great satellite distribution scripts on the main thread-sticky at the top. It'll send an M5 off dropping sats for you in a all known sectors; for those that don't already have them up.

Thanks all.

I look to improve this, but am just stuck on certain functions that will probably just need to be rewitten in whole, since I can't get to them. :-)

Good times,
Zzyn

Myros
Posts: 176
Joined: Sat, 13. Dec 03, 00:23
x3

Post by Myros » Thu, 15. Dec 05, 19:21

Had it running overnight, not one single "out of fuel" message from my UTs, not one death and made a large wad of cash ...cant ask for more than that ;)

Myros

Rikaelus
Posts: 223
Joined: Tue, 29. Nov 05, 04:03
x3

Post by Rikaelus » Thu, 15. Dec 05, 19:31

Yep, most useful and helpful. I have 2 UTs on the network which is currently just in main Argon space and some of the Boron and Teladi space nearby, and they have been kept busy and profitable. The fuel thing has worked great and they haven't run into any problems. My next step is to get a patrol going in Teladi space to deal with their pirate problems.

The only delay in it has been waiting for adv. satellites to be made. =P

andysonofbob
Posts: 263
Joined: Sun, 23. Jan 05, 17:58
x3

Post by andysonofbob » Thu, 15. Dec 05, 19:47

Zzyn wrote:
andysonofbob wrote:Hello mate

I installed your script mainly for the UT fuel shindigs but i am still getting the poxy out of fuel msg - grrrrrrr!. Am i doing something wrong?

I have activated the limiter but i havent bothered choosing satelites. Is that what the problem is?

ta
The trade will have no where to go if you don't have a newtork of properly named satellites.
Hello again. When you say properly named sats? Is that the default name? As I have only ever changed the name of my ships.

So i install the scrips. Go to the command console and then activate trade beacon and go through all my sats one by one. I have put one in most sectors i have installed.

Then i activate the trader after clearing out its frieght bay and job's a good'en- yah?

Zzyn
Posts: 77
Joined: Sat, 31. Jul 04, 00:08
x3

Post by Zzyn » Thu, 15. Dec 05, 20:01

Thanks Myros! That's what I made it for! :-) It makes them do what you WANT them to do, rather than go dancing off into places that'll get em killed. :-)

I look forward to improving on it, but until I get past a few technical hurdles, I'm kinda stuck.

And yes, the new fuel routine is a life saver. A bit more costly to guarantee a ship big enough to fuel the big ships we use as our traders, but hey, the profits well makes up for the increased cost.

-Zzyn

andysonofbob
Posts: 263
Joined: Sun, 23. Jan 05, 17:58
x3

Post by andysonofbob » Fri, 16. Dec 05, 09:01

Zzyn

Is it possible to have an acticate/de-activate all satelite command. I have so many sats but very little time to play games and that would be really help. Obviously at the time expense of your good self...

That trade menu is getting a bit clusteres; is there a way to change the colour of the buttons so you know which is active? EG if you were kind enough to implement the above the activate all satilite button would be bold or something and the sat nav trader/sector/univeral trader would reflect the mod it was in....

Zzyn
Posts: 77
Joined: Sat, 31. Jul 04, 00:08
x3

Post by Zzyn » Fri, 16. Dec 05, 23:48

The buttons could easily be moved to the 'custom' menu, which isn't usually even seen, since it doesn't have any command in it, by default. I could move the activate and deactivate commands to that menu.

Also, as far as an 'activate all,' I curely could do that as well. It wouldn't take too much to load in an array of all player owned ships, fileter for sats and force name them all. Well, I don't 'think' it'll be tough.. hehe. :-)

I'll start working on v 1.1 where the activate/deactivate buttons are moved to the 'custom' menu (still under commands), and add a button for activate all and deactivate all, for those that want to use them. At first I didn't think it useful, but after the discussion here it dawned on me that perhaps its faster to 'activate all' then just deactive the ones that you know are in 'hot' sectors.

Good times,
Zzyn

Post Reply

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