First let me say that I am by no means a programmer and/or scripter.
But, I am willing to dabble in this and maybe even learn something along the way.
That said, this is an AL plugin I wrote, with a lot of help from people on this forum, for X3-Reunion. To get what I have now I opened the old X3R scripts in XML Notepad on my second monitor. The in X3TC opened up the Script editor and recreated them there, line for line. However, some things are not working correctly (see list below).
This is what it should do;
Check to see if the player has a satellite in the sector he is currently in.
If not, then a ship called "Satellite Deployment Services" sets out from the nearest Trading Center and places one at 0,10Km,0 of said sector. Then charges the player the averagecost of the Satellite + 20% of that cost (for a placement fee). Then returns to the Trading Center (I then destroy the ship just to cleanup). When the Player enters a new sector it starts all over again.
Edit - Previous problems are now resolved.
Edit - This is new
Here are some things I would like to achieve with this script.
1. Send the player a message asking if they want to sign up for the service. (not sure how I need to go about this, though I do have the message with buttons for 'yes' and 'no' in the 't' file).
2. Have the Script check the players credits to be sure they can afford the service. If he can but later runs low on funds have the service terminate. Then check at given intervals, if the player can afford it later remake the offer. (insure how to proceed here, but I believe this needs to be the first condition to be met at each interval of the script running)
3. Have the script check all player known sectors, and place Sats there is needed, maybe excluding hostile sectors known to the player. i.e. - have it maintain the players Sat network. (again here I am a little lost as to how to do this.)
After looking back at these task I would, I have made an astounding discovery!
I may be in over my head here

If anyone can help me figure this out it would be much appreciated.
Here are the scripts involved;
Edit - This is the current Code.
al.plugin.tek.SatDeployServices.xml - To register the AL Plugin
Code: Select all
Script al.plugin.tek.SatDeployServices
Version: 0
for Script Engine Version: 44
Description
Declare Satellite Deployment Services as AL plugin
Arguments
Source Text
001 * Load the text file.
002 load text: id=8971
003
004 * Load the AL Script
005 al engine: register script='al.tek.SDS.Main'
006
007 return null
Code: Select all
Script al.tek.SDS.Main
Version: 0
for Script Engine Version: 44
Description
Main script fot the Satellite Deployment Services AL plugin.
Arguments
1: SDS.al.PluginID , Var/String , 'AL Plugin ID'
2: SDS.al.Event , Var/String , 'AL Event'
Source Text
001 load text: id=8971
002 * load your t file
003
004 * global plugin variable stores plugin state and variables
005 $SDS.plugin.Vars = get global variable: name=$SDS.al.PluginID
006 if not $SDS.plugin.Vars
007 * setup new data structure and init it
008 |$SDS.plugin.Vars = array alloc: size=2
009 |set global variable: name=$SDS.al.PluginID value=$SDS.plugin.Vars
010 * data structure version
011 |$SDS.plugin.Vars[0] = 0
012 * plugin initially enabled needs TRUE set disabled on init = FALSE
013 |$SDS.plugin.Vars[1] = [TRUE]
014 end
015
016 * handle plugin events
017 * init and reinit are run every time the game loads
018 if $SDS.al.Event == 'init' OR $SDS.al.Event == 'reinit'
019 |$SDS.Description = sprintf: pageid=8971 textid=2, null, null, null, null, null
020 |al engine: set plugin $SDS.al.PluginID description to $SDS.Description
021 |
022 * init and reinit are run every time the game loads
023 * interval is 1 minutes
024 |$SDS.Interval = 1 * 60
025 |al engine: set plugin $SDS.al.PluginID timer interval to $SDS.Interval s
026 |
027 else if $SDS.al.Event == 'isenabled'
028 |$SDS.Enabled = $SDS.plugin.Vars[1]
029 |return $SDS.Enabled
030 |
031 * Use this area to process special instructions when the plugin is toggled on
032 else if $SDS.al.Event == 'start'
033 |$SDS.plugin.Vars[1] = [TRUE]
034 |$SDS.Description = sprintf: pageid=8971 textid=2, null, null, null, null, null
035 |al engine: set plugin $SDS.al.PluginID description to $SDS.Description
036 |
037 * Use this area to process special instructions when the plugin is toggled off
038 else if $SDS.al.Event == 'stop'
039 |$SDS.Description = sprintf: pageid=8971 textid=2, null, null, null, null, null
040 |$SDS.plugin.Vars[1] = [FALSE]
041 |al engine: set plugin $SDS.al.PluginID description to $SDS.Description
042 |
043 * The event script is called every interval
044 else if $SDS.al.Event == 'timer'
045 @ |= [THIS] -> call script 'al.tek.SDS.Events' : SDS AL Plugin ID=$SDS.al.PluginID SDS plugin data=$SDS.plugin.Vars
046 end
047 return null
Code: Select all
Script al.tek.SDS.Events
Version: 0
for Script Engine Version: 44
Description
Satellite Deployment Services event handler.
Arguments
1: SDS.al.PluginID , Var/String , 'SDS AL Plugin ID'
2: SDS.plugin.Vars , Var/String , 'SDS plugin data'
Source Text
001 * if plugin is disabled, dont do anything
002 $SDS.plugin.Enabled = $SDS.plugin.Vars[1]
003
004 if $SDS.plugin.Enabled != 1
005 * put a shutdown script in here if needed
006 * put an unistall script in here if needed to remove added products etc
007 |set global variable: name='Satellite.Deployment.Services' value=null
008 |return null
009 end
010
011 if $SDS.plugin.Enabled == 1
012 * call setup and start script here
013 |set global variable: name='Satellite.Deployment.Services' value=1
014 @ |= [THIS] -> call script 'al.tek.SDS.Deploy.Event' :
015 end
016
017 @ = wait 150000 ms
018
019 return null
Code: Select all
Script al.tek.SDS.Deploy.Event
Version: 0
for Script Engine Version: 44
Description
Handles the Advanced Satellite deployment event.
Arguments
Source Text
001 * Setup for creating the Satelliet Deployment Services Ship.
002 * ***Gather the required information.
003 $SDS.Name = read text: page=8971 id=2
004 $SDS.Abbrev = read text: page=8971 id=1
005 $SDS.Exist.Sat.Flags = [Find.Nearest]
006 $SDS.Exist.Ship.Flag = [Find.Nearest]
007 $SDS.Flags = [Find.Nearest]
008 $SDS.Sector = [PLAYERSHIP] -> get sector
009 $SDS.SectorRace = $SDS.Sector -> get owner race
010 * See if a satellite owned by the Player exists in sector.
011 $SDS.Existing.Satellite = find ship: sector=$SDS.Sector class or type=All Satellites race=Player flags=$SDS.Exist.Sat.Flags refobj=[PLAYERSHIP] maxdist=100000 maxnum=1 refpos=[PLAYERSHIP]
012 * If player owned Sat exist, do nothing and end.
013 if $SDS.Existing.Satellite != null
014 end
015 * If no Sat exists, then do check for delivery ship.
016 if not $SDS.Existing.Satellite == null
017 * Check to see if a ship is on the way to deploy a Sat.
018 |$SDS.Exist.Ship = find ship: sector=$SDS.Sector class or type=Military Transport race=$SDS.SectorRace flags=$SDS.Exist.Ship.Flag refobj=[PLAYERSHIP] maxdist=100000 maxnum=1 refpos=[PLAYERSHIP]
019 |$SDS.Exist.Ship.Name = $SDS.Exist.Ship -> get name
020 * If not Sat, but a ship is found, then end.
021 |if $SDS.Exist.Ship.Name != null
022 |end
023 * If not Sat and no ship are found.
024 else if $SDS.Exist.Ship.Name == null
025 * *Find the nearest Trading Dock to the Player.
026 |$SDS.Start.Station = find station in galaxy: startsector=$SDS.Sector class or type=Trading Dock race=$SDS.SectorRace flags=$SDS.Flags refobj=[PLAYERSHIP] serial=null max.jumps=5 num=1
027 * *Create the ship, Name it, Give it a Pilot and ad it to the Trading Dock.
028 |$SDS.Ship = create ship: type=Military Transport owner=$SDS.SectorRace addto=$SDS.Start.Station x=0 y=0 z=0
029 |$SDS.Ship -> set name to $SDS.Name
030 |$SDS.PilotName = get random name: race=$SDS.SectorRace
031 |$SDS.Ship -> set pilot name to $SDS.PilotName
032 * Equip the ship for it's job.
033 |$SDS.Ship.Shield.Bays = $SDS.Ship -> get number of shield bays
034 |$SDS.Ship.Max.Shields = $SDS.Ship -> get max. shield type that can be installed
035 |= $SDS.Ship -> install $SDS.Ship.Shield.Bays units of $SDS.Ship.Max.Shields
036 |$SDS.Ship.Max.Engines = $SDS.Ship -> get max upgrades for upgrade Engine Tuning
037 |$SDS.Ship.Supertune = $SDS.Ship.Max.Engines * 2
038 |= $SDS.Ship -> install $SDS.Ship.Supertune units of Engine Tuning
039 |$SDS.Ship.Max.Rudder = $SDS.Ship -> get max upgrades for upgrade Rudder Optimisation
040 |= $SDS.Ship -> install $SDS.Ship.Max.Rudder units of Rudder Optimisation
041 |$SDS.Ship.Max.CargoBay = $SDS.Ship -> get max upgrades for upgrade Cargo Bay Extension
042 |= $SDS.Ship -> install $SDS.Ship.Max.CargoBay units of Cargo Bay Extension
043 |= $SDS.Ship -> install 1 units of Jumpdrive
044 |= $SDS.Ship -> install 500 units of Energy Cells
045 |= $SDS.Ship -> install 5 units of Advanced Satellite
046 * *Turn of the AI for the ship.
047 |$SDS.Ship -> set race logic control enabled to [FALSE]
048 * Jump to Player sector if required
049 |$SDS.Trade.Dock.Sector = $SDS.Start.Station -> get sector
050 |skip if $SDS.Sector == $SDS.Trade.Dock.Sector
051 ||= $SDS.Ship -> use jump drive: target=$SDS.Sector
052 @ |= $SDS.Ship -> move around 3000 ms
053 * *Move the ship into position: x= 0, y=1250, z=0
054 @ |$SDS.Deploy.Position = $SDS.Ship -> move to position: x=0 y=1250 z=0 with precision 10 m
055 |$SDS.Ship -> set command: [ACTION_IDLE]
056 * *Deploy the Advanced Satellite and give the Player control.
057 |$SDS.Deployed.Satellite = create ship: type=Advanced Satellite owner=Player addto=$SDS.Sector x=0 y=1000 z=0
058 * Charge the Player, the minimum cost of the Sat + 10% surcharge.
059 |$SDS.Min.Sat.Cost = get min price of ware Advanced Satellite
060 |$SDS.Total.Sat.Cost = $SDS.Min.Sat.Cost + ( $SDS.Min.Sat.Cost / 10 )
061 |$SDS.Player.Charges = - $SDS.Total.Sat.Cost
062 |add money to player: $SDS.Player.Charges
063 * *Send the ship back to the Trade Dock.
064 @ |= $SDS.Ship -> move around 3000 ms
065 |skip if $SDS.Sector == $SDS.Trade.Dock.Sector
066 ||= $SDS.Ship -> use jump drive: target=$SDS.Trade.Dock.Sector
067 @ |= $SDS.Ship -> fly to station $SDS.Start.Station
068 * *And, just to cleanup, Destroy the ship.
069 |$SDS.Ship -> destruct: show no explosion=1
070 end
071 return null
This is my 't' file named 8971.xml (copied from XML Notepad Output window) -
Code: Select all
<language id="44">
<page id="8971" title="Satellite Deployment Services" descr="">
<t id="1">S.D.S.</t>
<t id="2">Satellite Deployment Services</t>
<t id="10">Satellite Deployment Services is offering you the service of deploying an Advanced Satellite in every sector you enter. Once you accept our agreement, the service will start sending out ships to a central location in any sector you enter, once there they will deploy a new Advanced Satellite for you. If you currently have a satellite in that sector you will not be charged and no action will be taken. \n\n The fee(s) for this service includes the cost of the satellite and an installation and maintenance fee of 30% of the cost of said satellite. Charges for setting a new satellite are made prior to satellite deployment. Once the Satellite is deployed it becomes your property and your responsibility.</t>
<t id="11">Would you like to accept the agreement with Satellite Deployment Services?</t>
<t id="12">Satellite Deployment Services is offering you the service of deploying an Advanced Satellite in every sector you enter. Once you accept our agreement, the service will start sending out ships to a central location in any sector you enter, once there they will deploy a new Advanced Satellite for you. If you currently have a satellite in that sector you will not be charged and no action will be taken. \n\n The fee(s) for this service includes the cost of the satellite and an installation and maintenance fee of 30% of the cost of said satellite. Charges for setting a new satellite are made prior to satellite deployment. Once the Satellite is deployed it becomes your property and your responsibility.\n\nShall we sign you up on our service?\n\n[select value="1"]Yes, sign me up[/select]\n[select value="2"]No, not today![/select]\n</t>
</page>
</language>
Code: Select all
<language id="44">
<page id="8971" title="Satellite Deployment Services" descr="">
<t id="1">S.D.S.</t>
<t id="2">Satellite Deployment Services</t>
<t id="10">Satellite Deployment Services is offering you the service of deploying an Advanced Satellite in every sector you enter. Once you accept our agreement, the service will start sending out ships to a central location in any sector you enter, once there they will deploy a new Advanced Satellite for you. If you currently have a satellite in that sector you will not be charged and no action will be taken. \n\n The fee(s) for this service includes the cost of the satellite and an installation and maintenance fee of 30% of the cost of said satellite. Charges for setting a new satellite are made prior to satellite deployment. Once the Satellite is deployed it becomes your property and your responsibility.</t>
<t id="11">Would you like to accept the agreement with Satellite Deployment Services?</t>
<t id="12">Satellite Deployment Services is offering you the service of deploying an Advanced Satellite in every sector you enter. Once you accept our agreement, the service will start sending out ships to a central location in any sector you enter, once there they will deploy a new Advanced Satellite for you. If you currently have a satellite in that sector you will not be charged and no action will be taken. \n\n The fee(s) for this service includes the cost of the satellite and an installation and maintenance fee of 30% of the cost of said satellite. Charges for setting a new satellite are made prior to satellite deployment. Once the Satellite is deployed it becomes your property and your responsibility.\n\nShall we sign you up on our service?\n\n[select value="1"]Yes, sign me up[/select]\n[select value="2"]No, not today![/select]\n</t>
</page>
</language>