Podstawowe informacje
Wersja serwera: 1.21.11
Wersja Skript: 2.12.2
Dodatki Skript i ich wersje: Protocolib v 5.4.0 i Skbee 3.15.0
Kod skryptu
variables:
{open::%player%} = true
command /menu:
trigger:
mmomenu(player)
set {open::%player%} to true
function mmomenu(player: player):
set {open::%player%} to false
set {_menu} to chest inventory with 6 rows named " &l&3 MMO&l&a Menu"
set {_a} to 0
loop 54 times:
set slot {_a} of {_menu} to light blue stained glass pane named " "
add 1 to {_a}
set slot 10 of {_menu} to emerald block named "&l&aPoziomy"
set slot 12 of {_menu} to lime candle named "&l&aExp" with lore "&3Sprawdź ile Expa dostaniesz za daną czynność"
set slot 49 of {_menu} to barrier block named "&l&cZamknij"
open {_menu} to {_player}
stop
on inventory click:
send "%event-inventory%" to player
if name of event-inventory contains "Menu":
cancel event
if clicked slot is 12:
set {_menu} to chest inventory with 6 rows named " &l&3 MMO&l&a Menu - &aExp"
set {_a} to 0
loop 54 times:
set slot {_a} of {_menu} to light blue stained glass pane named " "
add 1 to {_a}
set slot 49 of {_menu} to barrier block named "&l&cZamknij"
open {_menu} to player
if clicked slot is 49:
close player's inventory
on inventory close:
if name of event-inventory contains "Menu - Exp":
if {open::%player%} is true:
mmomenu(player)
wait 1 tick
set {open::%player%} to true
Opis problemu
po wpisaniu komendy /menu wszystko działa w porządku, event on inventory click się canceluje, ale gdy wcisnę e i odpali się event on inventory close i funkcja znów zostanie wywołana w otwartym inventory skript nie reaguje na event on inventory click, wstawiłem send "%event-inventory%" to player, żeby sprawdzić czy event w ogóle się odpala, wiem że mógłbym zrobić to jako komendę /menu i później dawać execute player's command albo coś tego typu, nie potrzebuję pomocy z kodem tylko wyjaśnienia dlaczego event po zamknięciu i otworzeniu się nowego gui nie reaguje, zauważyłem że po opuszczeniu gui menu exp i otwarciu mmo menu z funkcji resetuje się ustawienie kursora, a w kodzie nie ma close player's inventory znajduje się ono tylko w części gdzie klikamy na slot 49 w celu zamknięcia gui bez użycia esc czy e, o co tu chodzi, trochę nie rozumiem co się dzieje, a siedzę nad tym już parę godzin i nie jestem w stanie znaleźć błędu logicznego w kodzie, nie wiem czy to bug skripta czy ja coś źle robię