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

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> at station <Var/Station>

Post by X2-Illuminatus » Wed, 30. Mar 11, 15:29

[skip|else] if [not]|while [not]|<RetVar/IF><RefObj> can buy ware <Var/Ware> at station <Var/Station>


[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/Station> = The station 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/Station> selected station. The command will check, if the ware is offered by the selected station and if the rank of the <RefObj> to the owner race of <Var/Station> is high enough to buy that ware. It won't check, if the <RefObj> has the right cargo class, if enough free cargo space is available, if it can dock at the station and if the station has the ware actually in stock.


Example:

$result = [PLAYERSHIP] -> can buy ware $ware at station $station
if $result == 1
|write to player logbook: printf: fmt='%s can buy ware %s offered at %s', [PLAYERSHIP], $ware, $station, null, null
else
|write to player logbook: printf: fmt='%s cannot buy ware %s offered at %s', [PLAYERSHIP], $ware, $station, null, null
end
return null

Assuming $ware contains a ware offered at $station, this will check if the [PLAYERSHIP] can buy that ware. An appropriate message will be written to the player logbook.


Related Commands:

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


Command Location:
  • »» Trade Commands
    • »» for Ships
      <RetVar/IF><RefObj> can buy ware <Var/Ware> at station <Var/Station>

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

[TiP][49] 299099

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

[skip|else] if [not]|while [not]|<RetVar/IF><RefObj> can buy ware <Var/Ware> at station <Var/Station>


[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/Station> = Die Station, die die <Var/Ware> anbietet.


Dies überprüft, ob das als <RefObj> ausgewählte Schiff die als <Var/Ware> ausgewählte Ware angeboten bei der als <Var/Station> gewählten Station kaufen kann. Der Befehl wird überprüfen, ob die Ware von der gewählten Station angeboten wird und ob der Rang des <RefObj> zum Besitzer von <Var/Station> hoch genug ist, um diese Ware zu kaufen. Er wird hingegen nicht überprüfen, ob das <RefObj> die richtige Frachtklasse hat, ob genügend freier Frachtraum verfügbar ist, ob es an die Station andocken kann und ob die Station zurzeit überhaupt Einheiten der Ware im Lagerraum hat.


Beispiel:

$result = [PLAYERSHIP] -> can buy ware $ware at station $station
if $result == 1
|write to player logbook: printf: fmt='%s kann die Ware %s angeboten an %s kaufen', [PLAYERSHIP], $ware, $station, null, null
else
|write to player logbook: printf: fmt='%s kann die Ware %s angeboten an %s nicht kaufen', [PLAYERSHIP], $ware, $station, null, null
end
return null

Vorausgesetzt $ware enthält eine Ware angeboten an $station wird dies überprüfen, ob das Spielerschiff [PLAYERSHIP] diese Ware kaufen kann. Eine entsprechende Nachricht wird ins Spielerlogbuch geschrieben.


Verwandte Befehle:

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


Zu finden unter:
  • »» Trade Commands
    • »» for Ships
      <RetVar/IF><RefObj> can buy ware <Var/Ware> at station <Var/Station>

Return to “MSCI Reference”