<RetVar/IF><RefObj> trades with ware <Var/Ware>

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/IF><RefObj> trades with ware <Var/Ware>

Post by X2-Illuminatus » Sat, 2. Apr 11, 20:22

[skip|else] if [not]|while [not]|<RetVar/IF><RefObj> trades with ware <Var/Ware>


[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 contain 1 on success and null on failure.
<RefObj> = The station you want to know, if it trades with <Var/Ware>.
<Var/Ware> = The ware you want to know, if <RefObj> trades with it.


This checks, if the as <RefObj> selected station trades with the as <Var/Ware> selected ware.


Example:

$station.ware.arr = array alloc: size=0
$sector = [PLAYERSHIP] -> get sector
$station.arr = $sector -> get station array from sector
$size = size of array $station.arr
while $size
|dec $size =
|$station = $station.arr[$size]
|if $station -> trades with ware $ware
||append $station to array $station.ware.arr
|end
end
return null

Assuming $ware contains a ware, this will get all stations in the current player's sector, which trade with that ware and store them in the array $station.ware.arr.


Related Commands:

<RetVar> = <RefObj> get tradeable ware array from station


Command Location:

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

[TiP][49] 299247

Post by X2-Illuminatus » Tue, 3. May 11, 19:03

[skip|else] if [not]|while [not]|<RetVar/IF><RefObj> trades with ware <Var/Ware>


[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 null im Fehlerfall enthalten.
<RefObj> = Die Station, von der du wissen möchtest, ob sie mit <Var/Ware> handelt.
<Var/Ware> = Die Ware, von der du wissen möchtest, ob sie vom <RefObj> gehandelt wird.


Dies überprüft, ob die als <RefObj> ausgewählte Station mit der als <Var/Ware> ausgewählten Ware handelt.


Beispiel:

$station.ware.arr = array alloc: size=0
$sector = [PLAYERSHIP] -> get sector
$station.arr = $sector -> get station array from sector
$size = size of array $station.arr
while $size
|dec $size =
|$station = $station.arr[$size]
|if $station -> trades with ware $ware
||append $station to array $station.ware.arr
|end
end
return null

Vorausgesetzt $ware enthält eine Ware wird dieses Beispiel alle Stationen, die mit dieser Ware handeln, im aktuellen Spielersektor erfassen und sie im Array $station.ware.arr speichern.


Verwandte Befehle:

<RetVar> = <RefObj> get tradeable ware array from station


Zu finden unter:

Locked

Return to “MSCI Reference”