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 Can't remove location from list variable

Discussion in 'Skript' started by Zyxed, Feb 8, 2022.

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

    Supporter

    Joined:
    May 17, 2021
    Messages:
    23
    Likes Received:
    1
    I've encountered a really weird problem, and I can't find the solution. I have 2 different tools that I use to add locations to list variable, and the other one would be used to remove location from list variable. BUT this one (if {br.mythic.chest.locations::*} contains {_loc}:emoji_slight_smile: is not working, even if the block coordinates are exactly the same, even pitch and yaw.

    So I made a test event with on break of gold block, and in this one, when all of the code is inside of the same event, it works. Why? I don't understand. And no errors at all, everything else works fine.

    Code (Text):
    1.  
    2.  
    3. #THIS CODE ADDS LOCATION INTO THE LIST VARIABLE
    4. on block place of bedrock:
    5.     if world of player is "alkumaailma":
    6.         if name of player's tool is "Sijainti LISÄYS työkalu":
    7.             #Normaalit arkut
    8.             if {BR.adding.loc::%player's uuid%} is "normal":
    9.                 cancel event
    10.                 if {br.chest.locations::*} or {br.mythic.chest.locations::*} contains location of event-block:
    11.                     send "&cTämä sijainti on jo lisätty!" to player
    12.                     stop
    13.                 else:
    14.                     add location of event-block to {br.chest.locations::*}
    15.                     send "&6%location of event-block% &flisätty arkkujen sijainti ryhmään" to player
    16.            
    17.             #Myyttiset arkut
    18.             else if {BR.adding.loc::%player's uuid%} is "mythic":
    19.                 cancel event
    20.                 if {br.mythic.chest.locations::*} or {br.chest.locations::*} contains location of event-block:
    21.                     send "&cTämä sijainti on jo lisätty!" to player
    22.                     stop
    23.                 else:
    24.                     add location of event-block to {br.mythic.chest.locations::*}
    25.                     send "&6%location of event-block% &flisätty myyttisten arkkujen sijainti ryhmään" to player
    26.  
    27. #THIS CODE SHOULD BROADCAST "DEBUG2" BUT IT DOES NOT!
    28. on break of ender chest:
    29.     if world of player is "alkumaailma":
    30.         if name of player's tool is "Sijainnin POISTAMIS työkalu":
    31.             if {BR.deleting.single.loc::%player's uuid%} is set:
    32.                 broadcast "Debug 1"
    33.                 cancel event
    34.                 set {_loc} to location of event-block
    35.                 broadcast "%{_loc}%"
    36.                 if {br.mythic.chest.locations::*} contains {_loc}:
    37.                     broadcast "Debug 2"   #THIS IS NOT WORKING!
    38.  
    39.    
    40.  
    41. #WHY THIS ONE WORKS?  
    42. on break of gold block:
    43.     add location of event-block to {locations::*}
    44.     broadcast "%{locations::*}%"
    45.     set {_loc} to location of event-block
    46.     broadcast "%{_loc}%"
    47.     if {locations::*} contains {_loc}:
    48.         broadcast "working"
    49.  


     
  2. Best Answer:
    Post #3 by Zyxed, Feb 9, 2022
  3. sleepy unk

    sleepy unk Member

    Joined:
    Feb 8, 2022
    Messages:
    25
    Likes Received:
    0
    Try using "set" instead of add.
     
  4. Zyxed

    Supporter

    Joined:
    May 17, 2021
    Messages:
    23
    Likes Received:
    1
    SOLVED!

    Chest had to be changed to some other block before trying to check and remove location from list variable. That's why it worked on the break of gold block event. Chest is not event-block or something..
     
Thread Status:
Not open for further replies.

Share This Page

Loading...