<RetVar/IF> get task ID

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> get task ID

Post by mark_a_condren » Wed, 8. Sep 10, 16:30

[skip|else] if [not]|while [not]| <RetVar/IF> = get task ID


[skip|else] if [not]|while [not]| = The possible 'Conditional' statements that can be used with this command.
<RetVar/IF> = Command return, with an 'if' statement used it will be TRUE (1) if condition passes or FALSE (0) if it fails, otherwise if you use a Variable it will be the task ID as an integer.


A further explanation of the "If" statement,
The 'if' statement is false, when it runs on task 0 (and maybe for global tasks? It is suspected they are task 0 as well), otherwise it will return "true" when task is 1+ (i.e. not main task, not global script).

Returns the current task's ID number.
Task zero is always the “main” task of an object.
When you give a normal navigation, combat, or trade command to a ship, for example, the script that carries out that order runs on task zero of the target object.

Tasks one through six run scripts for turrets one through six.
Tasks ten and eleven are used for the scripts that run from a ship's “additional ship commands” menu.
Tasks eleven to nineteen are used for Station Commands.
Task 33: turret weapon switching task of AI ships.

One way to find a free task is to ask the engine for the “next free task”.
The other way is to use the ID of your script's TFile. This already is a unique number in the 7000-9999 range so there will be no collisions.
If you need more than one, you can simply keep counting up. 7046, 17046, 27046...


Example:

$task.ID = get task ID

$task.ID will be an integer representing the scripts current task ID.


Command Location:
Last edited by mark_a_condren on Tue, 28. Sep 10, 15:19, edited 4 times in total.

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

[TiP][49] 286466

Post by X2-Illuminatus » Sat, 18. Sep 10, 16:41

[skip|else] if [not]|while [not]| <RetVar/IF> = get task ID


[skip|else] if [not]|while [not]| = Die möglichen bedingten Anweisungen, die mit diesem Befehl genutzt werden können.
<RetVar/IF> = Rückgabewert des Befehls, mit einer 'if' Anweisung wird dieser TRUE (1) (wahr) sein, wenn die Bedingung erfüllt ist oder FALSE (0) (falsch), wenn nicht. Andernfalls, wenn eine Variable genutzt wird, wird er die task ID als ganze Zahl zurückgeben.


Gibt die ID Nummer des entsprechenden Tasks zurück.
Task null ist immer der "Haupt"-Task eines Objekts.
Wenn du einem Schiff einen normalen Navigations-, Kampf- oder Handelsbefehl gibt, wird das Script, das diesen Befehl ausführt, auf Task null des Zielobjekts laufen.

Auf den Tasks eins bis sechs laufen Scripte für die Geschützkanzeln eins bis sechs.
Die Tasks zehn und elf werden für die Scripte genutzt, die über das "Erweiterte Schiffskommando" Menü eines Schiffes laufen.
Tasks 11 bis 19 werden für die Stationskommandos genutzt.
Task 33 ist für das Wechseln der Waffen in den Geschützkanzeln der KI Schiffe zuständig.

Eine Möglichkeit einen freien Task zu finden, ist die Engine nach dem "next free task" (nächsten freien Task) zu fragen.
Eine andere ist die ID der t-Datei deines scriptes zu nutzen. Diese ist bereits eine einzigartige Zahl im Bereich von 7000-9999. Somit wird es keine Kollisionen geben.
Falls du mehr als eine benötigen solltest, kannst du einfach aufwärts zählen: 7046, 17046, 27046...


Beispiel:

$task.ID = get task ID


$task.ID wird die Task ID des zurzeit laufenden Scriptes als ganze Zahl sein.


Zu finden unter:

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

[39]286466

Post by Juggernaut93 » Wed, 6. Jun 12, 16:59

[skip|else] if [not]|while [not]| <RetVar/IF> = get task ID


[skip|else] if [not]|while [not]| = La possibile istruzione condizionale che può essere usata con questo comando.
<RetVar/IF> = Ciò che restituisce il comando; se si usa un'istruzione 'if' sarà TRUE (1) se la condizione si verifica o FALSE (0) se fallisce; se invece usi una variabile, essa assumerà il valore intero dell'ID del task.


Un'ulteriore spiegazione dell'istruzione "If".
L'istruzione "if" è falsa quando è eseguita su un task 0 (e probabilmente anche per i task globali, poiché si pensa che anch'essi siano task 0), altrimenti restituirà "true" quando il task è maggiore o uguale a 1 (cioè quando non è un task principale o uno script globale).


Restituisce il numero di ID del task corrente.
Un task zero è sempre il task "principale" di un oggetto.
Ad esempio, quando dai un normale comando di navigazione, commercio o combattimento ad una nave lo script che esegue tale ordine è eseguito su un task 0 dell'oggetto.


I task dall'uno al sei eseguono script per le torrette da uno a sei.
I task dieci e undici vengono usati per gli script in esecuzione dal menu "Comandi Navi Aggiuntivi" della nave.
I task dall'undici al diciannove sono usati per i "Comandi Stazione".
Il task 33 è invece il task che si occupa del cambio armi delle torrette sulle navi dell'IA.


Un modo per trovare un task libero è quello di chiedere al motore il "next free task" (task libero successivo).
L'altro modo è invece quello di usare l'ID del T-File del tuo script. Esso è infatti un numero univoco compreso nel range 7000-9999 e dunque non ci saranno conflitti.
Se te ne servono più di uno, puoi semplicemente continuare a contare come nel seguente esempio: 7046, 17046, 27046...


Esempio:

$task.ID = get task ID

$task.ID sarà un intero che rappresenterà l'ID del task dello script corrente.


Posizione del comando nella lista:

Locked

Return to “MSCI Reference”