Check if player has switched their selected hotbar slot

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

LimmaBeanz

New Member
May 16, 2021
5
0
1
21
Hey! I'm attempting to make a little scrolling system that uses the hotkeys/scroll wheel functions of the hotbar. Now I really want the player's selected slot to stay slot 0, but when the player scrolls to either slot 1 or slot 8, it changes the value of a variable. After every cycle to any slot other than 0, it forces the player's selected slot to return back to slot 0.


on player's held item change:
if {player_menu_active::%player%} is 1:
if player changed selected slot to 1:
add 1 to {selected_option::%player%}
set player's selected hotbar slot to slot 0 of player
if player changed selected slot to 8:
subtract 1 from {selected_option::%player%}
set player's selected hotbar slot to slot 0 of player `

This doesn't work, but its the closest I've gotten, it's only the correct conditions I'm missing
I'm aware the if statements in bold don't exist, but I'm attempting to find something that can work the same. If there's any cleaner or easily alternative to this, I'm open to any suggestions on how to make it more simple.

Any help is really appreciated. Thanks!
 
Status
Not open for further replies.