#inventory click

1 messages · Page 1 of 1 (latest)

sly jungle
#

plain %item%?

daring glade
sly jungle
#

amount of ...

daring glade
#

What?

sly jungle
#

like you already have in your code..

#

but add the plain part so it only detects items without any extra NBT

daring glade
#

if clicked slot is 12:
set {block1} to clicked slot
set {naam1} to name of {block1}
set {naam2} to clicked slot
plain {naam2}
send "%{naam1}%"
send "%{naam2}%"
set {_lore1} to numbers of uncoloured line 1 of {block1}'s lore parsed as a number
if "%click type%" contains "LEFT":
set {_aantal1} to amount of {naam2} in player's inventory
if {_aantal1} is bigger than 0:
remove 1 of {_aantal1} from player's inventory

#

doesn't work..

hybrid wadiBOT
#

x8ight suggests that you read this embed

Formatting Code In Discord
Why?

Code blocks make it easier for helpers to identify potential errors -- help them help you!

The Format

```vb
on chat:
broadcast "This is how you format code!"
```

How It Looks
on chat:
    broadcast "This is how you format code!"
Extra Info

On US keyboards, the grave character (`) is located above the tab key on the top left of the keyboard

sly jungle
daring glade
#

do i need to use, plain "%{naam2}%"?

sly jungle
#

no

daring glade
#

How than

#

I'am trying to solve this for a couple of hours, but it didn't worked so well

sly jungle
#
  1. format your code
  2. explainpls
daring glade
#

How do you mean format your code

sly jungle
daring glade
#

on inventory click:
if name of player's current inventory is "&8Quickshop":
cancel event
if clicked slot is 12:
set {block1} to clicked slot
set {naam1} to name of {block1}
set {naam2} to {block1}
plain {naam2}
send "%{naam1}%"
set {_lore1} to numbers of uncoloured line 1 of {block1}'s lore parsed as a number
if "%click type%" contains "LEFT":
set {_aantal1} to amount of {naam2} in player's inventory
if {_aantal1} is bigger than 0:
remove 1 of {_aantal1} from player's inventory

#

This is the whole code

sly jungle
#

cool

daring glade
#

But, how do i set {naam2} to the clicked slot without any lore?

sly jungle
#
  1. You have not formatted the code
  2. you have not done what I told you to do
  3. if you want the event-slot (not clicked slot), you can also literally use that expression
daring glade
#

i just want a variable without any lore

sly jungle
#

read that

#
  should look like this```
daring glade
#
    if name of player's current inventory is "&8Quickshop":
        cancel event
        if event-slot is 12:
            set {block1} to event-slot
            set {naam1} to name of {block1}
            set {naam2} to {block1}
            plain {naam2}
            send "%{naam2}%"
            set {_lore1} to numbers of uncoloured line 1 of {block1}'s lore parsed as a number
            if "%click type%" contains "LEFT":
                set {_aantal1} to amount of {naam2} in player's inventory
                if {_aantal1} is bigger than 0:
                    remove 1 of {_aantal1} from player's inventory```
sly jungle
#

🎉

#

now, you can literally use the event-slot expression (you should also be using index of event-slot = 12)

#

and then combine that with plain for plain event-slot...

sly jungle
#

its not an effect

daring glade
#

How than?

sly jungle
#

its an expression

daring glade
#

set {naam2} to event-slot plain {naam2} send "%{naam2}%"

sly jungle
#

no

#

set it to the expression

#

and honestly these variable should be local but i dont think they are needed at all

daring glade
#

That is 10times easier

sly jungle
#

im not here to write code for you

daring glade
#

Can you than tell me please how to make it working

sly jungle
daring glade
#

♥️ I solved it! thanksss you!