<RetVar/IF> <RefObj> exists

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

Moderators: Scripting / Modding Moderators, MSCI Moderators

Locked
User avatar
Serial Kicked
Posts: 3823
Joined: Fri, 12. Aug 05, 20:46
x3tc

<RetVar/IF> <RefObj> exists

Post by Serial Kicked » Wed, 8. Sep 10, 23:38

[skip|else] if [not]|while [not]|<RetVar> = <RefObj> -> exists


[skip|else] if [not]|while [not]| = Possible 'conditional' statements that can be used
<RetVar> = variable where the requested information is put
<RefObj> = The object you want to check


Returns [TRUE] if <RefObj> exists and null otherwise. This should be widely used in scripts, it's not because an object exists at the beginning of your script that it will still be around at the middle or the end.


Example
  • if $ship -> exists
    | $ship -> set homebase to $station
    end
Check if the $ship exists before changing its homebase.


Command Location:

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

[TiP][49] 286503

Post by Alex Vanderbilt » Fri, 24. Sep 10, 12:31

[skip|else] if [not]|while [not]|<RetVar> = <RefObj> -> exists

[skip|else] if [not]|while [not]| = Eine mögliche Bedingung, die mit diesem Kommando verwendet werden kann.
<RetVar> = Die Variable, in die die Informationen abgelegt werden.
<RefObj> = Das Objekt, das Du überprüfen willst.

Gibt [TRUE] (Wahr) zurück, wenn <RefObj> existiert, oder null falls nicht. Dieses Kommando sollte man unbedingt in Skripten einsetzen, um zu überprüfen, ob ein Schiff, das zu Beginn der Ausführung des Skripts vorhanden ist, auch noch während der Ausführung und am Ende vorhanden ist.

Beispiel:

if $ship -> exists
| $ship -> set homebase to $station
end

Hier wird überprüft, ob $ship exisitert, bevor dessen Heimatbasis geändert wird.


Zu finden unter:

User avatar
Capux
Posts: 2456
Joined: Sat, 31. Oct 09, 21:17
x4

[34]286503

Post by Capux » Tue, 28. Sep 10, 20:42

[skip|else] if [not]|while [not]| <RetVar> = <RefObj> -> exists


[skip|else] if [not]|while [not]| = Istruzione condizionale che può essere usata.
<RetVar> = Variabile dove finisce l'informazione chiesta.
<RefObj> = L'oggetto a cui applicare il comando.


Restituisce [TRUE] se <RefObj> esiste e null in caso contrario. Questo dovrebbe essere largamente usato negli script, non tanto per verificare se l'oggetto esiste all'inizio dell'esecuzione ma quanto per controllare se esiste ancora a metà esecuzione o alla fine.

Esempio

if $ship -> exists
| $ship -> set homebase to $station
end

Controlla se $ship esiste prima di cambiargli base.


Posizione dell'istruzione nella lista::

Locked

Return to “MSCI Reference”