Script: Abfrage ob eine Fabrik an einem Komplex hängt

Hier ist der ideale Ort um über Scripts und Mods für X³: Terran Conflict und X³: Albion Prelude zu diskutieren.

Moderators: Moderatoren für Deutsches X-Forum, Scripting / Modding Moderators

Post Reply
MichaRose
Posts: 328
Joined: Sat, 28. Feb 04, 19:25
x3

Script: Abfrage ob eine Fabrik an einem Komplex hängt

Post by MichaRose » Sun, 25. Oct 09, 21:26

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
Gruß,
Michael

User avatar
Saetan
Posts: 3223
Joined: Wed, 1. Feb 06, 19:26
x4

Post by Saetan » Sun, 25. Oct 09, 21:32

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.


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

MichaRose
Posts: 328
Joined: Sat, 28. Feb 04, 19:25
x3

Post by MichaRose » Mon, 26. Oct 09, 00:00

Jo, das hat mich auf die Lösung des Problems gebracht!

thx ;)
Gruß,
Michael

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts und Modding”