User Tools

Site Tools


item_storage_slot

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
item_storage_slot [2020/12/02 12:59] justinitem_storage_slot [2023/05/23 17:52] – created justin
Line 1: Line 1:
-======Item Storage Slot====== +Test
----- +
- +
-An **item storage slot** is a [[widget]] element for storing an [[item]] or stack of [[item|items]]. This is useful for [[inventory]] windows, [[item container]] windows, or other [[widget|widgets]] that are meant for storing [[item|items]] into for later retrieval and usage. +
- +
-=====Element Properties===== +
-^Icon^Property^Description^ +
-|{{:wiki:tag_id.png?nolink|}}|Element ID|ID for the item storage slot. This ID must be unique amongst other elements within the same [[widget]]. It is currently auto-generated but will be editable in a future update.| +
- +
-=====Scripting===== +
-You can access certain properties of an item storage slot from within a [[script]] by simply referencing the parent [[widget]] and the element by their unique IDs. See below for examples of retrieving the slot's [[item]]. In this case, we are assuming that the slot currently contains an [[item]], the [[widget]] has an ID of "test", and the item storage slot has an ID of "0001". If the slot is empty, the "item" property will be null. +
- +
-**Retrieving the item data for a item storage slot:** +
-<code bauxite> +
-$item_id = widget["test"].element["0001"].item.id; +
-$item_count = widget["test"].element["0001"].item.count +
-</code> +
- +
-**Checking if an item exists in an item storage slot:** +
-<code bauxite> +
-if widget["test"].element["0001"].item != null then +
-   display_message("An item is in this slot."+
-end +
-</code> +
- +
-~~NOTOC~~+
item_storage_slot.txt · Last modified: 2024/02/18 21:45 by justin