<RetVar/IF/START> = <RefObj> call script <Script Name>: [<Parameter>=<Value>] [...]

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: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

<RetVar/IF/START> = <RefObj> call script <Script Name>: [<Parameter>=<Value>] [...]

Post by mark_a_condren » Fri, 31. Dec 10, 03:23

@ START|[skip|else] if [not]|while [not]| <RetVar/IF/START> = <RefObj> call script <Script Name>: [<Parameter>=<Value>] [...]


START|[skip|else] if [not]|while [not]| = The possible 'Conditional' statements that can be used with this command.
<RetVar> = If the called script is to 'return' information.
<RefObj> = The 'Object' that the called script is to be run on.
<Script Name> = The script that is to be 'called'.
<Parameter> = The arguments that are to be passed to the 'called' script, if any.


Use this command to call another script from a currently running script. Dependant on the first 'Parameter' used ie START or <RetVar> etc, the called script will be run concurrently with the calling script or the calling script will wait for the called script to finish and return before continuing.

Without START, the script is called to run on the same object and task ID as the calling script.
The calling script is still on the stack but the called script is now on top of the stack and will run until it quits and returns control back to the calling script with a return.

<RefObj> is ignored unless you use START.

Using START and a <RefObj> of null, will run the script as an independent global script.
Global scripts are more difficult to control because they cannot be detected by other scripts.

Using START and an existing <RefObj> will kill all task 0 scripts on <RefObj> and start this script on task 0 instead.
Not all objects are valid. Asteroids and missiles are examples of invalid objects.

A script cannot overwrite itself so a task 0 script can not START on a <RefObj> = [THIS].

START spawns a new process instead of “calling” on top of the current one so control is returned to the calling script immediately.

An '@' character in a scripting statement marks an “interrupt point”.

A return variable can be assigned to the value returned by the called script.
In this case, whatever value is passed to the return statement in the called script is assigned to the specified variable in the calling script. The result of the call can also be used as a condition in an if, skip, or while.
If this is done, then the result can only be tested for whether or not it is null. If it isn't null, then the conditional test passes. If it is null, then it fails.

A 'called' script may have up to 10 arguments, dependant on how many were used when the script was written. All arguments must have their parameter set, this may however be as simple as null if the called script was written to allow for this.


Examples:

@ START = $ship call script The.script.i.want.to.run : argument 1: $do.this, argument 2: $then.do.this ....

Starts the 'called' script The.script.i.want.to.run on the 'object' $ship and pass it the arguments $do.this and $then.do.this. This will result in the 'called' script running concurrently with the 'calling' script. The 'calling' script will continue on while the 'called' script does its thing.

-----------------------------------

@ $return = $ship call script The.script.i.want.to.run : argument 1: $do.this, argument 2: $then.do.this ....

The 'called' script The.script.i.want.to.run will be run and passed the arguments $do.this and $then.do.this. This will result in the 'called' script running sequentially with the 'calling' script. The 'calling' script will wait while the 'called' script does its thing and will only continue on after the 'called' script has finished and returned the variable $return (or the 'called' script is stopped).

-----------------------------------

@ = $ship call script The.script.i.want.to.run : argument 1: $do.this, argument 2: $then.do.this ....

OR

$anull = null
@ = $anull call script The.script.i.want.to.run : argument 1: $do.this, argument 2: $then.do.this ....

As above but, the 'calling' script will wait for the 'called' script to finish, but no return is required by the 'calling' script.

To obtain the '=' without having 'null' or a '$return.variable' there you select 'No return variable' from the list of possible conditional statements at the bottom of the SE menu.

$anull = null is used to allow the insertion of null in place of a <RefObj> to set the script to run as a 'Global Script'.
null is inserted instead of a <RefObj> in this instance.


Command Location:
  • »» General Commands
    • »» Script Calls
      @ <RetVar/IF/START><RefObj> call script <Script Name> : <Parameter>

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24949
Joined: Sun, 2. Apr 06, 16:38
x4

[TiP][49] 294204

Post by X2-Illuminatus » Tue, 4. Oct 11, 18:09

@ START|[skip|else] if [not]|while [not]| <RetVar/IF/START> = <RefObj> call script <Script Name>: [<Parameter>=<Value>] [...]


START|[skip|else] if [not]|while [not]| = Die möglichen bedingten Anweisungen, die mit diesem Befehl genutzt werden können.
<RetVar> = Nutze eine Variable, wenn der Befehl eine Information zurückgeben soll.
<RefObj> = Das Objekt, auf dem das aufgerufene Script laufen soll.
<Script Name> = Das Script, das aufgerufen werden soll.
<Parameter> = Die Argumente, falls vorhanden, die dem aufgerufenen Script übergeben werden sollen.


Nutze diesen Befehl, um ein anderes Script aus dem aktuell laufenden Script heraus aufzurufen. Abhängig vom ersten genutzten Parameter, z.B. START oder <RetVar>, wird das aufgerufene Script zur gleichen Zeit wie das aufrufende Script laufen oder das aufrufende Script wird warten, bis das aufgerufene Script beendet wurde, ehe es selbst weiterläuft.

Ohne den Parameter START wird ein Script auf dem gleichen Objekt mit der gleichen task ID aufgerufen wie das aufrufende Script.
Das aufrufende und das aufgerufene Script befinden sich auf dem gleichen stack, wobei letzteres ganz oben ist, ausgeführt wird, bis es endet, und schlussendlich einen Rückgabewert sowie die Kontrolle zurück an das aufrufende Script übergibt.

Das <RefObj> wird ignoriert, solange der START-Parameter nicht genutzt wird.

Nutzt man START sowie null als <RefObj>, so wird das Script unabhängig als globales Script gestartet. Globale Scripte sind schwieriger zu kontrollieren, da sie von anderen Scripten nicht erkannt werden können.

Nutzt man START zusammen mit einem existierenden <RefObj>, so werden alle Scripte auf task 0 auf dem <RefObj> beendet and und dieses Script wird stattdessen auf task 0 gestartet.
Nicht alle Objekte können als <RefObj> verwendet werden. Asteroiden und Raketen sind Beispiele für ungültige Objekte.

Ein Script kann sich nicht selbst überschreiben. Somit kann ein Script auf task 0 nicht auf einem <RefObj> = dem aktuellen <RefObj> starten ( START on a <RefObj> = [THIS] ).

START erstellt einen neuen Prozess anstatt einen auf dem aktuellen aufzurufen. Somit wird die Kontrolle sofort dem aufrufenden Script zurückgegeben.

Ein "@"-Zeichen in einer Script-Anweisung markiert einen Unterbrechungspunkt.

Eine Variable kann dem Rückgabewert des aufgerufenen Scripts zugewiesen werden. In diesem Fall wird jeglicher Wert der vom aufgerufenen Script zurückgegeben wird, in der Variable im aufrufenden Script gespeichert. Dieser Rückgabewert kann auch als Bedingung für eine if, skip, or while Anweisung genutzt werden. Tut man dies, so kann das Ergebnis nur darauf getestet werden, ob es null ist oder nicht, d.h. ob die Bedingung zutrifft (ungleich null) oder nicht zutrifft (null)

Ein aufgerufenes Script kann bis zu 10 Argumente haben - abhängig davon, wie viele beim Schreiben des Scriptes angegeben wurden. Allen Argumenten muss ein Wert zugewiesen werden, damit das Script aufgerufen werden kann. Im einfachsten Fall heißt das, überall null eintragen, für den Fall dass das Script diese Eingaben unterstützt.


Beispiele:

@ START = $ship call script The.script.i.want.to.run : argument 1: $do.this, argument 2: $then.do.this ....

Startet das Script The.script.i.want.to.run auf dem Objekt $ship und übergibt die Argumente $do.this und $then.do.this. Dies wird dazu führen, dass sowohl das aufgerufene als auch das aufrufende Script gleichzeitig weiterlaufen.

-----------------------------------

@ $return = $ship call script The.script.i.want.to.run : argument 1: $do.this, argument 2: $then.do.this ....

Das aufgerufene Script The.script.i.want.to.run wird gestartet und es werden die Argumente $do.this sowie $then.do.this übergeben. In diesem Beispiel wird das aufrufende Script auf das aufgerufene Script warten. Nachdem das aufgerufene Script beendet wurde und dessen Rückgabewert in der Variable $return gespeichert worden ist, wird das aufrufene Script weiterlaufen.

-----------------------------------

@ = $ship call script The.script.i.want.to.run : argument 1: $do.this, argument 2: $then.do.this ....

ODER

$anull = null
@ = $anull call script The.script.i.want.to.run : argument 1: $do.this, argument 2: $then.do.this ....

Wie oben wird das aufrufende Script warten bis das aufgerufene Script beendet wurde. Allerdings wird hier kein Rückgabewert benötigt.

Um das Zeichen = ohne null oder eine Rückgabevariable $return.variable dort stehen zu haben, muss man "No return variable" in der Liste der möglichen bedingten Anweisungen im SE Menü auswählen.

Die Variable $anull = null wird genutzt, um null als <RefObj> auswählen zu können, damit das Script als globales Script laufen kann.


Zu finden unter:
  • »» General Commands
    • »» Script Calls
      @ <RetVar/IF/START><RefObj> call script <Script Name> : <Parameter>

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

[39]294204

Post by Juggernaut93 » Thu, 12. Jul 12, 00:40

@ START|[skip|else] if [not]|while [not]| <RetVar/IF/START> = <RefObj> call script <Script Name>: [<Parameter>=<Value>] [...]


START|[skip|else] if [not]|while [not]| = La possibile istruzione condizionale che può essere usata con questo comando.
<RetVar> = Se lo script chiamato restituisce un valore, lo assegna a tale variabile.
<RefObj> = L'oggetto su cui verrà eseguito lo script chiamato.
<Script Name> = Lo script che deve essere chiamato.
<Parameter> = Gli argomenti, se presenti, che devono essere passati allo script chiamato.


Usa questo comando per chiamare un altro script dallo script corrente. In base al primo parametro usato (cioè START, <RetVar>, ecc.) lo script chiamato verrà eseguito contemporaneamente allo script chiamante oppure lo script chiamante aspetterà che lo script chiamato finisca e ritorni prima di continuare.

Senza lo START, lo script chiamato viene eseguito sullo stesso oggetto e ID di task dello script chiamante.
Lo script chiamante è ancora sullo stack, ma lo script chiamato è ora in cima allo stack e sarà eseguito finché non uscirà e restituirà il controllo allo script chiamante con un 'return'.

<RefObj> viene ignorato se non usi START.

Usando START e un <RefObj> di valore null lo script sarà eseguito come uno script globale indipendente.
Gli script globali sono molto difficili da controllare perché non possono essere rilevati da altri script.

Usando START e un <RefObj> esistente, saranno terminati tutti gli script di task 0 sul <RefObj> e lo script partirà sul task 0.
Non tutti gli oggetti sono validi. Asteroidi e missili sono esempi di oggetti non validi.

Uno script non può sovrascrivere se stesso, perciò uno script di task 0 non può avviare con START uno script su un <RefObj> = [THIS].

Lo START avvia un nuovo processo invece di "chiamarne" uno in cima a quello attuale, perciò il controllo viene restituito allo script chiamante immediatamente.

Un carattere '@' in un'istruzione riguardante uno script segna un "punto di interruzione".

Una variabile di ritorno può essere assegnata al valore restituito dallo script chiamato.
In questo caso, qualunque valore sia passato all'istruzione di ritorno nello script chiamato viene assegnato alla variabile specificata nello script chiamante. Il risultato della chiamata può anche essere usato come condizione in un 'if', 'skip' o 'while'.
Se si fa ciò, il risultato può essere solamente testato per verificare se è o non è nullo. Se non è nullo, il test condizionale viene superato. Se è nullo, fallisce.

Uno script chiamato può accettare fino a 10 argomenti, in base a quanti ne sono stati usati quando lo script è stato scritto. Devono essere impostati i parametri di tutti gli argomenti; essi possono accettare anche il valore null se lo script chiamato lo permette.


Esempi:

@ START = $ship call script The.script.i.want.to.run : argument 1: $do.this, argument 2: $then.do.this ....

Avvia lo script chiamato The.script.i.want.to.run sull'oggetto $ship e gli passa gli argomenti $do.this e $then.do.this.
In questo modo lo script chiamato sarà eseguito contemporaneamente allo script chiamante. Lo script chiamante continuerà mentre lo script chiamato farà le sue cose.

-----------------------------------

@ $return = $ship call script The.script.i.want.to.run : argument 1: $do.this, argument 2: $then.do.this ....

Lo script chiamato The.script.i.want.to.run sarà eseguito, passandogli gli argomenti $do.this e $then.do.this. In questo modo lo script chiamato sarà eseguito in sequenza con lo script chiamante. In pratica lo script chiamante attenderà mentre lo script chiamato farà le sue cose e continuerà solo dopo che lo script chiamato avrà finito e avrà restituito la variabile $return (o se lo script chiamato viene interrotto).

-----------------------------------

@ = $ship call script The.script.i.want.to.run : argument 1: $do.this, argument 2: $then.do.this ....

OPPURE

$anull = null

@ = $anull call script The.script.i.want.to.run : argument 1: $do.this, argument 2: $then.do.this ....

Come sopra, lo script chiamante aspetterà che lo script chiamato finisca, ma nessun valore di ritorno è richiesto dallo script chiamante.

Per ottenere il '=' senza avere 'null' o una '$return.variable' bisogna selezionare 'No return variable' ('Nessuna variabile di ritorno') dalla lista delle possibili istruzioni condizionali in fondo al menu dello SE.

$anull = null è usato per permettere l'inserimento di null al posto di un <RefObj> per fare in modo che lo script sia eseguito come un 'Global Script' ('Script Globale').
null è inserito al posto di un <RefObj> in questo caso.


Posizione dell'istruzione nella lista:
  • »» General Commands
    • »» Script Calls
      @ <RetVar/IF/START><RefObj> call script <Script Name> : <Parameter>

Locked

Return to “MSCI Reference”