Solved Trying to delete a list in a list variable

  • 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!

MiiTsY

Active Member
May 27, 2022
50
1
8
Hello, im trying to make a party system and I stock every parties in a list {parties::*} as a list that contains the players from the party {parties::'random uuid'::'players'} and im a the point where i'm trying to be able to run a command that would delete a specific party but I can't make it work.
If anyone has any idea where Im going wrong please, thank you!

Code:
        if arg-1 is "delete":
            if arg-2 is set:  
                loop {parties::*}:            #loop every parties
                    if contains({parties::%loop-value%::*}, arg-2) is true:     #check if loop party contains player arg-2
                        delete {parties::%loop-value%}      #does not work, loop value is a random uuid set on create
                                                            #tried deleting {parties::%loop-value%::*} but it delete the players but not the party
            else:
                loop {parties::*}:  #same but it deletes the party of the command runner instead, same problem
                    if contains({parties::%loop-value%::*}, player) is true:
                        delete {parties::%loop-value%}
        if arg-1 is "deleteall":      #this part works, dw about that
            delete {parties::*}
            send "deleted every parties" to player
 
Last edited:
Hey, wdym by delete a specific party, because im not sure if you are trying to delete only player from party or the whole party, if the whole party I dont think you need to make it so hard, you are creating a list named the same as the list you are storing it to.. its quite difficult to figure something out in this then.
If I were you i would make a better system in naming of lists. I think you dont actually need to go through every single party if you are trying to delete only one of them, i would just name the list of the party by the player who creates it so like {party::%player%::*} and then if player will want to delete the party you will just do delete {party::%player%::*} or smth like this. Its kind of hard for me to help you since I don't know how you want it to work.
 
Thank you for your time.

edit: The goal is to delete a whole party, not just the players in it yes

I agree that it'd be better than generating a random uuid for every parties since at the end of the day a player can be only in 1 party.
But isn't it gonna be the same issue? If i were to delete {party::%player%::*} it still would just delete the players and not the party no? Since it's the same as delete {parties::%loop-value%::*} which was only deleting the players in it.

I guess my problem here is really just being able to delete the party, the %player% part

PS: i'll be testing that later, don't have access to pc rn
 
I dont really understand what kind of party has only 1 player in it, whats the purpose of it?
For the issue - I mean the party is the list {party::%player%::*} if you delete the list (party) -> there will be no list (party).
I would probably need to understand what exactly you are trying to achieve with your code.
If you wont be able to fix your code still after that, you can add me on discord: danrub
It will be a lot easier communication.
 
Solved, instead of delete {parties::%loop-value%::*} alone, I followed up with remove %loop-value% from {parties::*} which would delete all members then the party.

Also thanks to DanRub suggestion, I went from random uuids for parties to instead naming it after the one who runs the command to create a party which simplifies a lot of stuff and remove the need for loops
Which ends up being:
Code:
        if arg-1 is "delete":
            if arg-2 is set:
                delete {parties::%arg-2%::*}
                remove arg-2 from {parties::*}
            else:
                delete {parties::%player%::*}
                remove player from {parties::*}
        if arg-1 is "deleteall":
            delete {parties::*}
            send "deleted every parties" to player