Problem mit einem Find-Ship Script - Erbitte Hilfe

Hier ist der ideale Ort um über Scripts und Mods für X²: Die Bedrohung zu diskutieren.

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

User avatar
StarTrekMarc
Posts: 2143
Joined: Sat, 3. Apr 04, 16:38
x4

Problem mit einem Find-Ship Script - Erbitte Hilfe

Post by StarTrekMarc »

Hallo Leute,

ich sitze nun seit Tagen an diesem Script hier und komme einfach nicht weiter, selbst Lucike weiß nicht so richtig Rat (nichts gegen ihn ;) ).

Vielleicht könnt ihr mir ja helfen, also, das Script soll alle Sektoren nach Schiffen durchsuchen und auf den Schiffen dann ein Script starten, hier erstmal der Ausschnitt:

Code: Select all

[...]
100   $TypeM1 = $ShipTypes[0]
101   $TypeM2 = $ShipTypes[1]
102   $TypeM3 = $ShipTypes[2]
103   $TypeM4 = $ShipTypes[3]
104   $TypeM5 = $ShipTypes[4]
105   $TypeM6 = $ShipTypes[5]
106   
107   $CounterX = 0
108   $CounterY = 0
109   $ZCounterM1 = 0
110   $ZCounterM2 = 0
111   $ZCounterM3 = 0
112   $ZCounterM4 = 0
113   $ZCounterM5 = 0
114   $ZCounterM6 = 0
115   $SektorX = get max sectors in x direction
116   $SektorY = get max sectors in y direction
117   
118   while $ZCounterM1 < $CounterM1
119    $Schiff =  create ship: type=$TypeM1 owner=$AttackierendesVolk addto=$ErstellungsSektor x=0 y=100000 z=0
120    $Schiff -> add default items to ship
121 @  START [THIS] -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=Unbekannter Sektor
122    inc $ZCounterM1 = 
123   end
124   
125   while $ZCounterM2 < $CounterM2
126    $Schiff =  create ship: type=$TypeM2 owner=$AttackierendesVolk addto=$ErstellungsSektor x=0 y=100000 z=0
127    $Schiff -> add default items to ship
128 @  START [THIS] -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=Unbekannter Sektor
129    inc $ZCounterM2 = 
130   end
131   
132   while $CounterX <= $SektorX
133    while $CounterY <= $SektorY
134     
135     $SektorA = get sector from universe index: x=$CounterX, y=$CounterY
136     
137     $CounterA = 0
138     while $ZCounterM3 <= $CounterM3 AND $CounterA <= 25
139      $Schiff =  find ship: sector=$SektorA class or type=$TypeM3 race=$AttackierendesVolk flags=[Find.Random] refobj=null maxdist=null maxnum=null refpos=null
140      if $Schiff != null
141       $Schiff -> add default items to ship
142 @     START [THIS] -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=$SektorA
143       inc $ZCounterM3 = 
144      else if not $Schiff
145       inc $CounterA = 
146      end
147     end
148     
149     $CounterA = 0
150     while $ZCounterM4 <= $CounterM4 AND $CounterA <= 25
151      $Schiff =  find ship: sector=$SektorA class or type=$TypeM4 race=$AttackierendesVolk flags=[Find.Random] refobj=null maxdist=null maxnum=null refpos=null
152      if $Schiff != null
153       $Schiff -> add default items to ship
154 @     START [THIS] -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=$SektorA
155       inc $ZCounterM4 = 
156      else if not $Schiff
157       inc $CounterA = 
158      end
159     end
160     
161     $CounterA = 0
162     while $ZCounterM5 <= $CounterM5 AND $CounterA <= 25
163      $Schiff =  find ship: sector=$SektorA class or type=$TypeM5 race=$AttackierendesVolk flags=[Find.Random] refobj=null maxdist=null maxnum=null refpos=null
164      if $Schiff != null
165       $Schiff -> add default items to ship
166 @     START [THIS] -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=$SektorA
167       inc $ZCounterM5 = 
168      else if not $Schiff
169       inc $CounterA = 
170      end
171     end
172     
173     $CounterA = 0
174     while $ZCounterM6 <= $CounterM6 AND $CounterA <= 25
175      $Schiff =  find ship: sector=$SektorA class or type=$TypeM6 race=$AttackierendesVolk flags=[Find.Random] refobj=null maxdist=null maxnum=null refpos=null
176      if $Schiff != null
177       $Schiff -> add default items to ship
178 @     START [THIS] -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=$SektorA
179       inc $ZCounterM6 = 
180      else if not $Schiff
181       inc $CounterA = 
182      end
183     end
184     
185     inc $CounterY = 
186    end
187    inc $CounterX = 
188   end
189   
190   * Script by StarTrekMarc
[...]
Ich finde einfach keinen Fehler :(

Ich danke euch schonmal ;)

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

Re: Problem mit einem Find-Ship Script - Erbitte Hilfe

Post by Lucike »

StarTrekMarc wrote:ich sitze nun seit Tagen an diesem Script hier und komme einfach nicht weiter, selbst Lucike weiß nicht so richtig Rat (nichts gegen ihn ;) ).
Na, Du bist mir ja eine Nase. Nur weil ich noch nicht geantwortet habe? :) ;) In Ordnung, machen wir das hier. Somit können auch andere daran teilhaben.

Überprüfe erst mal, ob die Variablen richtig vergeben sind. Komme sie am Find-Befehl an?

SektorA, TypeM(x) usw.

Gruß
Lucike
Last edited by Lucike on Fri, 7. Oct 05, 11:34, edited 1 time in total.
Image
laprican
Posts: 196
Joined: Fri, 13. Feb 04, 16:56
x2

Re: Problem mit einem Find-Ship Script - Erbitte Hilfe

Post by laprican »

StarTrekMarc wrote:Hallo Leute,

ich sitze nun seit Tagen an diesem Script hier und komme einfach nicht weiter, selbst Lucike weiß nicht so richtig Rat (nichts gegen ihn ;) ).

Vielleicht könnt ihr mir ja helfen, also, das Script soll alle Sektoren nach Schiffen durchsuchen und auf den Schiffen dann ein Script starten, hier erstmal der Ausschnitt:

[...]

Ich finde einfach keinen Fehler :(

Ich danke euch schonmal ;)

Gruß
Marc
Na dann wird da wohl auch kein Fehler sein...
Du erwartest doch nicht ernsthaft, das dir hier jetzt jmd. wirklich helfen kann?
Erstmal jede Menge zu lesen, dann werden dort zB Variablen benutzt deren Inhalt hier niemand weißsagen werden kann. Dann gehst du weder genauer drauf ein, was das Script machen soll noch sagst du was es stattdessen macht.
Und die Kristallkugel hat hier immer noch niemand - vermute ich zumindetst.

Also was kannst du machen? Besser nach Fehlern suchen. Überlegen welche Struktur dafür verantwortlich ist, dass das Script nicht geht und dann mit vielen vielen Logbucheinträgen(je mehr des so besser) das ganze durchgehen.
Oder du könntest auch den mehr oder weniger guten X2-Script-Debugger benutzen.
fennry
Posts: 1611
Joined: Wed, 6. Nov 02, 20:31
x3

Re: Problem mit einem Find-Ship Script - Erbitte Hilfe

Post by fennry »

StarTrekMarc wrote:Hallo Leute,

ich sitze nun seit Tagen an diesem Script hier und komme einfach nicht weiter, selbst Lucike weiß nicht so richtig Rat (nichts gegen ihn ;) ).

Vielleicht könnt ihr mir ja helfen, also, das Script soll alle Sektoren nach Schiffen durchsuchen und auf den Schiffen dann ein Script starten, hier erstmal der Ausschnitt:

Code: Select all

[...]

121 @  START [THIS] -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=Unbekannter Sektor
[...]
Ich hab zwar nicht die Ahnung aber sollte da wo Start steht nicht eine Variable stehen (z.B. $Schiff)?

So wie du das schreibst werden IMHO Mainscripte gestartet dann gehört aber auch vorher eine Abfrage dazu ob der Spieler dieses Script aktiviert haben will (AL Einstellungen)
ticaki
Posts: 4861
Joined: Wed, 6. Nov 02, 20:31
x3

Post by ticaki »

Zeile 154
START [THIS] <- falsch

START $Schiff <- richtig

Zeile 174
Falsch - damit übertunes du die Schiffe

Gruß ticaki
Zur Zeit nicht aktiv
User avatar
StarTrekMarc
Posts: 2143
Joined: Sat, 3. Apr 04, 16:38
x4

Post by StarTrekMarc »

Danke für die Antworten.

Also, erstmal sorry das ich nicht mehr Informationen gegeben habe.

@fennry

Die Scripte sind sub-scripte des Plugins, dafür brauch ich keine Einstellung.

@ticaki

Zeile 154 ect. verstehe ich, aber was meinst du mit ... ?
Zeile 174
Falsch - damit übertunes du die Schiffe
@Lucike

Stimmt ;)

Ich habe momentan wenig Zeit (trotz Ferien - muss in Latein einiges nachhohlen) und deshalb werd ich mich erst morgen hinsetzen und das alle überprüfen ;)

So, nun zu den Aufgaben des Scripts:

Zuerst werden die zu suchenden Schiffstypen gesetzt (Zeile 100-105), danach die Grundvariablen (Zeile 107-116)

Danach werden die Schiffe der Klasse M1 und M2 erstellt (Funktioniert). (Zeile 118-130)

Danach wird eine Sektor Schleife gestartet um in jedem Sektor zu suchen (ab Zeile 132)

Danach wird im Sektor nach M3..M5s gesucht. Die Schiffe kriegen default Items und ein Script wird gestartet, dass von nun an das Schiff kontrolliert.

Das wars dann auch schon, wie ichs genauer erklären soll weiß ich nicht ;)

Gruß
Marc
User avatar
StarTrekMarc
Posts: 2143
Joined: Sat, 3. Apr 04, 16:38
x4

Post by StarTrekMarc »

Nun, ich habe das Script mit euren Hinweisen überarbeitet und weitere Log Stellen eingebaut. Nun, das Problem liegt klar auf der Hand, die Sektor Schleife ist fehlerhaft.

Hier erstmal das angepasste Script:

Code: Select all

Script al.invasion.stm.attacker.ships
Version: 100
for Script Engine Version: 25

Description
AL-STM- Create Ships and Start Command Script
Arguments
1: Sektor , Var/Sector , 'Sektor' 
2: DatenArray , Value , 'DatenArray' 
3: AttackierendesVolk , Var/Race , 'AttackierendesVolk' 
Source Text

001   $CounterM1 = $DatenArray[3]
002   $CounterM2 = $DatenArray[4]
003   $CounterM3 = $DatenArray[5]
004   $CounterM4 = $DatenArray[6]
005   $CounterM5 = $DatenArray[7]
006   $CounterM6 = $DatenArray[8]
007   
008   write to log file #9953  append=[FALSE]  value='Ship Find Script - Zu suchende Anzahl an Schiffen - M1 - M6 von oben nach unten.'
009   write to log file #9953  append=[TRUE]  value=$CounterM1
010   write to log file #9953  append=[TRUE]  value=$CounterM2
011   write to log file #9953  append=[TRUE]  value=$CounterM3
012   write to log file #9953  append=[TRUE]  value=$CounterM4
013   write to log file #9953  append=[TRUE]  value=$CounterM5
014   write to log file #9953  append=[TRUE]  value=$CounterM6
015   write to log file #9953  append=[TRUE]  value='--------'
016   
017   $ShipTypes =  array alloc: size=6
018   
019   if $AttackierendesVolk == Argonen
020    $ShipTypes[0] = Argon Colossus
021    $ShipTypes[1] = Argon Titan
022    $ShipTypes[2] = Argon Nova
023    $ShipTypes[3] = Argon Buster
024    $ShipTypes[4] = Argon Discoverer
025    $ShipTypes[5] = Argon Zentaur
026    $ErstellungsSektor = Argon Prime
027   else if $AttackierendesVolk == Boronen
028    $ShipTypes[0] = Boron Hai
029    $ShipTypes[1] = Boron Rochen
030    $ShipTypes[2] = Boron Mako
031    $ShipTypes[3] = Boron Barrakuda
032    $ShipTypes[4] = Boron Oktopus
033    $ShipTypes[5] = Boron Hydra
034    $ErstellungsSektor = Königstal
035   else if $AttackierendesVolk == Teladi
036    $ShipTypes[0] = Teladi Kondor
037    $ShipTypes[1] = Teladi Phönix
038    $ShipTypes[2] = Teladi Falke
039    $ShipTypes[3] = Teladi Bussard
040    $ShipTypes[4] = Teladi Harrier
041    $ShipTypes[5] = Teladi Adler
042    $ErstellungsSektor = Profitbrunnen
043   else if $AttackierendesVolk == Split
044    $ShipTypes[0] = Split Raptor
045    $ShipTypes[1] = Split Python
046    $ShipTypes[2] = Split Skorpion
047    $ShipTypes[3] = Split Mamba
048    $ShipTypes[4] = Split Jaguar
049    $ShipTypes[5] = Split Drache
050    $ErstellungsSektor = Familienstolz
051   else if $AttackierendesVolk == Paraniden
052    $ShipTypes[0] = Paranid Zeus
053    $ShipTypes[1] = Paranid Odysseus
054    $ShipTypes[2] = Paranid Perseus
055    $ShipTypes[3] = Paranid Perikles
056    $ShipTypes[4] = Paranid Pegasus
057    $ShipTypes[5] = Paranid Nemesis
058    $ErstellungsSektor = Paranid Prime
059   else if $AttackierendesVolk == Xenon
060    $ShipTypes[0] = Xenon J
061    $ShipTypes[1] = Xenon K
062    $ShipTypes[2] = Xenon N
063    $ShipTypes[3] = Xenon L
064    $ShipTypes[4] = Xenon M
065    $ShipTypes[5] = Xenon N
066    $ErstellungsSektor = Xenon Sektor 596
067   else if $AttackierendesVolk == Khaak
068    $ShipTypes[0] = Unbekanntes Feindschiff
069    $ShipTypes[1] = Unbekanntes Feindschiff
070    $ShipTypes[2] = Unbekanntes Feindschiff
071    $ShipTypes[3] = Unbekanntes Feindschiff
072    $ShipTypes[4] = Unbekanntes Feindschiff
073    $ShipTypes[5] = Unbekanntes Feindschiff
074    $ErstellungsSektor = Unbekannter Sektor
075   else if $AttackierendesVolk == Piraten
076    $ZufallA = random value from 0 to 2 - 1
077    $ZufallB = random value from 0 to 2 - 1
078    $ZufallC = random value from 0 to 3 - 1
079    if $ZufallA == 0
080     $ShipTypes[0] = Teladi Kondor
081    else if $ZufallA == 1
082     $ShipTypes[0] = Split Raptor
083    end
084    if $ZufallB == 0
085     $ShipTypes[1] = Teladi Phönix
086    else if $ZufallB == 1
087     $ShipTypes[1] = Split Python
088    end
089    $ShipTypes[2] = Pirat Bayamon
090    $ShipTypes[3] = Pirat Orinoko
091    $ShipTypes[4] = Pirat Mandalay
092    if $ZufallC == 0
093     $ShipTypes[5] = Teladi Adler
094    else if $ZufallC == 1
095     $ShipTypes[5] = Paranid Nemesis
096    end
097    $ErstellungsSektor = LooManckStrats Vermächtnis
098   end
099   
100   $TypeM1 = $ShipTypes[0]
101   $TypeM2 = $ShipTypes[1]
102   $TypeM3 = $ShipTypes[2]
103   $TypeM4 = $ShipTypes[3]
104   $TypeM5 = $ShipTypes[4]
105   $TypeM6 = $ShipTypes[5]
106   
107   $CounterX = 0
108   $CounterY = 0
109   $ZCounterM1 = 0
110   $ZCounterM2 = 0
111   $ZCounterM3 = 0
112   $ZCounterM4 = 0
113   $ZCounterM5 = 0
114   $ZCounterM6 = 0
115   $SektorX = get max sectors in x direction
116   $SektorY = get max sectors in y direction
117   
118   while $ZCounterM1 < $CounterM1
119    $Schiff =  create ship: type=$TypeM1 owner=$AttackierendesVolk addto=$ErstellungsSektor x=0 y=100000 z=0
120    $Schiff -> add default items to ship
121 @  START [THIS] -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=Unbekannter Sektor
122    inc $ZCounterM1 = 
123   end
124   
125   while $ZCounterM2 < $CounterM2
126    $Schiff =  create ship: type=$TypeM2 owner=$AttackierendesVolk addto=$ErstellungsSektor x=0 y=100000 z=0
127    $Schiff -> add default items to ship
128 @  START [THIS] -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=Unbekannter Sektor
129    inc $ZCounterM2 = 
130   end
131   
132   while $CounterX <= $SektorX
133    while $CounterY <= $SektorY
134     
135     $SektorA = get sector from universe index: x=$CounterX, y=$CounterY
136     
137     write to log file #9953  append=[TRUE]  value=$SektorA
138     write to log file #9953  append=[TRUE]  value='--Sektor Suche--'
139     
140     $CounterA = 0
141     while $ZCounterM3 <= $CounterM3 AND $CounterA <= 25
142      $Schiff =  find ship: sector=$SektorA class or type=$TypeM3 race=$AttackierendesVolk flags=[Find.Random] refobj=null maxdist=null maxnum=null refpos=null
143      write to log file #9953  append=[TRUE]  value=$Schiff
144      if $Schiff != null
145       $Schiff -> add default items to ship
146 @     START $Schiff -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=$SektorA
147       inc $ZCounterM3 = 
148      else if not $Schiff
149       inc $CounterA = 
150      end
151     end
152     
153     $CounterA = 0
154     while $ZCounterM4 <= $CounterM4 AND $CounterA <= 25
155      $Schiff =  find ship: sector=$SektorA class or type=$TypeM4 race=$AttackierendesVolk flags=[Find.Random] refobj=null maxdist=null maxnum=null refpos=null
156      write to log file #9953  append=[TRUE]  value=$Schiff
157      if $Schiff != null
158       $Schiff -> add default items to ship
159 @     START $Schiff -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=$SektorA
160       inc $ZCounterM4 = 
161      else if not $Schiff
162       inc $CounterA = 
163      end
164     end
165     
166     $CounterA = 0
167     while $ZCounterM5 <= $CounterM5 AND $CounterA <= 25
168      $Schiff =  find ship: sector=$SektorA class or type=$TypeM5 race=$AttackierendesVolk flags=[Find.Random] refobj=null maxdist=null maxnum=null refpos=null
169      write to log file #9953  append=[TRUE]  value=$Schiff
170      if $Schiff != null
171       $Schiff -> add default items to ship
172 @     START $Schiff -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=$SektorA
173       inc $ZCounterM5 = 
174      else if not $Schiff
175       inc $CounterA = 
176      end
177     end
178     
179     $CounterA = 0
180     while $ZCounterM6 <= $CounterM6 AND $CounterA <= 25
181      $Schiff =  find ship: sector=$SektorA class or type=$TypeM6 race=$AttackierendesVolk flags=[Find.Random] refobj=null maxdist=null maxnum=null refpos=null
182      write to log file #9953  append=[TRUE]  value=$Schiff
183      if $Schiff != null
184       $Schiff -> add default items to ship
185 @     START $Schiff -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=$SektorA
186       inc $ZCounterM6 = 
187      else if not $Schiff
188       inc $CounterA = 
189      end
190     end
191     
192     inc $CounterY = 
193    end
194    inc $CounterX = 
195   end
196   
197   * Script by StarTrekMarc
198   
199   write to log file #9953  append=[TRUE]  value='--------'
200   write to log file #9953  append=[TRUE]  value='Gefundene Anzahl an Schiffen - M1 - M6 von oben nach unten.'
201   write to log file #9953  append=[TRUE]  value=$ZCounterM1
202   write to log file #9953  append=[TRUE]  value=$ZCounterM2
203   write to log file #9953  append=[TRUE]  value=$ZCounterM3
204   write to log file #9953  append=[TRUE]  value=$ZCounterM4
205   write to log file #9953  append=[TRUE]  value=$ZCounterM5
206   write to log file #9953  append=[TRUE]  value=$ZCounterM6
207   write to log file #9953  append=[TRUE]  value='--------'
208   return null
Anscheinend durchsucht er nur Sektoren die auf der Y-Achse liegen, also alles auf höhe von Königstal. Auch das er keine Schiffe findet gibt mir ein Rätsel auf :?:

Ich weiß aber auch nicht was an der Schleife falsch ist :gruebel:

Könnt ihr euch das bitte mal anschauen?

Zusatzinfo:
Angreifende Rasse: Xenon
Verteidigende Rasse: Split
Sektor: Njys Hinterhalt

Gruß
Marc
Last edited by StarTrekMarc on Thu, 27. Dec 12, 11:30, edited 1 time in total.
laprican
Posts: 196
Joined: Fri, 13. Feb 04, 16:56
x2

Post by laprican »

naja... wenn die innere Schleife einmal durchgelaufen ist, wird sie nie wieder durchlaufen, da $CounterY <= $SektorY dann immer wahr ist. Abhilfe schaft es wenn du vor Zeile 133 "$CounterY = 0" einfügen würdest.

Desweiteren meine ich mich zu erinnern, das man maxdist nicht auf null setzen darf, da der dann einfach von einem Maximalem Abstand von 0 ausgeht.
Und evtl. ist das Flag [Find.Multiple] etwas für dich.

Naja, und so viele Xenon gibt es in den westlichen sektoren halt nicht.
User avatar
StarTrekMarc
Posts: 2143
Joined: Sat, 3. Apr 04, 16:38
x4

Post by StarTrekMarc »

Es funktioniert :) Danke

Aber seltsam: Das Logfile wird komplett bis zum Ende des Scripte geschrieben und dann hängt der sich auf :(

Keine Ahnung warum :?:

Gruß
Marc

Code: Select all

Script al.invasion.stm.attacker.ships
Version: 100
for Script Engine Version: 25

Description
AL-STM- Create Ships and Start Command Script
Arguments
1: Sektor , Var/Sector , 'Sektor' 
2: DatenArray , Value , 'DatenArray' 
3: AttackierendesVolk , Var/Race , 'AttackierendesVolk' 
Source Text

001   $CounterM1 = $DatenArray[3]
002   $CounterM2 = $DatenArray[4]
003   $CounterM3 = $DatenArray[5]
004   $CounterM4 = $DatenArray[6]
005   $CounterM5 = $DatenArray[7]
006   $CounterM6 = $DatenArray[8]
007   
008   write to log file #9953  append=[FALSE]  value='Ship Find Script - Zu suchende Anzahl an Schiffen - M1 - M6 von oben nach unten.'
009   write to log file #9953  append=[TRUE]  value=$CounterM1
010   write to log file #9953  append=[TRUE]  value=$CounterM2
011   write to log file #9953  append=[TRUE]  value=$CounterM3
012   write to log file #9953  append=[TRUE]  value=$CounterM4
013   write to log file #9953  append=[TRUE]  value=$CounterM5
014   write to log file #9953  append=[TRUE]  value=$CounterM6
015   write to log file #9953  append=[TRUE]  value='--------'
016   
017   $ShipTypes =  array alloc: size=6
018   
019   if $AttackierendesVolk == Argonen
020    $ShipTypes[0] = Argon Colossus
021    $ShipTypes[1] = Argon Titan
022    $ShipTypes[2] = Argon Nova
023    $ShipTypes[3] = Argon Buster
024    $ShipTypes[4] = Argon Discoverer
025    $ShipTypes[5] = Argon Zentaur
026    $ErstellungsSektor = Argon Prime
027   else if $AttackierendesVolk == Boronen
028    $ShipTypes[0] = Boron Hai
029    $ShipTypes[1] = Boron Rochen
030    $ShipTypes[2] = Boron Mako
031    $ShipTypes[3] = Boron Barrakuda
032    $ShipTypes[4] = Boron Oktopus
033    $ShipTypes[5] = Boron Hydra
034    $ErstellungsSektor = Königstal
035   else if $AttackierendesVolk == Teladi
036    $ShipTypes[0] = Teladi Kondor
037    $ShipTypes[1] = Teladi Phönix
038    $ShipTypes[2] = Teladi Falke
039    $ShipTypes[3] = Teladi Bussard
040    $ShipTypes[4] = Teladi Harrier
041    $ShipTypes[5] = Teladi Adler
042    $ErstellungsSektor = Profitbrunnen
043   else if $AttackierendesVolk == Split
044    $ShipTypes[0] = Split Raptor
045    $ShipTypes[1] = Split Python
046    $ShipTypes[2] = Split Skorpion
047    $ShipTypes[3] = Split Mamba
048    $ShipTypes[4] = Split Jaguar
049    $ShipTypes[5] = Split Drache
050    $ErstellungsSektor = Familienstolz
051   else if $AttackierendesVolk == Paraniden
052    $ShipTypes[0] = Paranid Zeus
053    $ShipTypes[1] = Paranid Odysseus
054    $ShipTypes[2] = Paranid Perseus
055    $ShipTypes[3] = Paranid Perikles
056    $ShipTypes[4] = Paranid Pegasus
057    $ShipTypes[5] = Paranid Nemesis
058    $ErstellungsSektor = Paranid Prime
059   else if $AttackierendesVolk == Xenon
060    $ShipTypes[0] = Xenon J
061    $ShipTypes[1] = Xenon K
062    $ShipTypes[2] = Xenon N
063    $ShipTypes[3] = Xenon L
064    $ShipTypes[4] = Xenon M
065    $ShipTypes[5] = Xenon N
066    $ErstellungsSektor = Xenon Sektor 596
067   else if $AttackierendesVolk == Khaak
068    $ShipTypes[0] = Unbekanntes Feindschiff
069    $ShipTypes[1] = Unbekanntes Feindschiff
070    $ShipTypes[2] = Unbekanntes Feindschiff
071    $ShipTypes[3] = Unbekanntes Feindschiff
072    $ShipTypes[4] = Unbekanntes Feindschiff
073    $ShipTypes[5] = Unbekanntes Feindschiff
074    $ErstellungsSektor = Unbekannter Sektor
075   else if $AttackierendesVolk == Piraten
076    $ZufallA = random value from 0 to 2 - 1
077    $ZufallB = random value from 0 to 2 - 1
078    $ZufallC = random value from 0 to 3 - 1
079    if $ZufallA == 0
080     $ShipTypes[0] = Teladi Kondor
081    else if $ZufallA == 1
082     $ShipTypes[0] = Split Raptor
083    end
084    if $ZufallB == 0
085     $ShipTypes[1] = Teladi Phönix
086    else if $ZufallB == 1
087     $ShipTypes[1] = Split Python
088    end
089    $ShipTypes[2] = Pirat Bayamon
090    $ShipTypes[3] = Pirat Orinoko
091    $ShipTypes[4] = Pirat Mandalay
092    if $ZufallC == 0
093     $ShipTypes[5] = Teladi Adler
094    else if $ZufallC == 1
095     $ShipTypes[5] = Paranid Nemesis
096    end
097    $ErstellungsSektor = LooManckStrats Vermächtnis
098   end
099   
100   $TypeM1 = $ShipTypes[0]
101   $TypeM2 = $ShipTypes[1]
102   $TypeM3 = $ShipTypes[2]
103   $TypeM4 = $ShipTypes[3]
104   $TypeM5 = $ShipTypes[4]
105   $TypeM6 = $ShipTypes[5]
106   
107   $MaxDist = 500000
108   $CounterX = 0
109   $CounterY = 0
110   $ZCounterM1 = 0
111   $ZCounterM2 = 0
112   $ZCounterM3 = 0
113   $ZCounterM4 = 0
114   $ZCounterM5 = 0
115   $ZCounterM6 = 0
116   $SektorX = get max sectors in x direction
117   $SektorY = get max sectors in y direction
118   
119   while $ZCounterM1 < $CounterM1
120    $Schiff =  create ship: type=$TypeM1 owner=$AttackierendesVolk addto=$ErstellungsSektor x=0 y=100000 z=0
121    $Schiff -> add default items to ship
122 @  START $Schiff -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=Unbekannter Sektor
123    inc $ZCounterM1 = 
124   end
125   
126   while $ZCounterM2 < $CounterM2
127    $Schiff =  create ship: type=$TypeM2 owner=$AttackierendesVolk addto=$ErstellungsSektor x=0 y=100000 z=0
128    $Schiff -> add default items to ship
129 @  START $Schiff -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=Unbekannter Sektor
130    inc $ZCounterM2 = 
131   end
132   
133   while $CounterX <= $SektorX
134    
135    $CounterY = 0
136    
137    while $CounterY <= $SektorY
138     
139     $SektorA = get sector from universe index: x=$CounterX, y=$CounterY
140     
141     write to log file #9953  append=[TRUE]  value='--------'
142     write to log file #9953  append=[TRUE]  value=$SektorA
143     write to log file #9953  append=[TRUE]  value='--------'
144     
145     if $SektorA
146      
147      write to log file #9953  append=[TRUE]  value='--Sektor Suche--'
148      
149      $CounterA = 0
150      while $ZCounterM3 <= $CounterM3 AND $CounterA <= 25
151       $Schiff =  find ship: sector=$SektorA class or type=$TypeM3 race=$AttackierendesVolk flags=[Find.Random] refobj=null maxdist=$MaxDist maxnum=null refpos=null
152       write to log file #9953  append=[TRUE]  value=$Schiff
153       if $Schiff != null
154        $Schiff -> add default items to ship
155 @      START $Schiff -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=$SektorA
156        inc $ZCounterM3 = 
157       else if not $Schiff
158        inc $CounterA = 
159       end
160      end
161      
162      $CounterA = 0
163      while $ZCounterM4 <= $CounterM4 AND $CounterA <= 25
164       $Schiff =  find ship: sector=$SektorA class or type=$TypeM4 race=$AttackierendesVolk flags=[Find.Random] refobj=null maxdist=$MaxDist maxnum=null refpos=null
165       write to log file #9953  append=[TRUE]  value=$Schiff
166       if $Schiff != null
167        $Schiff -> add default items to ship
168 @      START $Schiff -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=$SektorA
169        inc $ZCounterM4 = 
170       else if not $Schiff
171        inc $CounterA = 
172       end
173      end
174      
175      $CounterA = 0
176      while $ZCounterM5 <= $CounterM5 AND $CounterA <= 25
177       $Schiff =  find ship: sector=$SektorA class or type=$TypeM5 race=$AttackierendesVolk flags=[Find.Random] refobj=null maxdist=$MaxDist maxnum=null refpos=null
178       write to log file #9953  append=[TRUE]  value=$Schiff
179       if $Schiff != null
180        $Schiff -> add default items to ship
181 @      START $Schiff -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=$SektorA
182        inc $ZCounterM5 = 
183       else if not $Schiff
184        inc $CounterA = 
185       end
186      end
187      
188      $CounterA = 0
189      while $ZCounterM6 <= $CounterM6 AND $CounterA <= 25
190       $Schiff =  find ship: sector=$SektorA class or type=$TypeM6 race=$AttackierendesVolk flags=[Find.Random] refobj=null maxdist=$MaxDist maxnum=null refpos=null
191       write to log file #9953  append=[TRUE]  value=$Schiff
192       if $Schiff != null
193        $Schiff -> add default items to ship
194 @      START $Schiff -> call script 'al.invasion.stm.attacker.cmd' :  Ship=$Schiff  Sector=$Sektor  Home=$SektorA
195        inc $ZCounterM6 = 
196       else if not $Schiff
197        inc $CounterA = 
198       end
199      end
200      
201     end
202     
203     inc $CounterY = 
204    end
205    inc $CounterX = 
206   end
207   
208   * Script by StarTrekMarc
209   
210   write to log file #9953  append=[TRUE]  value='--------'
211   write to log file #9953  append=[TRUE]  value='Gefundene Anzahl an Schiffen - M1 - M6 von oben nach unten.'
212   write to log file #9953  append=[TRUE]  value=$ZCounterM1
213   write to log file #9953  append=[TRUE]  value=$ZCounterM2
214   write to log file #9953  append=[TRUE]  value=$ZCounterM3
215   write to log file #9953  append=[TRUE]  value=$ZCounterM4
216   write to log file #9953  append=[TRUE]  value=$ZCounterM5
217   write to log file #9953  append=[TRUE]  value=$ZCounterM6
218   write to log file #9953  append=[TRUE]  value='--------'
219   return null
laprican
Posts: 196
Joined: Fri, 13. Feb 04, 16:56
x2

Post by laprican »

StarTrekMarc wrote:Es funktioniert :) Danke

Aber seltsam: Das Logfile wird komplett bis zum Ende des Scripte geschrieben und dann hängt der sich auf :(

Keine Ahnung warum :?:

Gruß
Marc
Tja... da du keine waits eingebaut hast, läuft dein script bis zum ende durch, und dann wird ein anderes gestartet, unteranderm deine frisch gestarteten Scripte. Daher würd ich mal sagen, du hast da ne Endlosschleife drin.
User avatar
StarTrekMarc
Posts: 2143
Joined: Sat, 3. Apr 04, 16:38
x4

Post by StarTrekMarc »

Danke, du hattest Recht ;)

Gruß
Marc

Return to “X²: Die Bedrohung - Scripts und Modding”