#Attempt 5 of seeking proffesional help

1 messages · Page 1 of 1 (latest)

cedar rapids
#

Please someone help me ive been stuck on this for weeks now there has to be a solution somewhere it just doesnt make sense

Intended outcome:

I close the gui
Class Gui reopens
I close the gui
Class Gui reopens
Continued

Reality:

I close the gui
Class Gui reopens
I close the gui
Nothing.

Event:

on inventory close:
    if name of event-inventory contains "Choose your class":
        classgui(player)

Function:

function classgui(p: player):
    set {ingui::%uuid of {_p}%} to {_p}'s uuid    
    if team of {_p} is {r} or {b}:
        if team of {_p} is {r}:
            set {_guinamecolor} to "&4&l"
        if team of {_p} is {b}:
            set {_guinamecolor} to "&1&l"    
        else:
            set {_guinamecolor} to "&f&l"        
        set {_classgui} to a new chest inventory with 1 row with name "%{_guinamecolor}%Choose your class"
#

before someone sends a solution allow me to present the failed solution board:

gleaming cosmos
#

Why is debug crossed off?

#

I told you to do that in the other thread, then you told me you created this thread and that i was “free to go”, instead of providing results of debugging. So either you didnt do it and should, or you are disregarding important information that could help.

#

As I also mentioned the first condition in the function is redundant

gleaming cosmos
cedar rapids
gleaming cosmos
#

as I also said you didnt show results

cedar rapids
#

i really dont know what you are expecting

gleaming cosmos
#

thats not what I asked you to do

cedar rapids
#

i dont understand the term "debug it" even means

#

no one will tell me

#

they just say "debug it"

gleaming cosmos
#

it means find the specific line/portion that the issue originates from. add broadcast x to check. If I have an issue I will add broadcast "a = b" after a condition if a = b:. If its not broadcasted I know I didnt set a or something.

gleaming cosmos
gleaming cosmos
cedar rapids
#

that woulda just made an even bigger rabbit hole is skript debugging wasnt the same as what came up on google

gleaming cosmos
#

google says "the proccess of finding and fixing errors in code"

#

but regardless of what google says, now that you know what I mean, try it out

#

brodacast things

#

the player's team, any variables, etc

cedar rapids
cedar rapids
#
on inventory close:
    broadcast "on inventory close:"
    if metadata "class gui" of player is event-inventory:
        broadcast "if metadata 'class gui' of player is event-inventory:"
        broadcast "&oclassgui(player)&e running"
        classgui(event-player)
        broadcast "&oclassgui(player)&2 done"
#
function classgui(p: player):
    set {_guinamecolor} to "&f&l" 
    broadcast "guiname &fset"
    if team of {_p} is {r}:
        set {_guinamecolor} to "&4&l"
        broadcast "guiname &4red"
    else if team of {_p} is {b}:
        set {_guinamecolor} to "&1&l"     
        broadcast "guiname &1blue"
    set {classgui} to a new chest inventory with 1 row with name "%{_guinamecolor}%Choose your class"
    set metadata "class gui" of {_p} to {classgui}
    broadcast "&2metadata 'class gui' &rset to {classgui}"
    set {ingui::%uuid of {_p}%} to {_p}'s uuid
    open {classgui} to {_p}
    broadcast "&6{_classgui} opened"

this is so confusing how does it only broadcast the last line of the function

gleaming cosmos
#

how come it did earlier?

gleaming cosmos
#
    set {_guinamecolor} to "&f&l" 
    if team of {_p} is {r}:
        set {_guinamecolor} to "&4&l"
    else if team of {_p} is {b}:
        set {_guinamecolor} to "&1&l"     
    set {_classgui} to a new chest inventory with 1 row with name "%{_guinamecolor}%Choose your class"
    broadcast unformatted "name: %{_guinamecolor}%Choose your class"
    set {ingui::%uuid of {_p}%} to {_p}'s uuid
    open {_classgui} to {_p}
    broadcast "&6{_classgui} opened"

on inventory close:
  broadcast unformatted "%name of event-inventory% was closed"```
#

see what this does

cedar rapids
#

Okay

#

I didn't know you can do that

#

That will help

#

In a few hours when I arrive home

cedar rapids
#

i cant even open the {_classgui} anymore

#

wtf

gleaming cosmos
graceful nova
#

there is an alternative to doing all of this name checking. you can set a metadata tag of the player to the gui, then open that gui. and when you close the inventory you can check if the metadata tag is set or if the event-inventory is the one from the metadata tag and if it is: wait a tick, reopen the metadata tag gui

#

this sounds more confusing, but it'll make checking the inventory much easier

cedar rapids
#
function classgui(p: player):
    set {ingui::%uuid of {_p}%} to {_p}'s uuid    
    set metadata "class gui" of {_p} to {_classgui}
    if team of {_p} is {r}:
        set {_guinamecolor} to "&4&l"
    if team of {_p} is {b}:
        set {_guinamecolor} to "&1&l"    
    else:
        set {_guinamecolor} to "&f&l"        
    set {_classgui} to a new chest inventory with 1 row with name "%{_guinamecolor}%Choose your class"
    open {_classgui} to {_p}
    broadcast "&6{_classgui} open"
on inventory close:
    if name of event-inventory contains "Choose your class":
#    if metadata "class gui" of player is event-inventory:
#        broadcast "&2'class gui' &finventory closed"
        broadcast "&8'Choose your class' &finventory closed"
        broadcast "&oclassgui(player)&e running"
        classgui(event-player)
        broadcast "&oclassgui(player)&2 done"
#

it spams like a hundred times

gleaming cosmos
#

You cant use it before its set if its a local variable.

#

Also change the second team condition to else if

#

What happens if you use open event-inventory to player?

graceful nova
# gleaming cosmos

you are using a local variable outside of where it's created. You can't do that

#

if you're gonna do that, create the gui in the function
otherwise, set the gui to the metadata tag instead of a variable

gleaming cosmos
#

im not op

gleaming cosmos
#

im telling him that lol

graceful nova
#

oh, I read that too fast then xD

#

sorry

gleaming cosmos
#

no problem

graceful nova
# cedar rapids ```vb function classgui(p: player): set {ingui::%uuid of {_p}%} to {_p}'s uu...

You have the right idea, but the wrong approach
Example command /test: trigger: set metadata tag "SomeGUI" to a new chest inventory with 1 row named "Name" set slot 1 of metadata tag "SomeGUI" to 3 stone named "Some Stone" open metadata tag "SomeGUI" to player
Using this method, you can then reference the gui anywhere and it will be on the player.
Just note when the player logs off, the metadata will still be there; but if the server shuts down, I believe it will dissapear

cedar rapids
#

okay will do

cedar rapids
#

like the name tag color

gleaming cosmos
#

the inventory's name?

#

shouldnt it?

cedar rapids
#

i added the {_p} later after it already didnt work

graceful nova
#

metadata tag "SomeTag" of player

#

you had the syntax backwards

cedar rapids
#

nice eye

#

new error : (

#

im entierly just a baby waiting to be spoon fed cuz i dont understand metadatas at all

#

got the meta datas working

#

just had to tweak the syntax around

graceful nova
#

you're still backwards

#

open (your metadata tag info here, the one I told you to fix) to {_p}

cedar rapids
#

👍

#

however

#

there is one thing i cant find for syntax on the internet

#
on inventory close:
    if metadata "Class gui" of player is event-inventory:
#

this is not detecting

set metadata tag "Class Gui" of {_p} to chest inventory with 1 row named "%{_guinamecolor} ? "&f&l"%Choose your class"

this inventory

graceful nova
#

it might just be the wording. you can try
if event-inventory is metadata tag "Your tag" of player:

cedar rapids
#

nice it detects now

#

but..............

#

the exact same thing is happening since the begining of this bug

#

Intended outcome:

I close the gui
Class Gui reopens
I close the gui
Class Gui reopens
Continued

Reality:

I close the gui
Class Gui reopens
I close the gui
Nothing.

graceful nova
#

so it detects the gui just fine, right?

#

what is the code to reopen the gui?

cedar rapids
#

heres the vid of whats happening

cedar rapids
#

im gonna manually reopen it now

#

hope it works

graceful nova
#

I meant send the code

cedar rapids
#

same outcome

cedar rapids
#
on inventory close:
    if event-inventory is metadata tag "Class Gui" of player:
        broadcast "&2'Class Gui' &finventory closed"
        set {ingui::%uuid of player%} to player's uuid    
        if team of player is {r}:
            set {_guinamecolor} to "&4&l"
        else if team of player is {b}:
            set {_guinamecolor} to "&1&l"     
        set metadata tag "Class Gui" of player to chest inventory with 1 row named "%{_guinamecolor} ? "&f&l"%Choose your class"
        set slot 0 of metadata tag "Class Gui" of player to paper "alot more nbt in these slots"
        open (metadata tag "Class Gui" of player) to player
        broadcast "&2'Class Gui'&f open"
graceful nova
#

before opening the gui, waitatick

cedar rapids
#

IT WORKS

#

this whole time the answer was sitting in the emoji list

graceful nova
#

figured that was the issue

cedar rapids
#

now all my gui fromats are converted to meta data tags for no reason lol

graceful nova
#

all of that is happening in the same tick, so opening the gui as soon as the inventory was closed, not enough time passes to create a new instance. So, wait a tick and you're good

cedar rapids
#

lets goo

graceful nova
cedar rapids
#

yeah but now immma have to refer to this code everytime i wanna remake a gui

#

i like vairables

#

what evs its done now

#

if metadata value "pyromaniac" of player is false:
if metadata value "shadowwalker" of player is false:
if metadata value "quickfoot" of player is false:
if metadata value "frontliner" of player is false:
if metadata value "hunter" of player is false:
if indices of {ingui::} contain the uuid of player:
classgui(player)
else:
remove player's uuid from {ingui::}
else:
remove player's uuid from {ingui::}
else:
remove player's uuid from {ingui::}
else:
remove player's uuid from {ingui::}
else:
remove player's uuid from {ingui::}
else:
remove player's uuid from {ingui::*}

#

now i gotta add this monstrocity to it

graceful nova
#

not necessarily. I only recommend metadata tags for things like guis

#

you don't need them for everything

cedar rapids
#

@gleaming cosmos Guess what!!

#

all it took was waitatick

#

thank you both for dealing with my crap