This module allows you to quickly create interactive GUIs in a couple of lines of code
Special thanks to
APickledWalrus for creating the
skript-gui addon. The GUI creation logic and event handling mechanisms were inspired by and partially adapted from their work.
The final argument lets you use templates to define the arrangement of interactive elements in your GUI. These templates are strings, where each character represents a slot in the inventory:
"x" marks a slot to be filled with a specific element.
"-" leaves the slot empty.
For example, using the template "xxixx" with a funnel inventory will fill the first, second, fourth, and fifth slots with the element for "x", and the third slot with the element for "i". This gives you detailed control over your GUI’s layout.
Allows you to redefine interactive elements inside an already created GUI, including modifying existing elements, changing the layout, or adding new ones.
When you click on an interactive GUI element (e.g., a slot in the GUI), the code inside the section will be executed. For example, clicking on a slot with a stone item could broadcast a message or perform an action. Here’s an example:
The expression below creates an interactive element on the next empty inventory slot, which refers to the first available slot in the inventory that is not occupied by any item. For example, if slots 1, 2, and 3 are filled, the next empty inventory slot would be slot 4.
(change|edit)[gui]%gui%
Create an interactive element
Clicking this element triggers the execution of the code within its section.
The expression below creates an interactive element on the next empty inventory slot.
For example, a player made a double click, which caused things to gather in the cursor slot.
[the]gui(-|)inventory(-|)action
Type of click
For example, a player made a click with the Shift key held down.
[the]gui(-|)click(-|)(type|action)
Cursor slot
[the]gui(-|)cursor[(-|)item]
The type of clicked slot
[the]gui(-|)slot(-|)type
The clicked item
[the]gui[(-|)(clicked|current)](-|)item
The expression used instead of the player inside the GUI section
[the]gui(-|)player
Be sure to use this expression inside the GUI or interactive element creation section instead of player, otherwise your code will not work as you expect it to. Using player outside these sections may result in referencing the wrong player or causing unexpected behavior in your GUI logic.