<RetVar/IF><RefObj> is sector known by the player

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
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 20934
Joined: Sun, 2. Apr 06, 16:38

<RetVar/IF><RefObj> is sector known by the player

Post by X2-Illuminatus » Mon, 1. Aug 11, 20:36

[skip|else] if [not]|while [not]| <RetVar/IF><RefObj> is sector known by the player


[skip|else] if [not]|while [not]| = The possible 'Conditional' statements that can be used with this command.
<RetVar/IF> = Use a variable, if the command should return information. If a variable is used, it will return '1' on success and '0' on failure.
<RefObj> = A variable containing a sector.


This check, if the as <RefObj> selected sector is known by the player (i.e. if it's visible on the sector map).


Example:

$max.x = get max sectors in x direction
$max.y = get max sectors in y direction
$x = 0
while $x < $max.x
|$y = 0
|while $y < $max.y
||$sector = get sector from universe index: x=$x, y=$y
||if $sector -> exists
|||if not $sector -> is sector known by the player
||||$ship = create ship: type=Advanced Satellite owner=Player addto=$sector x=0 y=20000 z=0
|||end
||end
||inc $y =
|end
|inc $x =
end
return null


This will iterate through all sectors of the universe. Line 8 checks, if a sector exists and Line 9 if the sector is unknown ( = not known). In each unknown sector a player owned Advanced Satellite will be built.


Command Location:

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

[TiP][49] 305155

Post by X2-Illuminatus » Sun, 2. Oct 11, 23:36

[skip|else] if [not]|while [not]| <RetVar/IF><RefObj> is sector known by the player


[skip|else] if [not]|while [not]| = Die möglichen bedingten Anweisungen, die mit diesem Befehl genutzt werden können.
<RetVar/IF> = Nutze eine Variable, wenn der Befehl eine Information zurückgeben soll. Wenn eine Variable genutzt wird, wird sie '1' im Erfolgs- und '0' im Fehlerfall enthalten.
<RefObj> = Eine Variable, die einen Sektor enthält.


Dies überprüft, ob der als <RefObj> ausgewählte Sektor dem Spieler bekannt (d.h. sichtbar auf der Universumskarte) ist.


Beispiel:

$max.x = get max sectors in x direction
$max.y = get max sectors in y direction
$x = 0
while $x < $max.x
|$y = 0
|while $y < $max.y
||$sector = get sector from universe index: x=$x, y=$y
||if $sector -> exists
|||if not $sector -> is sector known by the player
||||$ship = create ship: type=Erweiterter Satellit owner=Player addto=$sector x=0 y=20000 z=0
|||end
||end
||inc $y =
|end
|inc $x =
end
return null


In diesem Beispiel werden alle Sektoren im Universum durchlaufen. Zeile 8 überprüft, ob ein Sektor existiert, und Zeile 9, ob der Sektor unbekannt ( = not known) ist. In jedem unbekannten Sektor wird ein Erweiterter Satellit gebaut.


Zu finden unter:

Locked

Return to “MSCI Reference”