<RetVar> = <RefObj> get asteroid array from sector

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: 24950
Joined: Sun, 2. Apr 06, 16:38
x4

<RetVar> = <RefObj> get asteroid array from sector

Post by X2-Illuminatus » Fri, 29. Jul 11, 13:08

<RetVar> = <RefObj> get asteroid array from sector


<RetVar> = A variable where the requested information is stored as an array.
<RefObj> = A variable containing a sector.


This command returns an array of all asteroids that are in the as <RefObj> selected sector. However, this will only return asteroids that are visible on the sector map.


Example:

$sector=[PLAYERSHIP] -> get sector
$asteroid.arr=$sector -> get asteroid array from sector
$size= size of array $asteroid.arr
while $size
|dec $size=
|$asteroid=$asteroid.arr[$size]
|$resource=$asteroid -> get resource waretype of asteroid
|$yield=$asteroid -> get asteroid yield
|$position.arr=$asteroid -> get position as array
|write to player logbook: printf: fmt='The asteroid at %s has the resource %s with a yield of %s.', $position.arr, $resource, $yield, null, null
end
return null

This will get all asteroids in the player sector. Afterwards it will find out for every asteroid its position, resource and yield and will then write these information with a message to the logbook.


Command Location:

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

[TiP][49] 304967

Post by X2-Illuminatus » Sat, 1. Oct 11, 20:36

<RetVar> = <RefObj> get asteroid array from sector


<RetVar> = Eine Variable, in der die geforderte Information in Form eines Arrays gespeichert wird.
<RefObj> = Eine Variable, die einen Sektor enthält.


Dieser Befehl gibt ein Array aller Asteroiden im als <RefObj> ausgewählten Sektor zurück. Dies werden jedoch nur die Asteroiden sein, die man auch auf der Sektorkarte sehen kann.


Beispiel:

$sector=[PLAYERSHIP] -> get sector
$asteroid.arr=$sector -> get asteroid array from sector
$size= size of array $asteroid.arr
while $size
|dec $size=
|$asteroid=$asteroid.arr[$size]
|$resource=$asteroid -> get resource waretype of asteroid
|$yield=$asteroid -> get asteroid yield
|$position.arr=$asteroid -> get position as array
|write to player logbook: printf: fmt='Der Asteroid an der Stelle %s hat die Ressource %s mit einer Ausbeute von %s.', $position.arr, $resource, $yield, null, null
end
return null

Dieses Beispiel findet alle Asteroiden im Spielersektor, ermittelt ihre Position, Ressource und Ausbeute und schreibt diese Daten anschließend mit einer entsprechenden Nachricht ins Logbuch.


Zu finden unter:

Locked

Return to “MSCI Reference”