Hi,
ich versuche gerade über den SE heraus zu finden, ob eine Fabrik an einem Komplex dranhängt. Nur irgendwie bekomme ich das nicht hin und wäre froh, wenn mir hier jemand einen Tipp geben könnte wie man das machen kann!
mfg, Michael
Script: Abfrage ob eine Fabrik an einem Komplex hängt
Moderators: Moderatoren für Deutsches X-Forum, Scripting / Modding Moderators
Script: Abfrage ob eine Fabrik an einem Komplex hängt
Gruß,
Michael
Michael
Ich machs mir einfach, da ich gerade auf dem Sprung bin, und kopier dir nur den Quelltext eines selbstgeschriebenen Scriptes, welches alle Komplexe und deren Stationen, inkl. Koordinaten, eines Sektors abfrägt und nach Komplex sortiert in eine externe Logdatei schreibt.
Vllt. hilft es dir ja dennoch weiter?
Zeile 42 könnte für dich interessant sein.
Vllt. hilft es dir ja dennoch weiter?
Zeile 42 könnte für dich interessant sein.
Code: Select all
001 $logfile = 9600
002
003 $Input.Sector.Title = 'Wähle einen Sektor:'
004 $Sector = [PLAYERSHIP] -> get user input: type=Var/Sector, title=$Input.Sector.Title
005 write to log file #$logfile append=[FALSE] printf: fmt='Komplexübersicht: %s', $Sector, null, null, null, null
006 write to log file #$logfile append=[TRUE] value=' '
007 write to log file #$logfile append=[TRUE] value=' '
008
009 $Array.StationsInSector = $Sector -> get player owned station array from sector
010 $Array.StationsInSector = sort array $Array.StationsInSector
011 $Array.StationsInSector.Size = size of array $Array.StationsInSector
012
013 $i = -1
014 while $i < ( $Array.StationsInSector.Size + 1 )
015 @ |= wait 25 ms
016 |inc $i =
017 |
018 |$Station = $Array.StationsInSector[$i]
019 |if $Station -> is of class Komplexzentrum
020 ||$Station.Name = $Station -> get name
021 ||$Station.MakerRace = $Station -> get maker race
022 ||$Station.Size = $Station -> get size of object
023 ||$Output.StationName = sprintf: fmt='%s (%s) - < %s >', $Station.Name, $Station.MakerRace, $Station.Size, null, null
024 ||
025 ||$Station.PosX = $Station -> get x position
026 ||$Station.PosY = $Station -> get y position
027 ||$Station.PosZ = $Station -> get z position
028 ||$Output.StationPosition = sprintf: fmt='< %s / %s / %s >', $Station.PosX, $Station.PosY, $Station.PosZ, null, null
029 ||
030 ||$Station.RotA = $Station -> get rot alpha
031 ||$Station.RotA = $Station.RotA / 182
032 ||$Station.RotB = $Station -> get rot beta
033 ||$Station.RotB = $Station.RotB / 182
034 ||$Station.RotG = $Station -> get rot gamma
035 ||$Station.RotG = $Station.RotG / 182
036 ||$Output.StationRotation = sprintf: fmt='< %s / %s / %s >', $Station.RotA, $Station.RotB, $Station.RotG, null, null
037 ||
038 ||write to log file #$logfile append=[TRUE] printf: fmt='%s - %s - %s', $Output.StationName, $Output.StationPosition, $Output.StationRotation, null, null
039 ||
040 ||$Complex = $Station
041 ||
042 ||$Array.StationsInComplex = $Complex -> get factory array from sector
043 ||$Array.StationsInComplex = sort array $Array.StationsInComplex
044 ||$Array.StationsInComplex.Size = size of array $Array.StationsInComplex
045 ||
046 ||$j = -1
047 ||while $j < ( $Array.StationsInComplex.Size - 1 )
048 @ |||= wait 25 ms
049 |||inc $j =
050 |||
051 |||$Station = $Array.StationsInComplex[$j]
052 |||$Station.Name = $Station -> get name
053 |||$Station.MakerRace = $Station -> get maker race
054 |||$Station.Size = $Station -> get size of object
055 |||$Output.StationName = sprintf: fmt='%s (%s) - < %s >', $Station.Name, $Station.MakerRace, $Station.Size, null, null
056 |||
057 |||$Station.PosX = $Station -> get x position
058 |||$Station.PosY = $Station -> get y position
059 |||$Station.PosZ = $Station -> get z position
060 |||$Output.StationPosition = sprintf: fmt='< %s / %s / %s >', $Station.PosX, $Station.PosY, $Station.PosZ, null, null
061 |||
062 |||$Station.RotA = $Station -> get rot alpha
063 |||$Station.RotA = $Station.RotA / 182
064 |||$Station.RotB = $Station -> get rot beta
065 |||$Station.RotB = $Station.RotB / 182
066 |||$Station.RotG = $Station -> get rot gamma
067 |||$Station.RotG = $Station.RotG / 182
068 |||$Output.StationRotation = sprintf: fmt='< %s / %s / %s >', $Station.RotA, $Station.RotB, $Station.RotG, null, null
069 |||
070 |||write to log file #$logfile append=[TRUE] printf: fmt=' %s - %s - %s', $Output.StationName, $Output.StationPosition, $Output.StationRotation, null, null
071 |||
072 ||end
073 ||
074 ||write to log file #$logfile append=[TRUE] value=' '
075 ||write to log file #$logfile append=[TRUE] value=' '
076 ||
077 |end
078 end
079
080 send incoming message 'Logdatei erfolgreich erstellt.' to player: display it=[FALSE]
081 return null