[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 price of <Var/Ware>.
<RefObj> = The station, which offers <Var/Ware>.
<Var/Ware> = The ware you want to know its price.
Returns the price of the as <Var/Ware> selected ware used by the as <RefObj> selected station.
Example:
$price = 0
* get all stations in the current player sector
$sector = [PLAYERSHIP] -> get sector
$station.arr = $sector -> get station array from sector
$size.station = size of array $station.arr
while $size.station
|dec $size.station =
|$newstation = $station.arr[$size.station]
* get the price of the ware, if the station buys it.
|if $station -> can buy ware $ware
||$new.price = $newstation -> get price of ware $ware
* Save the station, where the best price for the ware is offered.
||if $new.price > $price
|||$price = $new.price
|||$station = $newstation
||end
|end
end
* inform the player about the result
if not $station == null
|write to player logbook: printf: fmt='In sector %s the best price (%s Cr) to sell %s is offered at station %s.', $sector, $price, $ware, $station, null
else
|write to player logbook: printf: fmt='In sector %s no station buys %s. ', $sector, $ware, null, null, null
end
return null
Assuming $ware contains a ware, this will check, at which station in the current player sector the $ware can be sold at the best price.
Related Commands:
<RetVar/IF><RefObj> get average price of ware <Var/Ware>
<RefObj> set price of ware <Var/Ware> to <Var/Number> Cr
Command Location:
- »» Trade Commands
- »» for Stations
<RetVar/IF><RefObj> get price of ware <Var/Ware>
- »» for Stations