VoidExpanse/scope-items: Difference between revisions

From AtomicTorchWiki
Line 11: Line 11:


{{Scripting_api|AddItem|
{{Scripting_api|AddItem|
* int containerID, string item_type, int quantity|
* int containerID
* string item_type
* int quantity|
object:
object:
* int: item_id - game identifier of item (use it for Remove function)
* int: item_id - game identifier of item (use it for Remove function)
Line 57: Line 59:


{{Scripting_api|GetStationStorageContainerId|
{{Scripting_api|GetStationStorageContainerId|
* int stationID, int shipID|
* int stationID
* int shipID|
ID of the container||
ID of the container||
Returns ID of the station storage container for the specific ship.
Returns ID of the station storage container for the specific ship.
Line 63: Line 66:


{{Scripting_api|RemoveCargo|
{{Scripting_api|RemoveCargo|
* int containerID, string cargo_type, int quantity|<no result>||
* int containerID
* string cargo_type
* int quantity|<no result>||
Remove cargo from container.
Remove cargo from container.
}}
}}

Revision as of 09:36, 20 April 2015


Items scope

Used to access items/cargo containers, add or remove items. Please note that the cargo is stored in the same container (so ID for items/cargo containers is the same).

Visibility: Global.

List of functions

AddItem
Arguments Returns Example
  • int containerID
  • string item_type
  • int quantity

object:

  • int: item_id - game identifier of item (use it for Remove function)
  • string: xml_id - xml item type ID
  • string: type - can be "item" or "resource"
  • int: quantity - amount of item added
var obj = items.AddItem(24556, "SomeItem2", 5);
Description

Add item of specific type and quantity to the specified container ID.


GetGameObjectContainerId
Arguments Returns Example
  • int objId

ID of the container

Description

Get container for any space object (currently it works for ship and crate containers).


GetItemsAndCargo
Arguments Returns Example
  • int containerID

Array of objects.


Object format:

  • int: item_id - game identifier of item (use it for Remove function)
  • string: xml_id - xml item type ID
  • int: quantity - amount of item added
Description

Returns array of items and cargo of the container.


GetShipInventoryContainerId
Arguments Returns Example
  • int shipID

ID of the container

Description

Returns ID of the ship inventory and cargo container. You can get it also by the GetGameObjectContainerId() function.


GetStationShopContainerId
Arguments Returns Example
  • int stationID

ID of the container

Description

Returns ID of the station shop container, which contains all the items available for sale on the station.


GetStationStorageContainerId
Arguments Returns Example
  • int stationID
  • int shipID

ID of the container

Description

Returns ID of the station storage container for the specific ship.


RemoveCargo
Arguments Returns Example
  • int containerID
  • string cargo_type
  • int quantity
<no result>
Description

Remove cargo from container.


RemoveItem
Arguments Returns Example
  • int container_id, int item_id, int quantity
<no result>
Description

Remove item from container (if quantity not specified or zero - remove all quantity).