Skript Version: Skript 2.4.1
Skript Author: Bensku
Minecraft Version: 1.9
This command basically opens a menu and then checks all the {testmenuactive.%number%} inputs to see if the specific item is active, if it is, it will format the next available slot (according to {testmenuidloop}) with that numbers item. It all works fine, but when setting the command that the item is supposed to run when clicked, it sets the %loop-number% variable to the last loop-number inputted, instead of setting it to the loop-number that was active when the slot was formatted.
Skript Author: Bensku
Minecraft Version: 1.9
Code:
command /testmenu:
trigger:
wait 2 ticks
open chest with 3 rows named "Test" to player
wait 1 tick
loop {testmenuid} times:
if {testmenuactive.%loop-number%} is true:
add 1 to {testmenuidloop.%player%}
set {testmenucommand.%loop-number%} to loop-number
wait 1 tick
format slot {testmenuidloop.%player%} of player with {testmenuitem.%loop-number%} to close then run [execute player command "testcommand %{testmenucommand.%loop-number%}%"]
set {testmenuidloop.%player%} to -1
This command basically opens a menu and then checks all the {testmenuactive.%number%} inputs to see if the specific item is active, if it is, it will format the next available slot (according to {testmenuidloop}) with that numbers item. It all works fine, but when setting the command that the item is supposed to run when clicked, it sets the %loop-number% variable to the last loop-number inputted, instead of setting it to the loop-number that was active when the slot was formatted.