[quote="Trinexx]I'm pretty sure I understand the logic of it (define the station name, find "ship" of ship type/race... at defined station, move "ship" to position.), but I cant seem to be able to find the function that allows me to define what station it is. (In my case it is Drone Factory Alpha in Omicron Lyrae)
If you can offer some more specifics for this particular script and what specific functions you used for this it would be greatly appreciated.[/quote]
Hi Trinexx,
The command your looking for is at: General Commands -> <RetVar/IF><Expression>. Select variable, and it'll form the expression variable=(?). Use 'select station' to select the station instance from universe to assign to it.
Sorry for not posting some re-usable source but these scripts are saved as rather large XML files, the long lines in them distorting width of the forum thread.
Also I noticed there's an XML style sheet in the X3:TC scripts folder that allows me to show script examples in a legible way.
I've posted 2 script examples below for reference.
Note: The pipe character '|' is being used by the style sheet to indicate indentation. Its not part of actual script.
The first one is for ejecting a space suit from a specified station (i.e once you know where pearle is):
Code: Select all
Script glen.ejectpearle
Version: 0
for Script Engine Version: 41
Description
Description
Arguments
1: station , Var/Station , 'station'
Source Text
001 $pearle = $station -> find ship: class or type=Space Suit race=Terran flags=0 refobj=$station maxnum=1 with homebase=null
002 if $pearle != null
003 @ |= $pearle -> move to position: x=0 y=0 z=0 with precision 1000 m
004 end
005 return null
The second one will search for docked space suits at stations in the specified sector and report any finds to the players log book. Can be used to help locate pearle.
Code: Select all
Script glen.findpearle
Version: 0
for Script Engine Version: 41
Description
Description
Arguments
1: sector , Var/Sector , 'sector to search in'
Source Text
001 if $sector == null
002 |return null
003 end
004
005 $shiptype = Space Suit
006 $findflags = [Find.Nearest] | [Find.Multiple]
007
008 $stations = find station: sector=$sector class or type=null race=null flags=$findflags refobj=[THIS] maxdist=null maxnum=20 refpos=null
009
010 if $stations == null
011 |return null
012 end
013
014 $count = size of array $stations
015
016 $iStation = 0
017 while $iStation < $count
018 |$station = $stations[$iStation]
019 |if $station != null
020 ||
021 ||$ship = $station -> find ship: class or type=$shiptype race=null flags=0 refobj=$station maxnum=1 with homebase=null
022 ||
023 ||$station.name = $station -> get name
024 ||$sector.name = $sector -> get name
025 ||
026 ||if $ship != null
027 |||write to player logbook: printf: fmt='found spacesuit at sector '%s' station '%s'', $sector.name, $station.name, null, null, null
028 ||end
029 ||
030 ||
031 |end
032 |inc $iStation =
033 end
034 return null
Unfortunately I don't know a way to feed such source back into X3. I'll leave it as an excercise for the reader. Remember keying in the old ZX spectrum games from magazines? Now you can re-live those fond days =)