<RetVar/IF> is datatyp[ <Value> ] == <Var/Script Data Type>

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> is datatyp[ <Value> ] == <Var/Script Data Type>

Post by mark_a_condren » Thu, 9. Sep 10, 13:30

[skip|else] if [not]|while [not]| <RetVar/IF> is datatyp[ <Value> ] == <Var/Script Data Type>


[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 TRUE / FALSE as an integer.
<Value> = This is the item that is having its data type checked.
<Var/Script Data Type> = This is what <Value> is being checked against. This can be a 'datatyp' or another variable.


Returns a [TRUE] or [FALSE] depending on whether or not the data type of <Value> is equal to <Var/Script Data Type>.


Example:

(As menus can not display integers, it can be useful to know if a variable needs to have its data type changed so it can be displayed)

$number = 15 (were 15 is an integer)

if -> is datatyp[ $number ] == DATATYP_INT
| $number.string = convert number $number to string
| add custom menu item to array $menu: text = $number.string returnvalue = null
else
| add custom menu item to array $menu: text = $number returnvalue = null
end

In the above example, if $number is an integer, it will convert it to a string before adding it to the menu for display. If however it is not an integer it will just put it straight into the menu for display.

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

Note:
See at the bottom of here for a list of possible data types.


Command Location:

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

[TiP][49] 286535

Post by X2-Illuminatus » Tue, 28. Sep 10, 22:40

[skip|else] if [not]|while [not]| <RetVar/IF> is datatyp[ <Value> ] == <Var/Script Data Type>


[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 TRUE / FALSE als ganze Zahl zurückgeben.
<Value> = Dies ist der Gegenstand, dessen Dateityp überprüft wird.
<Var/Script Data Type> = Hiermit wird <Value> verglichen. Es kann ein 'datatyp' oder eine andere Variable sein.


Gibt [TRUE] oder [FALSE] wieder, abhängig ob der Dateityp von <Value> gleich oder ungleich <Var/Script Data Type> ist.


Beispiel:

(Da Menüs keine ganzen Zahlen anzeigen können, kann es nützlich sein zu wissen, ob der Dateityp einer Variable geändert werden muss, um diese anzeigen zu lassen.)

$number = 15 (wobei 15 eine ganze Zahl ist)

if -> is datatyp[ $number ] == DATATYP_INT
| $number.string = convert number $number to string
| add custom menu item to array $menu: text = $number.string returnvalue = null
else
| add custom menu item to array $menu: text = $number returnvalue = null
end

In obigem Beispiel, wenn $number eine ganze Zahl ist, wird es zu einem String konvertiert bevor es zum Menü zur Anzeige hinzugefügt wird. Wenn es jedoch keine ganze Zahl ist, wird es dem Menü sofort zur Anzeige hinzugefügt.

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

Hinweis:
Sieh dir diesen Artikel an, für eine Auflistung der möglichen Dateitypen.


Zu finden unter:

Locked

Return to “MSCI Reference”