<RetVar/IF> <RefObj> get ware type code of object

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

Moderators: Scripting / Modding Moderators, MSCI Moderators

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

<RetVar/IF> <RefObj> get ware type code of object

Post by Serial Kicked »

[skip|else] if [not]|while [not]|<RetVar> = <RefObj> -> get ware type code of object


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


Every space object has an associated ware that can be said to reflect the type of object it is. This command returns the ware type associated with <RefObj>. If you use this command on a ship, you'll get its ship type. Same for stations. If you use it one a flying missile you will get the corresponding ware.

If the <RefObj> doesn't exist the result is Unknown Object


Example
  • $missile = [PLAYERSHIP] -> find nearest missile aiming to me
    if $missile -> exists
    | $ware = $missile -> get ware type code of object
    | = [PLAYERSHIP] -> add 1 units of $ware
    | $missile -> destruct: show no explosion= [TRUE]
    end
This small script will check for the nearest incoming missile of the player ship and put it in its cargo bay.


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

[TiP][49] 286509

Post by X2-Illuminatus »

[skip|else] if [not]|while [not]|<RetVar> = <RefObj> -> get ware type code of object


[skip|else] if [not]|while [not]| = Die möglichen bedingten Anweisungen, die mit diesem Befehl genutzt werden können - haben aber keinen wirklichen praktischen Nutzen haben.
<RetVar> = Variable, in der die geforderte Information gespeichert wird.
<RefObj> = Das Objekt, das überprüft werden soll.


Jedes Objekt im Weltraum hat eine zugehörige Ware, die widerspiegelt, um was für einen Objekttyp es sich dabei handelt. Dieser Befehl gibt den <RefObj> zugehörigen Warentyp zurück. Wenn dieser Befehl auf ein Schiff angewendet wird, erhält man den Schiffstyp (ship type). Das Gleiche gilt für Stationen. Wenn er auf eine gerade fliegende Rakete angewendet wird, erhält man die entsprechende Ware.

Wenn das <RefObj> nicht existiert, ist das Ergebnis Unknown Object.


Beispiel
  • $missile = [PLAYERSHIP] -> find nearest missile aiming to me
    if $missile -> exists
    | $ware = $missile -> get ware type code of object
    | = [PLAYERSHIP] -> add 1 units of $ware
    | $missile -> destruct: show no explosion= [TRUE]
    end
Dieses kleine Script überprüft die nächste auf das Spielerschiff zufliegende Rakete und setzt sie in den Frachtraum.


Zu finden unter:

Return to “MSCI Reference”