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!


    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.

Issue Getting Commands To Execute Using GUI Items

Discussion in 'Skript' started by Lanchester, Feb 9, 2018.

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

    Lanchester New Member

    Jan 14, 2018
    Likes Received:
    So, this is an issue I've come across multiple times working on different commands and projects, and each time I would just shelve this part for later thinking it was just some syntax or wording errors I had in the codes, but at this point I've tried every different phrasing and syntax and whatever I can think of and it's still not working. Basically, whenever I try to code a gui, no matter what I do, when I click on the items nothing happens even though I have specified for some command or another to happen. There are no errors when Skript starts and there are no error messages showing on the console when I click on the items. The gui doesn't even close, the item just pops back into its slot and nothing happens. I've tried simplifying it to the most basic commands just to see if it was having trouble properly adding placeholders into the commands but to no avail. I'll post the code of the thing I'm currently working on to give an idea of what the gui should be doing:

    Code (Skript):
    1.     trigger:
    2.         open virtual chest with 3 rows named "Team Picker" to the player
    3.         loop all players:
    4.             set {_slot} to 0
    5.             add loop-value to {_players::*}
    6.             format gui slot {_slot} of player with {_players::*}'s skull to close then run player command "/scoreboard teams join {_players::*} %player%"
    7.             add 1 to {_slot}

    Ideally the command will open a gui that shows all the online players' heads and when you click on one you will join that player's scoreboard team. The gui opens fine and the player heads show up fine (thank you Donut) but clicking on them does nothing. I'm not even sure if the command in this snippet would work properly because I don't know if that's the proper way to insert variables into commands but I can't really test it because no commands I replace it with will work. Thank you in advance for any help!

    Skript Version:
    Skript 2.2 bensku-dev32d
    TuSKe Version: TuSKe 1.8.2
  2. Donut

    Donut Well-Known Member

    Mar 27, 2017
    Likes Received:
    By doing "{_players::*}'s skull" youre trying to get the skull of several players at once so skript freaks out and should be throwing this error
    Code (Text):
    1. [22:40:54 ERROR]: #!#! Stack trace:
    2. [22:40:54 ERROR]: #!#! ch.njol.skript.SkriptAPIException: Call to getSingle() on a non-single expression
    3. [22:40:54 ERROR]: #!#!     at ch.njol.skript.lang.util.SimpleExpression.getSingle(SimpleExpression.java:66)
    4. [22:40:54 ERROR]: #!#!     at ch.njol.skript.lang.util.ConvertedExpression.getSingle(ConvertedExpression.java:150)
    5. [22:40:54 ERROR]: #!#!     at com.github.tukenuke.tuske.sections.gui.EffFormatGUI.execute(EffFormatGUI.java:117)
    6. [22:40:54 ERROR]: #!#!     at com.github.tukenuke.tuske.util.EffectSection.check(EffectSection.java:54)
    7. [22:40:54 ERROR]: #!#!     at ch.njol.skript.lang.Condition.run(Condition.java:56)
    8. [22:40:54 ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61)
    9. [22:40:54 ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)
    10. [22:40:54 ERROR]: #!#!     at ch.njol.skript.lang.Trigger.execute(Trigger.java:55)
    11. [22:40:54 ERROR]: #!#!     at ch.njol.skript.command.ScriptCommand.execute2(ScriptCommand.java:220)
    12. [22:40:54 ERROR]: #!#!     at ch.njol.skript.command.ScriptCommand.execute(ScriptCommand.java:182)
    13. [22:40:54 ERROR]: #!#!     at ch.njol.skript.command.Commands.handleCommand(Commands.java:269)
    14. [22:40:54 ERROR]: #!#!     at ch.njol.skript.command.Commands$1.onPlayerCommand(Commands.java:164)
    15. [22:40:54 ERROR]: #!#!     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    16. [22:40:54 ERROR]: #!#!     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    17. [22:40:54 ERROR]: #!#!     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    18. [22:40:54 ERROR]: #!#!     at java.lang.reflect.Method.invoke(Unknown Source)
    19. [22:40:54 ERROR]: #!#!     at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302)
    20. [22:40:54 ERROR]: #!#!     at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
    21. [22:40:54 ERROR]: #!#!     at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:500)
    22. [22:40:54 ERROR]: #!#!     at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:485)
    23. [22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.PlayerConnection.handleCommand(PlayerConnection.java:1389)
    24. [22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1232)
    25. [22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:45)
    26. [22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:1)
    27. [22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13)
    28. [22:40:54 ERROR]: #!#!     at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    29. [22:40:54 ERROR]: #!#!     at java.util.concurrent.FutureTask.run(Unknown Source)
    30. [22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46)
    31. [22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:748)
    32. [22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406)
    33. [22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679)
    34. [22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577)
    35. [22:40:54 ERROR]: #!#!     at java.lang.Thread.run(Unknown Source)
    you just want to get the skull of loop-value. also the "set {_slot} to 0" line needs to be outside the loop or else each iteration the slot is being set back to 0
    Code (Skript):
    1. command /test:
    2.     trigger:
    3.         open virtual chest with 3 rows named "Team Picker" to the player
    4.         set {_slot} to 0
    5.         loop all players:
    6.             format gui slot {_slot} of player with loop-value's skull to close then run player command "/scoreboard teams join %loop-value% %player%"
    7.             add 1 to {_slot}
  3. Lanchester

    Lanchester New Member

    Jan 14, 2018
    Likes Received:
    Thank you for the help, the code you originally gave me started getting bastardized after many different attempts to get the click command working by replacing various things with other things I could find lol. I didn't try testing that code specifically with more than one player online so I would assume I didn't get the error since it didn't have more than one player it was trying to load. That being said I used the code you provided, and while the gui and player heads work clicking still does nothing :\ I removed all other plugins besides Skript and TuSKe in order to minimize interference but it still hasn't changed. Thank you for explaining the variables issue to me though, I've been trying to understand those better but I see I still have more to learn
    --- Double Post Merged, Feb 9, 2018, Original Post Date: Feb 9, 2018 ---
    Ok so I decided to test it further by just making a simple gui with this:
    Code (Skript):
    1.     open virtual chest with 1 row named "Team Picker" to the player
    2.     format gui slot 4 of player with dirt named "test" to close then run player command "gamemode survival"
    And the command actually DOES work for this. So I'm wondering if there is some sort of error being caused by having the items be generated from a loop or something like that. I don't know, it just seems like whenever I try the player head looping thing is when this issue is happening
Thread Status:
Not open for further replies.

Share This Page