This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
add_item_to_container [2020/06/07 17:16] – justin | add_item_to_container [2023/01/02 21:08] (current) – justin | ||
---|---|---|---|
Line 2: | Line 2: | ||
---- | ---- | ||
- | Adds one or more of the specified [[item]] to an [[item_container|item container]]. The ID of the [[item]] is case-sensitive and should match the ID assigned to it in the [[item_editor|Item Editor]] (e.g. " | + | Adds one or more of the specified [[item|item]] to an [[item_container|item container]]. The ID of the [[item|item]] is case-sensitive and should match the ID assigned to it in the [[item_editor|Item Editor]] (e.g. " |
====Signature: | ====Signature: | ||
Line 10: | Line 10: | ||
^Argument^Description^Type^Required^ | ^Argument^Description^Type^Required^ | ||
- | |entity|Container [[entity]] to which the [[item]] will be added.|[[Entity]]|Yes| | + | |entity|Container [[entity|entity]] to which the [[item|item]] will be added.|[[entity|Entity]]|Yes| |
- | |item_id|ID of the [[item]] (as assigned in the [[Item Editor]]).|[[String]]|Yes| | + | |item_id|ID of the [[item|item]] (as assigned in the [[item_editor|Item Editor]]).|[[string|String]]|Yes| |
- | |count|How many of the [[item]] to add (defaults to 1).|[[Number]]|No| | + | |count|How many of the [[item|item]] to add (defaults to 1).|[[number|Number]]|No| |
+ | |||
+ | ^Return Value^Description^Type^ | ||
+ | |Number Added|Returns the actual number of [[item|items]] that were added to the [[item container]]. This could be less than the count supplied to the function, for example if the [[item container]] becomes full.|[[Number]]| | ||
====Example: | ====Example: | ||
<code bauxite> | <code bauxite> | ||
- | add_item_to_container(self, | + | add_item_to_container(self, |
</ | </ | ||
- | // | + | // |
<WRAP center round tip 100%> | <WRAP center round tip 100%> | ||
- | Use the **Add Item Container** function to place a new [[item]] into a chest or onto a table after the player has performed an action to build, generate, or " | + | Use the **Add Item Container** function to place a new [[item|item]] into a chest or onto a table after the player has performed an action to build, generate, or " |
</ | </ | ||