Multiple Groups Error?

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

Jacksonnn

Member
Feb 7, 2017
10
2
0
21
This is mainly a thread for @Sharpjaws, the developer of the addon that enables this condition, but basically on my server we are a ProjectKorra server. For those who don't know what that is, it's a Bending Server (like Avatar: The Last Airbender & Avatar: The Legend of Korra). We have an Avatar Rank that you can have when you're other ranks like Elite and VIP and Noble. The hierarchy in the player permissions is (Main rank) then Avatar). The problem with this though is that it won't count Avatar group with the Elite (and others) group. It gives no errors in console or in game, so I don't know exactly why it happens or what to do to fix it.

Please help me as soon as you can,

Jackson

Skript Version: Skript 2.2 (dev20)
Skript Author: Bensku
Minecraft Version: 1.10
---
Full Code:
https://hastebin.com/famowecehi.vbs
There is 2724 lines of code, bless your soul if you read it all.


Errors on Reload:
None.

Console Errors: (if applicable)
None.
Addons using (including versions):
SKRambled, SkQuery 4.0, SharpSK,
Troubleshooting:
Have you tried searching the docs? No
Have you tried searching the forums? No
What other methods have you tried to fix it? I have tried changing groups to a group that exists but isn't used.​
 
Just only tips... You can make the code more easier...

code_language.skript:
command /gamemode <text>:
    trigger:
        if groups of player contains "Noble":
            If groups of player contains "Avatar":
                if arg-1 is "Spectator":
                    stop
                if arg-1 is "3":
                    stop
                if arg-1 is "Creative" or "1":
                    if player is in "world" or "world_nether" or "world_the_end" or "StaffWorld" or "Probending":
#Only 1 excuteing command. Now with others... and you will reduce maybe to 200 lines or less.
 
Just only tips... You can make the code more easier...

code_language.skript:
command /gamemode <text>:
    trigger:
        if groups of player contains "Noble":
            If groups of player contains "Avatar":
                if arg-1 is "Spectator":
                    stop
                if arg-1 is "3":
                    stop
                if arg-1 is "Creative" or "1":
                    if player is in "world" or "world_nether" or "world_the_end" or "StaffWorld" or "Probending":
#Only 1 excuteing command. Now with others... and you will reduce maybe to 200 lines or less.

Welp, wish I knew that before I made 2724 lines of code rip. :emoji_disappointed_relieved:
 
Hi there :emoji_smile: Thank you for the bug report. One little thing, could you please also specify the version of the addon? It can be easily done by the cmd "/shsk version". Also try adding some debug messages in like:
code_language.skript:
command /gamemode <text>:
   trigger:
       broadcast "%groups of player%"
       if groups of player contains "Noble":
           if groups of player contains "Avatar":
               if arg-1 is "Spectator":
                   stop
               if arg-1 is "3":
                   stop
So you can check if it actually grabs the group list.
I will look into this issue for sure. It will be fixed asap
Lastly you can easily group your "if" conditions like this:
code_language.skript:
command /gamemode <text>:
   trigger:
       broadcast "%groups of player%"
       if groups of player contains "Noble" and "Avatar":
If you easily want to check if the player contains both groups in 1 if condition.
 
@Jacksonnn Ah yes that version is very outdated. Try updating your version to the latest one which is currently 1.6.1.5. You can get it from my github page here: https://github.com/Sharpjaws/SharpSK/releases or simply from the skunity resource page.
Not sure if it fixes the problem but it might work. Meanwhile could you test it some more by giving the player only 1 group and then see if it gets the group? Also do you have Discord? (It basically helps me solve your issue alot faster since I can help you directly) :emoji_smile:
 
Last edited by a moderator:
@Jacksonnn Ah yes that version is very outdated. Try updating your version to the latest one which is currently 1.6.1.5. You can get it from my github page here: https://github.com/Sharpjaws/SharpSK/releases or simply from the skunity resource page.
Not sure if it fixes the problem but it might work. Meanwhile could you test it some more by giving the player only 1 group and then see if it gets the group? Also do you have Discord? (It basically helps me solve your issue alot faster since I can help you directly) :emoji_smile:

I don't have Discord sorry, but I updated it and re-enabled the script and Avatars of Noble VIP and Elite still can't use it. Also, It works if the user only has one group.
 
No problem, but do you by chance know when this will be fixed @Sharpjaws? I have to announce it to the players of my server who would be going to the 'CreativeWorld' in the Skript.
 
The update is planned to be released on Thursday (If everything goes smoothly). If I didn't release the update as planned because of any unexpected causes, delays, etc. Then it will be probably on Friday or Saturday (depending on the situation). So lets say the release date will be almost at the end of the week.
 
  • Like
Reactions: Jacksonnn
@Jacksonnn The update has been released!
Also after investigating for abit the "if something contains something" < syntax from skript is actually a bit broken. You see I've noticed that it only works for single lines and not a list of things (Like the groups we want to check). So I have thought of a workaround that may work and it does require my latest release:

code_language.skript:
function checkgroup(p: OfflinePlayer, gp: String) :: Boolean:
   loop groups of {_p}:
       if loop-string is {_gp}:
           return true
           exit
   return false


command /test:
   trigger:
       if checkgroup(the player, "default") is true:
           broadcast "true"
       else:
           broadcast "false"
So as you can see above. I have created a function which loops through the list of groups to see if it matches the group you provided.
This is then demonstrated with the example command below it. The first argument of the function is the player and the second one is the group you want to check for if the player "contains" or has the group.

So I advise you to put the function mentioned here into your code like this:
code_language.skript:
function checkgroup(p: OfflinePlayer, gp: String) :: Boolean:
   loop groups of {_p}:
       if loop-string is {_gp}:
           return true
           exit
   return false

command /gamemode <text>:
   trigger:
       if groups of player contains "Noble":
           If groups of player contains "Avatar":
               if arg-1 is "Spectator":
                   stop
and replace:
code_language.skript:
       if groups of player contains "Noble":
Or anything related like that to:
code_language.skript:
 if checkgroup(the player, "Noble") is true:
Hopefully that should work. Let me know if any problems occured while trying this out :emoji_thumbsup:
 
Last edited by a moderator:
@Sharpjaws Great! Thanks! Sorry it took two days to respond, but I have some questions about this, I can try to get Discord if you can help me. I also have skype if that is an option as well. Thanks for the help thus far and seems like this might work!

Thanks again,
Jackson
 
  • Like
Reactions: Sharpjaws
@Jacksonnn Sure, no problem! I don't use Skype very much so I prefer using Discord. Just send a PM or mention me in Discord and I will answer any questions you may have. My Discord name is the same as on here so if you see me online, ask right away :emoji_thumbsup:
 
Last edited by a moderator:
  • Like
Reactions: Jacksonnn
Status
Not open for further replies.