endsub

This forum serves as MSCI Reference at EGOSOFT. It's Read-Only for non MSCI Group members.

Moderators: Scripting / Modding Moderators, MSCI Moderators

Locked
mark_a_condren
Posts: 1385
Joined: Wed, 3. Aug 05, 05:05

endsub

Post by mark_a_condren » Fri, 10. Sep 10, 17:36

endsub


Used in conjunction with a gosub statement.
Allows you to define the return point of the gosub statement.


Example:

write to player logbook = 1
write to player logbook = 2

gosub mix.numbers
write to player logbook = 3
write to player logbook = 4

return null

mix.numbers:
write to player logbook = 5
endsub


In this case the numbers would be written to the logbook in the following order, 1, 2, 5, 3 and 4 due to the 'gosub' causing 3 and 4 to be put after 5. After 5 was written the 'endsub' statement causes a return to immediatly below the 'gosub' statement resulting in 3 and 4 being written after 5. (5 would not be written twice due to the 'return null' being encountered)


Command Location:

Alex Vanderbilt
Winner X3 Sektorquest
Posts: 2119
Joined: Thu, 4. May 06, 12:07

[TiP][49] 286649

Post by Alex Vanderbilt » Sat, 2. Oct 10, 18:18

endsub

Dieses Kommando wird in Verbindung mit einer gosub-Aussage verwendet. Es ermöglicht dir, den Umkehrpunkt des Skriptes festzulegen.

Beispiel:

write to player logbook = 1
write to player logbook = 2

gosub mix.numbers write to player logbook = 3
write to player logbook = 4

return null

mix.numbers:
write to player logbook = 5
endsub

In diesem Fall würden die wie folgt in das Logbuch geschrieben: 1; 2; 5; 3 und 4, da aufgrund der gosub-Anweisung von 2 zu 5 gesprungen wird, und das Skript nach dem endsub wieder zu 3 und 4 zurückkehrt. Das "return null" verhindert, dass 5 doppelt in das Logbuch geschrieben wird.


Zu finden unter:

User avatar
Juggernaut93
Posts: 2529
Joined: Sun, 17. Jul 11, 21:03

[39]286649

Post by Juggernaut93 » Wed, 23. May 12, 14:35

endsub


Usato insieme a un'istruzione gosub.
Ti permette di definire il punto di 'return' di un'istruzione gosub.


Esempio:

write to player logbook = 1
write to player logbook = 2

gosub mix.numbers
write to player logbook = 3
write to player logbook = 4

return null

mix.numbers:
write to player logbook = 5
endsub


In questo caso i numeri sarebbero scritti nel diario di bordo nell'ordine 1, 2, 5, 3 e 4 poiché il 'gosub' fa in modo che il 3 e il 4 siano scritti dopo il 5. Dopo che il 5 è stato scritto, l'istruzione 'endsub' fa ritornare lo script immediatamente sotto l'istruzione 'gosub', con il risultato che il 3 e il 4 vengono scritti dopo il 5. (Il 5 non viene scritto due volte poiché si incontra il 'return null')


Posizione dell'istruzione nella lista:

Locked

Return to “MSCI Reference”