Skip to content

4. GUI Values

APickledWalrus edited this page Aug 11, 2022 · 4 revisions

There are many values available to use when a player clicks on a slot in a GUI. Below, I'll go through each one and what it does.

Values that are usable in the "run on gui close" section are marked.

[the] gui slot
  This returns the number of the slot that was clicked.
  There may be two slots with the same slot number, since the player can also see their inventory.

[the] gui raw slot
  This is the "raw" number of the slot that was clicked.
  Unlike the gui-slot expression, this number is unique to the slot.

[the] gui hotbar slot
  If the player uses a number key (1-9) to try and move the clicked item to their hotbar,
  this value will return the hotbar slot, where 0 is the first slot.
  If the player didn't use a number key to click the item, then this expression will return -1.

[the] gui inventory
  This expression returns the inventory of the clicked item (the GUI's inventory).
  This expression is usable in the "run on gui close" section.

[the] gui inventory action
  This expression returns what the player tried to do when they clicked.
  See https://docs.skriptlang.org/classes.html#inventoryaction for a list of actions.

[the] gui click (type|action)
  This expression returns the type of click.
  See https://skriptlang.github.io/Skript/classes.html#clicktype for a list of click types.

[the] gui cursor [item]
  The item in the player's cursor.

[the] gui [clicked|current] item
  The item that was clicked.

[the] gui slot type
  The type of slot that was clicked.
  See https://github.com/APickledWalrus/skript-gui/wiki/6.-Other-Information#slot-types for a list of slot types.

[the] gui player
  The player that clicked the slot.
  This expression is usable in the "run on gui close" section.

[the] gui (viewer|player)s
  A list of the players that are currently viewing the GUI.
  This expression is usable in the "run on gui close" section.

[the] gui slot id
  The part of the GUI's shape that this slot is under.
  In our "Border GUI" example, this would return "x" if the slot in question was a border slot.
  If this slot doesn't have a shape, " " will be returned

[the] gui
  The GUI of the slot.
  This expression is usable in the "run on gui close" section.
  
Clone this wiki locally