#How to see if a slot have a specific name?

1 messages · Page 1 of 1 (latest)

craggy breach
#

I dont know how to fix:

#

on inventory click: if event-inventory = (metadata tag "tools" of player): cancel event if index of event-slot is 13: if event-slot 13 has the name "&6&lSTICK":

shy linden
#

!format

dull pumiceBOT
# shy linden !format

:technologist: Code Blocks

To make it easier for others to read your code, it is asked that you send it in a code block. On Discord, you can simply send this:

```
Code here
```

shy linden
#

what are you exactly trying to do

craggy breach
#

The last bit

#

the if event-slot 13 has the name "&6&lSTICK":

shy linden
#

yes

#

...?

craggy breach
#

It doesnt work

craggy breach
#

I am trying to make like a shop with guis

shy linden
#

????

craggy breach
#

Bro what

shy linden
#

read the thing

craggy breach
#

How do i use the !format

shy linden
#

....

craggy breach
#

BRO IDK

shy linden
#

copy and paste

#

easy peasy lemon idk i forgot

craggy breach
#
on inventory click:
    if event-inventory = (metadata tag "tools" of player):
        cancel event
        if index of event-slot is 13:
            if event-slot 13 has the name "&6&lSTICK":
shy linden
#

finally

#

not so hard

#

uh

#

so what are you exactly trying to do

#

if you know that it's the right slot

craggy breach
#

if event-slot 13 has the name "&6&lSTICK": this part

shy linden
#

then why would you check its name

craggy breach
#

Cus i am adding a shop kind of thing

shy linden
#

yes

craggy breach
#

So like "When this variable is one show stick" "when it is 2 show a wooden shovel"

#

and it costs things too

shy linden
#

what

craggy breach
#

Wait

#

Bruh

shy linden
#

?

craggy breach
#

uhg

#

I am not pro at skript

shy linden
#

I can see

#

idk what ur trying to do tho

#

so you checked if the event-slot is 13

#

so yk they clicked the right slot

#

why do u need to check the "name"

craggy breach
#

Ok so what i am trying to make is like a shop

#

and you spawn with a cobblestone ( the worst tool ) and you upgrade

shy linden
#

the item in the event slot would change based on ur status?

#

that's why u gotta check if it's a stick or a wooden shovel

#

ig

craggy breach
#

ye

#

ye

shy linden
#

if event-slot is stick

#

maybe

craggy breach
#

oh

shy linden
#

do you have to check for the name or is this ok

craggy breach
#

But it doesnt change

#

wait

shy linden
#

?

craggy breach
#
if {tools.%{_p}%} is 1:
        set slot 13 of metadata tag "tools" of {_p} to stick of efficiency 1 named "&6&lSTICK" with lore "&a&lUPGRADE:&f 25 Sand" with all item flags
    else if {tools.%{_p}%} is 2:
        set slot 13 of metadata tag "tools" of {_p} to wooden shovel of efficiency 3 named "&6&lSTICK" with lore "&a&lUPGRADE:&f 1 Compressed Sand" with all item flags```
#
                if player's inventory contains 25 sand named "&e&lSAND":
                    if player's inventory contains 1 cobblestone named "&7&lROCK":
                        remove 1 cobblestone named "&7&lROCK" from player
                        add 1 stick of efficiency 1 named "&6&lSTICK" with lore "&7&o2nd Tool", "&0", "&9Efficiency: &f1", "&0" and "&7&oBAD" with all item flags to player
                        set {tools.%{_p}%} to 2
                        remove 25 sand named "&e&lSAND" from player```
shy linden
#

uh

#

uh

#

can u send them in one block of code

#

all combined

craggy breach
#

ok

#

Like the whole gui too?

#

ok

shy linden
#

ye

craggy breach
#

Wait do you know how to do like From this point to this all is white stained glass pane?

shy linden
#

what

craggy breach
#

Like set slot 1 to 26 white stained glass pane

#

Idk how to make that

#

or is that like a SkQuery thing

shy linden
#

send the gui code?

craggy breach
#

Too big

#

I can send in 2 diffrent messages tho

#
    set metadata tag "tools" of {_p} to chest inventory with 3 rows named "&b&lUPGRADES &f--> &a&lTOOLS"
    set slot 0 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 1 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 2 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 3 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 4 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 5 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 6 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 7 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 8 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 9 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 10 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 11 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 12 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    if {tools.%{_p}%} is 1:
        set slot 13 of metadata tag "tools" of {_p} to stick of efficiency 1 named "&6&lSTICK" with lore "&a&lUPGRADE:&f 25 Sand" with all item flags
    else if {tools.%{_p}%} is 2:
        set slot 13 of metadata tag "tools" of {_p} to wooden shovel of efficiency 3 named "&6&lSTICK" with lore "&a&lUPGRADE:&f 1 Compressed Sand" with all item flags```
shy linden
#

damn

craggy breach
#
    set slot 15 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 16 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 17 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 18 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 19 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 20 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 21 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 22 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 23 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 24 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 25 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    set slot 26 of metadata tag "tools" of {_p} to white stained glass pane named "&0"
    open (metadata tag "tools" of {_p}) to {_p}

on inventory click:
    if event-inventory = (metadata tag "tools" of player):
        cancel event
        if index of event-slot is 13:
            if event-slot is stick named "&6&lSTICK":
                if player's inventory contains 25 sand named "&e&lSAND":
                    if player's inventory contains 1 cobblestone named "&7&lROCK":
                        remove 1 cobblestone named "&7&lROCK" from player
                        add 1 stick of efficiency 1 named "&6&lSTICK" with lore "&7&o2nd Tool", "&0", "&9Efficiency: &f1", "&0" and "&7&oBAD" with all item flags to player
                        set {tools.%{_p}%} to 2
                        remove 25 sand named "&e&lSAND" from player```
shy linden
#

damn

craggy breach
#

kinda large

#

I did 1 line for every slot..

#

Cus i couldnt figure out how to make like set slot <number> to slot <number> of metadata tag "tools" of player to <something> named <something> ( this is not real code i just typed it out )

shy linden
#

idk I dont use this

#

I use skript-gui virtual chest inventory