CargoTransfer amount:Cargo, target:Int, [flags:Any]

Transfers cargo to a ship. target specifies the target ship Id, cargo is the amount and type to transfer, as a cargo set. It may contain negative values to beam cargo back from the target if rules allow.

The optional third parameter, options, is a string containing some options:

  • "O": permit overloading the ships.
  • "S": sell supplies on-the-fly (not possible for the ship/ship version of this command).
  • "N": don't generate an error when the cargo can not completely be transferred. Instead, sets the variable Cargo.Remainder accordingly.

For example,

 CargoTransfer 10, "300n"

transfers 300 kt Neutronium to ship 10. It will fail with an error if the current ship doesn't have that much, or there is not enough space in ship 10's fuel tank. If you use

 CargoTransfer 10, "300n", "n"

PCC will transfer as much as possible. Assuming that the current ship only has 20 kt fuel (and ship 10 has enough space), this will set Cargo.Remainder to "280N", because that's the amount that was not transferred. To test for a successful transfer, you can then use

 If Not Cargo.Remainder Then Print "Successful."

Though you seem to be able to call this command beam cargo off foreign ships, this can only be used to cancel pending transfer orders. That is, if ship 355 is a foreign one and ship 10 is yours: for

 With Ship(355) Do CargoTransfer 10, "10n"

to succeed, you must have transferred 10 kt Neutronium there using the ship/enemy-ship transporter, e.g. with the command

 With Ship(10) Do CargoTransfer 355, "10n"

The game rules do not allow asking foreign ships for stuff; the other ship must explicitly send it.

Since: PCC 1.0.10, PCC2 1.99.12

See also: CargoUnload, CargoUpload, CargoTransferWait, Planet Commands, Ship Commands