VoidExpanse/scope-items: Difference between revisions
Ai enabled (talk | contribs) |
Ai enabled (talk | contribs) (The method name corrected - RemoveItemQuantity) |
||
(11 intermediate revisions by the same user not shown) | |||
Line 3: | Line 3: | ||
</noinclude> | </noinclude> | ||
= Items scope = | = Items scope = | ||
Used to access items containers, add or remove items. | 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. | '''Visibility:''' Global. | ||
Line 10: | Line 11: | ||
{{Scripting_api|AddItem| | {{Scripting_api|AddItem| | ||
* int containerID | * int: containerID | ||
object | * 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 | |||
| | |||
<pre style="margin:0px;">var obj = items.AddItem(24556, "SomeItem2", 5);</pre> | |||
| | |||
Add item of specific type and quantity to the specified container ID. | Add item of specific type and quantity to the specified container ID. | ||
}} | }} | ||
{{Scripting_api|GetGameObjectContainerId| | {{Scripting_api|GetGameObjectContainerId| | ||
* int objId| | * int: objId| | ||
ID of the container|| | ID of the container|| | ||
Get container for any space object (currently it works for ship and crate containers). | Get container for any space object (currently it works for ship and crate containers). | ||
Line 23: | Line 32: | ||
{{Scripting_api|GetItemsAndCargo| | {{Scripting_api|GetItemsAndCargo| | ||
* int containerID| | * int: containerID | ||
ID of | | | ||
Returns array of items and cargo of the container | 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 | |||
| | |||
| | |||
Returns array of items and cargo of the container. | |||
}} | }} | ||
{{Scripting_api|GetShipInventoryContainerId| | {{Scripting_api|GetShipInventoryContainerId| | ||
* int shipID| | * int: shipID| | ||
ID of the container|| | ID of the container|| | ||
Returns ID of the ship inventory and cargo container. You can get it also by the GetGameObjectContainerId() function. | Returns ID of the ship inventory and cargo container. You can get it also by the GetGameObjectContainerId() function. | ||
Line 35: | Line 53: | ||
{{Scripting_api|GetStationShopContainerId| | {{Scripting_api|GetStationShopContainerId| | ||
* int stationID| | * int: stationID| | ||
ID of the container|| | ID of the container|| | ||
Returns ID of the station shop container, which contains all the items available for sale on the station. | Returns ID of the station shop container, which contains all the items available for sale on the station. | ||
Line 41: | Line 59: | ||
{{Scripting_api|GetStationStorageContainerId| | {{Scripting_api|GetStationStorageContainerId| | ||
* int stationID | * 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 47: | Line 66: | ||
{{Scripting_api|RemoveCargo| | {{Scripting_api|RemoveCargo| | ||
* int containerID | * int: containerID | ||
* string: cargo_type | |||
* int: quantity|<no result>|| | |||
Remove cargo from container. | Remove cargo from container. | ||
}} | }} | ||
{{Scripting_api| | {{Scripting_api|RemoveItemQuantity| | ||
* int container_id | * int: container_id | ||
Remove item from container (if quantity | * int: item_id | ||
* int: quantity | |||
|<no result>|| | |||
Remove item from container (if the quantity is zero - remove item completely). | |||
}} | }} |
Latest revision as of 04:57, 27 July 2017
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 |
|
object:
|
var obj = items.AddItem(24556, "SomeItem2", 5); |
Description | ||
Add item of specific type and quantity to the specified container ID. |
GetGameObjectContainerId | ||
---|---|---|
Arguments | Returns | Example |
|
ID of the container |
|
Description | ||
Get container for any space object (currently it works for ship and crate containers). |
GetItemsAndCargo | ||
---|---|---|
Arguments | Returns | Example |
|
Array of objects.
|
|
Description | ||
Returns array of items and cargo of the container. |
GetShipInventoryContainerId | ||
---|---|---|
Arguments | Returns | Example |
|
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 |
|
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 |
|
ID of the container |
|
Description | ||
Returns ID of the station storage container for the specific ship. |
RemoveCargo | ||
---|---|---|
Arguments | Returns | Example |
|
<no result> | |
Description | ||
Remove cargo from container. |
RemoveItemQuantity | ||
---|---|---|
Arguments | Returns | Example |
|
<no result> | |
Description | ||
Remove item from container (if the quantity is zero - remove item completely). |