<RetVar/IF><RefObj> can buy ware <Var/Ware> from race <Var/Race>

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

<RetVar/IF><RefObj> can buy ware <Var/Ware> from race <Var/Race>

Post by X2-Illuminatus » Wed, 30. Mar 11, 14:48

[skip|else] if [not]|while [not]|<RetVar/IF><RefObj> can buy ware <Var/Ware> from race <Var/Race>


[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, the command will return 1 on success and 0 on failure.
<RefObj> = The ship that should buy the <Var/Ware>.
<Var/Ware> = The ware the <RefObj> should buy.
<Var/Race> = The race that offers the <Var/Ware>.


This checks, if the as <RefObj> selected ship can buy the as <Var/Ware> selected ware offered by the as <Var/Race> race. However, this will only check, if the rank of the <RefObj> to the <Var/Race> is high enough to buy the selected ware. It will neither check, if the <RefObj> has the right transport class nor if it has enough free cargo space nor if the selected ware is really offered by <Var/Race>.


Example:

$ware = 1 GJ shield
$race = Argon
$result = [PLAYERSHIP] -> can buy ware $ware from race $race
if $result == 1
|write to player logbook: printf: fmt='%s can buy ware %s offered by %s', [PLAYERSHIP], $ware, $race, null, null
else
|write to player logbook: printf: fmt='%s cannot buy ware %s offered by %s', [PLAYERSHIP], $ware, $race, null, null
end
return null

This will check if the [PLAYERSHIP] can buy 1 GJ shields from the Argon. It will write an appropriate message to the player logbook.


Related Commands:

<RetVar/IF><RefObj> can buy ware <Var/Ware> at station <Var/Station>


Command Location:

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

[TiP][49] 299095

Post by X2-Illuminatus » Mon, 2. May 11, 18:26

[skip|else] if [not]|while [not]|<RetVar/IF><RefObj> can buy ware <Var/Ware> from race <Var/Race>


[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> = Das Schiff, das die Ware <Var/Ware> kaufen soll.
<Var/Ware> = Die Ware, die vom <RefObj> gekauft werden soll.
<Var/Race> = Das Volk, das <Var/Ware> anbietet.


Dies überpüft, ob das als <RefObj> ausgewählte Schiff, die als <Var/Ware> ausgewählte Ware, die von dem als <Var/Race> ausgewählten Volk angeboten wird, kaufen kann. Jedoch wird dies nur überprüfen, ob der Rang vom <RefObj> zur <Var/Race> hoch genug ist, um die ausgewählte Ware zu kaufen. Der Befehl wird weder überprüfen, ob das <RefObj> die richtige Transportklasse noch ob es genügend freien Frachtraum hat und auch nicht ob die Ware wirklich von <Var/Race> angeboten wird.


Beispiel:

$ware = 1 GJ Schild
$race = Argonen
$result = [PLAYERSHIP] -> can buy ware $ware from race $race
if $result == 1
|write to player logbook: printf: fmt='%s kann die Ware %s angeboten von %s kaufen', [PLAYERSHIP], $ware, $race, null, null
else
|write to player logbook: printf: fmt='%s kann die Ware %s angeboten von %s nicht kaufen', [PLAYERSHIP], $ware, $race, null, null
end
return null

Dies überprüft, ob das Spielerschiff [PLAYERSHIP] 1 GJ Schilde von den Argonen kaufen kann. Eine entsprechende Nachricht wird ins Spielerlogbuch geschrieben.


Verwandte Befehle:

<RetVar/IF><RefObj> can buy ware <Var/Ware> at station <Var/Station>


Zu finden unter:

Return to “MSCI Reference”