1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved on rightclick on chest with names items

Discussion in 'Skript' started by Delano, Apr 18, 2018.

Thread Status:
Not open for further replies.
  1. Delano

    Delano Member

    Joined:
    Apr 15, 2018
    Messages:
    17
    Likes Received:
    2
    so.. I made this script:
    Code (Skript):
    1. on rightclick on Chest:
    2.     if name of chest is "Loot":
    3.         cancel event
    4.         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
     
  2. Kyllian

    Kyllian New Member

    Joined:
    Oct 7, 2017
    Messages:
    6
    Likes Received:
    0
    Im not really good at this sort of stuff but did you write somewhere you are also giving that chest the name "loot"?
     
  3. SpinKnight

    Supporter + Supporter

    Joined:
    May 24, 2017
    Messages:
    30
    Likes Received:
    0
    Placed blocks doesn't have custom names
     
  4. Delano

    Delano Member

    Joined:
    Apr 15, 2018
    Messages:
    17
    Likes Received:
    2
    don't they? But when you rename a chest/shulker box/dispenser you see the name at the top of the GUI
    --- Double Post Merged, Apr 18, 2018, Original Post Date: Apr 18, 2018 ---
    or is there a way to mark a chest with a variable?
     
  5. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    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.
     
  6. Delano

    Delano Member

    Joined:
    Apr 15, 2018
    Messages:
    17
    Likes Received:
    2
    Ah thanks. I can work with that :3
    --- Double Post Merged, Apr 24, 2018, Original Post Date: Apr 18, 2018 ---
    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 (Skript):
    1. on rightclick on chest:
    2.     if chest is located at {loot.chest.test.1}:
    3.         cancel event
    4.         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 Like x 1
  7. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    try this instead
    Code (Skript):
    1. on rightclick on chest:
    2.     if location of event-block is {loot.chest.test.1}:
    3.         cancel event
    4.         message "test" to player
     
  8. Delano

    Delano Member

    Joined:
    Apr 15, 2018
    Messages:
    17
    Likes Received:
    2
    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 (Skript):
    1. command /loot <text> [<text>] [<text>]:
    2.     trigger:
    3.         if arg-1 is "timer":
    4.             set {%player%.loot.timer} to 0
    5.         if arg-1 is "set":
    6.             if arg-2 is "test":
    7.                 if arg-3 is "1":
    8.                     set {loot.chest.test.1} to location of player
    9.                     message "<purple>[Loot] &eLootchest has been set!"
    10.  
    11. on rightclick on chest:
    12.     if location of event-block is {loot.chest.test.1}:
    13.         cancel event
    14.         message "test" to player
     
  9. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    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
     
  10. Delano

    Delano Member

    Joined:
    Apr 15, 2018
    Messages:
    17
    Likes Received:
    2
    I have this right now:
    Code (Skript):
    1. command /loot <text> [<text>] [<text>]:
    2.     trigger:
    3.         if arg-1 is "timer":
    4.             set {%player%.loot.timer} to 0
    5.         if arg-1 is "set":
    6.             if arg-2 is "test":
    7.                 if arg-3 is "1":
    8.                     set target block to {loot.chest.test.1}
    9.                     message "<purple>[Loot] &eLootchest has been set!"
    10.  
    11. on rightclick on chest:
    12.     if location of event-block is {loot.chest.test.1}:
    13.         cancel event
    14.         message "test" to player
    but it still doesn't seem to work...
     
  11. ShaneBee

    Moderator Resource Staff Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,184
    Likes Received:
    222
    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
     
  12. Delano

    Delano Member

    Joined:
    Apr 15, 2018
    Messages:
    17
    Likes Received:
    2
    I will try that thanks!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...