[PROB] Stationen eines Komplexes abfragen, weiß einer wie?

Hier ist der ideale Ort um über Scripts und Mods für X³: Reunion zu diskutieren.

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

Post Reply
User avatar
Blacky_BPG
Posts: 2030
Joined: Mon, 23. Feb 04, 23:42
x4

[PROB] Stationen eines Komplexes abfragen, weiß einer wie?

Post by Blacky_BPG » Wed, 4. Oct 06, 22:25

Also ich habe das Problem das ich bis jetzt nicht herausgefunden habe wie ich die Stationen eines Komplexes auslesen kann.
Die Funktion get stationarray from sector liefert mir zwar die Anzahl der Stationen, auch denen die im Komplex enthalten sind, jedoch kann ich so den Typ nicht herausfinden.

Meine Stationen im Komplex sind:
  • 15 x Argon Ranch
  • 15 x Cahoona Fleischfabrik
  • 10 x Chip Werk
  • 10 x Computerwerk
  • 10 x Quantumröhrenfabrik
  • 8 x Kristallfabrik
  • 7 x SKW
  • 2 x Erzmine
  • 2 x Siliziummine
  • 6 x Komplex Knotenpunkt
  • und natürlich 1 Kontrollzentrum
  • das macht dann insgesamt 86 Stationen
Es wird mir immer nur die Argon Ranch angezeigt als Typ, und das 86 mal.
Ein weiteres Problem was sich daraus ergibt: Der Preis des Komplexes liegt bei dem EINER Argon Ranch, also die Preise der anderen Stationen werden nicht mit eingerechnet. Das läßt den Wert des Komplexes bei einer Preis- bzw Wertabfrage natürlich lächerlich aussehen.

Der Code zur Abfrage

Code: Select all

014   $stationsize =  size of array $stations
015   while if $stationsize
016     dec $stationsize
017     $station = $stations[$stationsize]
018     $station.type = $station -> get ware type code of object
019     $station.price = get min price of ware $station.type
020     $station.price.normal = get average price of ware $station.type
021     $station.price.max = get max price of ware $station.type
022     $msg = $station + ' -- ' + $station.type + ' -- ' $station.price + ' -- ' + $station.price.normal + ' -- ' + $station.price.max
022     write to log file #98765  append=[TRUE]  value=$msg
023   end
:gruebel: :gruebel:

Die Logfile Ausgaben sehen nicht sehr zufriedenstellend aus :evil: :? :

Code: Select all

Ihr Ranch alpha(Trantor)  --  Argon Ranch  --  1363401 --  1817868  --  2272335
Ihr Ranch alpha(Trantor)  --  Argon Ranch  --  1363401 --  1817868  --  2272335
Ihr Ranch alpha(Trantor)  --  Argon Ranch  --  1363401 --  1817868  --  2272335
Ihr Ranch alpha(Trantor)  --  Argon Ranch  --  1363401 --  1817868  --  2272335
Ihr Ranch alpha(Trantor)  --  Argon Ranch  --  1363401 --  1817868  --  2272335
Ihr Ranch alpha(Trantor)  --  Argon Ranch  --  1363401 --  1817868  --  2272335

etc.  etc
Also falls einer ne Lösung für dieses Problem hat wäre ich sehr dankbar.

PS: Und ja, Einige ahnen es sicherlich schon, ich brauche das für meine Banksoftware, genauer gesagt für die Erweiterung um die Kreditfunktion der Banksoftware.
Last edited by Blacky_BPG on Wed, 4. Oct 06, 22:48, edited 1 time in total.

ArcaJeth
Posts: 2245
Joined: Mon, 10. Nov 03, 18:22
x3tc

Post by ArcaJeth » Wed, 4. Oct 06, 22:36

Code: Select all

014   $stationsize =  size of array $stations 
015   while if $stationsize 
016     dec $stationsize 
017     $station = $stations[$stationcount] 
018     $station.type = $station -> get ware type code of object 
019     $station.price = get min price of ware $station.type 
020     $station.price.normal = get average price of ware $station.type 
021     $station.price.max = get max price of ware $station.type 
022     $msg = $station + ' -- ' + $station.type + ' -- ' $station.price + ' -- ' + $station.price.normal + ' -- ' + $station.price.max 
022     write to log file #98765  append=[TRUE]  value=$msg 
023   end
Möglich dass die Antwort im Rest des Scriptes liegt, aber müßte Zeile 17 nicht $station = $stations[$stationsize] sein ? $stationcount bleibt nämlich immer gleich ;)

User avatar
X-Freak Cartman
Posts: 4017
Joined: Mon, 2. Oct 06, 15:08
x3

Post by X-Freak Cartman » Wed, 4. Oct 06, 22:48

jup, das is das Prob...

wenn du das änderst, müsste es funzen

User avatar
Blacky_BPG
Posts: 2030
Joined: Mon, 23. Feb 04, 23:42
x4

Post by Blacky_BPG » Wed, 4. Oct 06, 22:51

Ehm, sorry, das war ein Tipfehler.
Nein, es funzt leider nicht :evil: :cry:

@ArcaJeth
Da ist kein Rest, ich hab mir das Script nur für diese Funktion geschrieben, zum testen.
Zeile 001 bis 014 sind lediglich Sektorsuche nach meinen Komplexen.
Auch wenn ich den Sektor direkt angebe, als Argument welches dann in get stationarray of sector genutzt wird ändert das nichts.

User avatar
Lucike
Posts: 12969
Joined: Sun, 9. May 04, 21:26
x4

Post by Lucike » Wed, 4. Oct 06, 23:04

Code: Select all

001   $Sector = Argon Prime
002   $Array.Station = $Sector -> get station array from sector
003   $While =  size of array $Array.Station
004   while $While
005    dec $While = 
006    $Station = $Array.Station[$While]
007    write to log file #9999  append=[TRUE]  value=$Station
008   end
009   return null
Funktioniert einwandfrei. Welchen Wert hat $stationsize vor der Schleife?

Argon Schiffswerft(Argon Prime)
Computerwerk alpha(Argon Prime)
Laserschmiede Alpha PS alpha(Argon Prime)
Erweiterte Satellitenfertigung alpha(Argon Prime)
Ihr Cahoona-Presse L alpha(Argon Prime)
Geschützturmfabrik alpha(Argon Prime)
Quantumröhrenfabrik alpha(Argon Prime)
Station - 04 S - Scruffin-Plantage L(Argon Prime)
Station - 03 B - Planktonfarm L(Argon Prime)
Kristallfabrik M alpha(Argon Prime)
Chip-Werk alpha(Argon Prime)
Ihr Cahoona-Presse L alpha(Argon Prime)
Gefechtskopffabrik alpha(Argon Prime)
Satellitenfertigung beta(Argon Prime)
Satellitenfertigung alpha(Argon Prime)
Argon Ausrüstungsdock(Argon Prime)
Komplx - 01 A - Cahoona-Presse L(Argon Prime)
Quantumröhrenfabrik beta(Argon Prime)
Produktionskomplex Intelligente Zielsuchende Raketen alpha(Argon Prime)
Produktionskomplex Schwarmraketen alpha(Argon Prime)
Freie Argon Handelsstation(Argon Prime)
Station - 02 B - BoGas Produktion L(Argon Prime)
Image

User avatar
Blacky_BPG
Posts: 2030
Joined: Mon, 23. Feb 04, 23:42
x4

Post by Blacky_BPG » Wed, 4. Oct 06, 23:18

Was ist das denn jetzt?
Hab's nochmal neu geschrieben:

Code: Select all

001   $sector = Trantor
002   $array = $sector -> get station array from sector
003   $size =  size of array $array
004   while $size
005    dec $size = 
006    $station = $array[$size]
007    write to log file #98765  append=[TRUE]  value=$station
008   end
009   return null
Ist eigentlich auch nicht anders als ich es hatte, aber jetzt funktioniert es, versteh ich nich.

OK, mach dicht, hat sich erledigt.

Post Reply

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