Hotbar Slot (Expression) — Skript

Addon: Skript · Category: Expression · Since: 2.2-dev36

Syntax

[the] [([currently] selected|current)] hotbar slot[s] [of %players%]

Description

The currently selected hotbar <a href='#slot'>slot</a>. To retrieve its number use <a href='#ExprSlotIndex'>Slot Index</a> expression. Use future and past tense to grab the previous slot in an item change event, see example.

Examples

message "%player's current hotbar slot%"
set player's selected hotbar slot to slot 4 of player
send "index of player's current hotbar slot = 1" # second slot from the left
on item held change:
	if the selected hotbar slot was a diamond:
		set the currently selected hotbar slot to slot 5 of player

View source