User Tools

Site Tools


crafting_input_slot

Crafting Input Slot


A crafting input slot is a widget element that an item can be placed into for crafting purposes. Adding multiple crafting input slots to a widget, along with a button configured as a “Crafting” button, will allow the player to combine items together to create something new. The ingredients/materials required to craft a particular item is configured in the Item Editor.

Element Properties

IconPropertyDescription
Element IDID for the crafting input 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 a crafting input 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's item. In this case, we are assuming that the slot currently contains an item, the widget has an ID of “test”, and the crafting input slot has an ID of “0001”. If the slot is empty, its “item” property will be null.

Retrieving the item data for a crafting input slot:

$item_id = widget["test"].element["0001"].item.id;
$item_count = widget["test"].element["0001"].item.count

Checking if an item exists in a crafting input slot:

if widget["test"].element["0001"].item == null then
   display_message("There isn't an item in this slot.")
end
crafting_input_slot.txt · Last modified: 2020/12/02 18:33 by justin