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 11:54] justinitem_storage_slot [2023/05/23 17:54] – external edit 127.0.0.1
Line 9: Line 9:
  
 =====Scripting===== =====Scripting=====
-You can access and change certain properties of am from within a [[script]] by simply referencing the parent [[widget]] and the button element by their unique IDs. See below for examples of changing the text, [[image]], and [[script]] of a button. In these cases, the [[widget]] has an ID of "test" and the button has an ID of "0001".+You can access certain properties of an item storage slot from a [[script]] by simply referencing the parent [[widget]] and the element by their unique IDs. See below for examples of retrieving the slot'[[item]]. In this casewe 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, its "item" property will be null.
  
-**Changing a button's text:**+**Retrieving the item data for an item storage slot:**
 <code bauxite> <code bauxite>
-widget["test"].element["0001"].text = "New Text"+$item_id = widget["test"].element["0001"].item.id; 
 +$item_count widget["test"].element["0001"].item.count
 </code> </code>
  
-**Changing a button's image:**+**Changing the item in an item storage slot:**
 <code bauxite> <code bauxite>
-widget["test"].element["0001"].image = "new_image.png"+widget["test"].element["0001"].item = "ITEM_0001";
 </code> </code>
  
-**Changing a button's script:**+**Changing the count of an item in an item storage slot:**
 <code bauxite> <code bauxite>
-widget["test"].element["0001"].script = "new_script_name"+widget["test"].element["0001"].count 10; 
 +</code> 
 + 
 +**Checking if an item exists in an item storage slot:** 
 +<code bauxite> 
 +if widget["test"].element["0001"].item == null then 
 +   display_message("There isn't an item in this slot."
 +end
 </code> </code>
  
 ~~NOTOC~~ ~~NOTOC~~
item_storage_slot.txt · Last modified: 2024/02/18 21:45 by justin