Solved on rightclick on chest with names items

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Delano

Member
Apr 15, 2018
17
2
0
25
so.. I made this script:
code_language.skript:
on rightclick on Chest:
    if name of chest is "Loot":
        cancel event
        message "hi" to player

But it doesn't seem to work.
I think the problem is with the if name of chest is, but I can't figure out why.
I don't get an error code or anything and skript is working fine.
Thanks
 
don't they? But when you rename a chest/shulker box/dispenser you see the name at the top of the GUI
[doublepost=1524077246,1524077185][/doublepost]or is there a way to mark a chest with a variable?
 
Its because when you open the chest the name is attached to it, but if you just CLICK on the block, the block itself does not hold an ID tag.
I have found this out the hard way..... when placing a block you need to set a location variable, and then call upon that variable.... like "if block is located at {variable}" that kind of thing.
 
Ah thanks. I can work with that :3
[doublepost=1524581589,1524079045][/doublepost]so I recently tried this (sorry for not trying this earlier, I was a bit busy) but this doesn't seem to work.
here is my new code:
code_language.skript:
on rightclick on chest:
    if chest is located at {loot.chest.test.1}:
        cancel event
        message "test" to player

error:
can't compare an item type with 'located at {loot.chest.test.1}' (loot.sk, line 54: if block is located at {loot.chest.test.1}:')
 
  • Like
Reactions: ShaneBee
try this instead
code_language.skript:
on rightclick on chest:
    if location of event-block is {loot.chest.test.1}:
        cancel event
        message "test" to player
 
hm. I don't seem to get an error with this code but it doesn't work..
I have a command to set "{loot.chest.test.1}" but when I place a chest and rightclick it it doesn't seem to work.. :/
this is the code right now:
code_language.skript:
command /loot <text> [<text>] [<text>]:
    trigger:
        if arg-1 is "timer":
            set {%player%.loot.timer} to 0
        if arg-1 is "set":
            if arg-2 is "test":
                if arg-3 is "1":
                    set {loot.chest.test.1} to location of player
                    message "<purple>[Loot] &eLootchest has been set!"

on rightclick on chest:
    if location of event-block is {loot.chest.test.1}:
        cancel event
        message "test" to player
 
its because youre setting your variable to the location of the player, not the location of a chest
I would do something like setting it to a block the player is looking at
 
I have this right now:
code_language.skript:
command /loot <text> [<text>] [<text>]:
    trigger:
        if arg-1 is "timer":
            set {%player%.loot.timer} to 0
        if arg-1 is "set":
            if arg-2 is "test":
                if arg-3 is "1":
                    set target block to {loot.chest.test.1}
                    message "<purple>[Loot] &eLootchest has been set!"

on rightclick on chest:
    if location of event-block is {loot.chest.test.1}:
        cancel event
        message "test" to player

but it still doesn't seem to work...
 
I feel like a case like this, you will either need to enter the numbers of the location manually, or use a click event to set the location of the actual chest
or stand on top of the chest and set your command to do:
set {loot.chest.test.1} to location of 1 block below player
 
Status
Not open for further replies.