<RetVar/IF><RefObj> get average price of 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

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

<RetVar/IF><RefObj> get average price of ware <Var/Ware>

Post by X2-Illuminatus »

[skip|else] if [not]|while [not]|<RetVar/IF><RefObj> get average price of 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 return the average price of <Var/Ware>.
<RefObj> = The station, which offers <Var/Ware>.
<Var/Ware> = The ware you want to know its average price.


Returns the average price of the as <Var/Ware> selected ware used by the as <RefObj> selected station. The average price is the arithmetic mean of minimum and maximum price of that ware.


Example:

$target = get player tracking aim
$ware = $target -> get product ware
$avg.price = $target -> get average price of ware $ware
write to player logbook: printf: fmt='The average price of %s at %s is %s Cr.', $ware, $target, $avg.price, null, null
return null

Assuming the current player $target is a factory, this will get the average price of its product (in case the factory has more than one product, it will be the first listed) and writes it with an appropriate message to the logbook.


Related Commands:

<RetVar/IF><RefObj> get price of ware <Var/Ware>
<RefObj> set price of ware <Var/Ware> to <Var/Number> Cr


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

[TiP][49] 299497

Post by X2-Illuminatus »

[skip|else] if [not]|while [not]|<RetVar/IF><RefObj> get average price of 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 den Durchschnittspreis von <Var/Ware> enthalten.
<RefObj> = Die Station, die <Var/Ware> anbietet oder nutzt.
<Var/Ware> = Die Ware, deren Durchschnittspreis du wissen möchtest.


Gibt den Durchschnittspreis von der als <Var/Ware> ausgewählten Ware, die von der als <RefObj> ausgewählten Station genutzt wird, zurück. Der Durchschnittspreis ist der arithmetische Mittelwert von minimalem und maximalem Preis der Ware.


Beispiel:

$target = get player tracking aim
$ware = $target -> get product ware
$avg.price = $target -> get average price of ware $ware
write to player logbook: printf: fmt='Der Durchschnittspreis von %s an %s ist %s Cr.', $ware, $target, $avg.price, null, null
return null

Vorausgesetzt das aktuelle Spielerziel $target ist eine Fabrik wird dies den Durchschnittspreis des Produktes der Fabrik herausfinden und ihn mit einer entsprechenden Nachricht ins Spielerlogbuch schreiben. (Sollte die Fabrik mehrere Produkte produzieren, wird es der Preis vom ersten gelisteten sein.)


Verwandte Befehle:

<RetVar/IF><RefObj> get price of ware <Var/Ware>
<RefObj> set price of ware <Var/Ware> to <Var/Number> Cr


Zu finden unter:

Return to “MSCI Reference”