Issue Getting Commands To Execute Using GUI Items

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

Lanchester

New Member
Jan 14, 2018
9
0
0
27
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_language.skript:
    trigger:
        open virtual chest with 3 rows named "Team Picker" to the player
        loop all players:
            set {_slot} to 0
            add loop-value to {_players::*}
            format gui slot {_slot} of player with {_players::*}'s skull to close then run player command "/scoreboard teams join {_players::*} %player%"
            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
 
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_language.skript:
    trigger:
        open virtual chest with 3 rows named "Team Picker" to the player
        loop all players:
            set {_slot} to 0
            add loop-value to {_players::*}
            format gui slot {_slot} of player with {_players::*}'s skull to close then run player command "/scoreboard teams join {_players::*} %player%"
            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
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:
[22:40:54 ERROR]: #!#! Stack trace:
[22:40:54 ERROR]: #!#! ch.njol.skript.SkriptAPIException: Call to getSingle() on a non-single expression
[22:40:54 ERROR]: #!#!     at ch.njol.skript.lang.util.SimpleExpression.getSingle(SimpleExpression.java:66)
[22:40:54 ERROR]: #!#!     at ch.njol.skript.lang.util.ConvertedExpression.getSingle(ConvertedExpression.java:150)
[22:40:54 ERROR]: #!#!     at com.github.tukenuke.tuske.sections.gui.EffFormatGUI.execute(EffFormatGUI.java:117)
[22:40:54 ERROR]: #!#!     at com.github.tukenuke.tuske.util.EffectSection.check(EffectSection.java:54)
[22:40:54 ERROR]: #!#!     at ch.njol.skript.lang.Condition.run(Condition.java:56)
[22:40:54 ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:61)
[22:40:54 ERROR]: #!#!     at ch.njol.skript.lang.TriggerItem.walk(TriggerItem.java:89)
[22:40:54 ERROR]: #!#!     at ch.njol.skript.lang.Trigger.execute(Trigger.java:55)
[22:40:54 ERROR]: #!#!     at ch.njol.skript.command.ScriptCommand.execute2(ScriptCommand.java:220)
[22:40:54 ERROR]: #!#!     at ch.njol.skript.command.ScriptCommand.execute(ScriptCommand.java:182)
[22:40:54 ERROR]: #!#!     at ch.njol.skript.command.Commands.handleCommand(Commands.java:269)
[22:40:54 ERROR]: #!#!     at ch.njol.skript.command.Commands$1.onPlayerCommand(Commands.java:164)
[22:40:54 ERROR]: #!#!     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[22:40:54 ERROR]: #!#!     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[22:40:54 ERROR]: #!#!     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[22:40:54 ERROR]: #!#!     at java.lang.reflect.Method.invoke(Unknown Source)
[22:40:54 ERROR]: #!#!     at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302)
[22:40:54 ERROR]: #!#!     at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
[22:40:54 ERROR]: #!#!     at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:500)
[22:40:54 ERROR]: #!#!     at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:485)
[22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.PlayerConnection.handleCommand(PlayerConnection.java:1389)
[22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1232)
[22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:45)
[22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:1)
[22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13)
[22:40:54 ERROR]: #!#!     at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
[22:40:54 ERROR]: #!#!     at java.util.concurrent.FutureTask.run(Unknown Source)
[22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46)
[22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:748)
[22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406)
[22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679)
[22:40:54 ERROR]: #!#!     at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577)
[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_language.skript:
command /test:
    trigger:
        open virtual chest with 3 rows named "Team Picker" to the player
        set {_slot} to 0
        loop all players:
            format gui slot {_slot} of player with loop-value's skull to close then run player command "/scoreboard teams join %loop-value% %player%"
            add 1 to {_slot}
 
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
[doublepost=1518218494,1518149282][/doublepost]Ok so I decided to test it further by just making a simple gui with this:
code_language.skript:
    open virtual chest with 1 row named "Team Picker" to the player
    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
 
Status
Not open for further replies.