#Npc shop

1 messages · Page 1 of 1 (latest)

hard prism
#
    if entity's name is "Test":
        set {Testgui} to a new chest inventory with 3 rows named "&7test"
        set slot intergers from 0 to 26 of {Testgui} to grey stained glass pane with name " "
        set slot 11 of {Testgui} to wooden axe with name "&6Tools"
        set slot 13 of {Testgui} to Leather Chestplate with name "&6Armor"
        set slot 12 of {Testgui} to oak log with name "&6Compressor"
        open {Testgui} to player

on inventory click:
    if name of event-inventory is "&6tools":
        if event-slot if 11:```
round onyx
#
  1. if you're going to define the GUI each time, might as well make it a local variable
  2. you define {Testgui}'s name as "&7test", but check for "&6tools"
  3. the event-slot is the item within the slot, not it's position. that is the index of event-slot. you should use:
  • event-slot = 1 of wooden axe named ...
  • index of event-slot = 11
hard prism
#

can you says that like if you were talking to a big idiot

#

cuz idk most of these skript terms

round onyx
#
  1. change {Testgui} to {_Testgui}
  1. the name you set the gui up with, and the name you check for on inventory click: are different.
  2. if you click on the wooden axe in slot 11, event-slot will not be equal to 11, but the wooden axe.
hard prism
#

ty

#

so i repleace all {Testgui} with {_Testgui}

#

replace*

round onyx
#

yup

hard prism
#

its saying i ahve an error

#
    if entity's name is "Test":
        set {_Testgui} to a new chest inventory with 3 rows named "&7test"
        set slot intergers from 0 to 26 of {_Testgui} to grey stained glass pane with name " "
        set slot 11 of {_Testgui} to wooden axe with name "&6Tools"
        set slot 13 of {_Testgui} to Leather Chestplate with name "&6Armor"
        set slot 12 of {_Testgui} to oak log with name "&6Compressor"
        open {_Testgui} to player

on inventory click:
    if name of event-inventory is "&6tools":
        if event-slot is 11:```
#

line 4

#

cant understant the effect/Condition

round onyx
#

intergers?

hard prism
#

okay

#

i removed intergers from but there is still an error

round onyx
#

no

#

its a typo

#

inte__r__gers

hard prism
#

so i keep it ?

round onyx
hard prism
#

they both spelled the same tho

round onyx
#

yes

#

but its spelled wrong

hard prism
#

no r ?

#

Integers?

round onyx
#

mhmm

hard prism
#

oops

#

lol

#

wait but when i click it does not show me the gui

round onyx
#

debug

#

add broadcasts and see where it stops

hard prism
#

ok

#

how do i debug and broadcoasts

round onyx
#
  broadcast "event registered"
  if condition:
    broadcast "if statement passed"```
hard prism
#

oh okay

#

i add it at the end ?

#

and uh if condition: there is an error

round onyx
#

yes

#

thats not realt code its an example

hard prism
#

oh

round onyx
#

after your event, i want you to broadcast.
after your if statement, i want you to broadcast

#

so we can see if those sections of code are being run

hard prism
#

okay

#
    if entity's name is "test":
        set {_Testgui} to a new chest inventory with 3 rows named "&7test"
        set slot integers from 0 to 26 of {_Testgui} to grey stained glass pane with name " "
        set slot 11 of {_Testgui} to wooden axe with name "&6Tools"
        set slot 13 of {_Testgui} to Leather Chestplate with name "&6Armor"
        set slot 12 of {_Testgui} to oak log with name "&6Compressor"
        open {_Testgui} to player

on event:
  broadcast "event registered"```
#

nothing is sent in chat

#

the skript is not working it seems like

round onyx
#

no

#

broadcast after your right-click on entity event

#

and after your if entity's name = "test"...

hard prism
#
  on event:
     broadcast "event registered"
    if entity's name is "test":
        set {_Testgui} to a new chest inventory with 3 rows named "&7test"
        set slot integers from 0 to 26 of {_Testgui} to grey stained glass pane with name " "
        set slot 11 of {_Testgui} to wooden axe with name "&6Tools"
        set slot 13 of {_Testgui} to Leather Chestplate with name "&6Armor"
        set slot 12 of {_Testgui} to oak log with name "&6Compressor"
        open {_Testgui} to player```
round onyx
#

...

hard prism
#

I KNOW I SUCK

round onyx
#
  broadcast "right-clicked on entity"
  if entity's name is "test":
    broadcast "name is test"```
hard prism
#

oohh

hard prism
#

it dont work