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

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

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

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

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

Post by Zzyn » Wed, 14. Dec 05, 05: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: 3224
Joined: Fri, 4. Feb 05, 14:44
x3

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

Post by Red Spot » Wed, 14. Dec 05, 12: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, 10:07
x3

Post by Birdman » Wed, 14. Dec 05, 19: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, 01:23
x3

Post by Myros » Wed, 14. Dec 05, 19: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: 216
Joined: Tue, 29. Nov 05, 05:03
x3

Post by Rikaelus » Wed, 14. Dec 05, 20: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: 75
Joined: Sat, 31. Jul 04, 00:08
x3

Post by Zzyn » Wed, 14. Dec 05, 20: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, 21:26, edited 2 times in total.

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

Post by Zzyn » Wed, 14. Dec 05, 21: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: 75
Joined: Sat, 31. Jul 04, 00:08
x3

Post by Zzyn » Wed, 14. Dec 05, 21: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, 18:58
x3

Post by andysonofbob » Wed, 14. Dec 05, 21: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: 708
Joined: Tue, 13. Apr 04, 10:39
x3

Post by bendyspex » Wed, 14. Dec 05, 23: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: 75
Joined: Sat, 31. Jul 04, 00:08
x3

Post by Zzyn » Thu, 15. Dec 05, 02: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: 75
Joined: Sat, 31. Jul 04, 00:08
x3

Post by Zzyn » Thu, 15. Dec 05, 02: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, 01:23
x3

Post by Myros » Thu, 15. Dec 05, 03: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: 75
Joined: Sat, 31. Jul 04, 00:08
x3

Post by Zzyn » Thu, 15. Dec 05, 17: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, 01:23
x3

Post by Myros » Thu, 15. Dec 05, 20: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

Post Reply

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