[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 1 on success and null on failure.
<RefObj> = The station you want to check, if it can buy <Var/Ware>.
<Var/Ware> = The ware you want to check, if it can be bought by <RefObj>.
Checks, if the as <RefObj> selected station can buy the as <Var/Ware> selected ware.
This will neither check, if the selected station has enough money to buy that ware (in case it's a player own stations) nor if it has free cargo space for that ware.
Example:
$target = get player tracking aim
if $target -> can buy ware $ware
|if $target -> get free amount of ware $ware in cargo bay
||$price = $target -> get price of ware $ware
||$money = $target -> get money
||if $money >= $price
|||write to player logbook: printf: fmt='%s can buy %s.', $target, $ware, null, null, null
||end
|end
end
return null
Assuming $ware contains a ware and the current player $target is a station, this will check if that station can buy that ware. This example also checks, if the station has enough free cargo space and enough money for at least one unit of that ware. In case the station can buy the ware, an appropriate message will be written to the player logbook.
Related Commands:
<RetVar/IF><RefObj> can sell ware <Var/Ware>
Command Location:
- »» Trade Commands
- »» for Stations
<RetVar/IF><RefObj> can buy ware <Var/Ware>
- »» for Stations