Solved Code to close a chest GUI?

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

wesnoah3

Active Member
Aug 18, 2017
73
3
8
Hello, I am making a multi-page chest gui but once I go to a different page than the main page it glitches out. For example things that are set "to be unstealable" are stealable. I believe its because when I go to a new page I just have another chest open which just overlays the old one. So my question is what is the code to close a chest GUI?
 
crbxn
http://imgur.com/a/crbxn

Hmm, where would I put "close player's current inventory"
 
for format slot if you're putting it at the end of the line it's just "to close", but they have to click on it to close the inventory. elsewise it goes on its own line.
format slot is super buggy though, I would use tuske gui instead, which is unstealable by default
[doublepost=1503017965,1503017852][/doublepost]https://github.com/Tuke-Nuke/TuSKe/wiki/GUI-Manager
I've installed Tuske but what is it instead of format slot?
 
follow the instructions for either the simple or the advanced gui, i sent the link just above:emoji_slight_smile: here it is again.
https://github.com/Tuke-Nuke/TuSKe/wiki/GUI-Manager
Unfortunately TuSKe seems to be making me mostly re-code the skript and creates more errors I cant seem to fix so I think I am going to stick with format slot until I run into an unpassable error.
[doublepost=1503019667,1503018959][/doublepost]
for format slot if you're putting it at the end of the line it's just "to close", but they have to click on it to close the inventory. elsewise it goes on its own line.
format slot is super buggy though, I would use tuske gui instead, which is unstealable by default
[doublepost=1503017965,1503017852][/doublepost]https://github.com/Tuke-Nuke/TuSKe/wiki/GUI-Manager
When I put to close after "to run [make player execute command "/punishcustomban %arg-1%"]" it comes up with an error
 
Unfortunately TuSKe seems to be making me mostly re-code the skript and creates more errors I cant seem to fix so I think I am going to stick with format slot until I run into an unpassable error.
[doublepost=1503019667,1503018959][/doublepost]
When I put to close after "to run [make player execute command "/punishcustomban %arg-1%"]" it comes up with an error
to close always comes first, then the lambda
code_language.skript:
to close then run [make player execute command "/punishcustomban %arg-1%"]
[doublepost=1503020246][/doublepost]Don't forget to search the Docs as well, they are a great source of examples and syntax. Use Ctrl+F to search key words
55c4c7b46c.png
 
Honestly, if you are going to use Lambdas with SkQuery's GUI, good luck. Lambdas can break when using SkQuery in some occasions. I'd rather go with TuSKe's GUI as it's better and fixes the bugs from SkQuery's GUI.
 
Honestly, if you are going to use Lambdas with SkQuery's GUI, good luck. Lambdas can break when using SkQuery in some occasions. I'd rather go with TuSKe's GUI as it's better and fixes the bugs from SkQuery's GUI.
Building on what white said, I know you said you get errors with tuske, but we can help you fix them here:emoji_slight_smile: I myself have all night. It'll just be so much more stable and easier to build off of for you in the future
 
Ok, I guess I'll give tuske another shot, my first problem is I don't understand how to translate it over from format slot to tuske version of it. For example how would I change
"format slot 0 of player with gray glass pane named " " to be unstealable"
to
"(format|create|make) [a] gui slot %integers% of %players% with %item stack% to [close then] (run|exe[cute]) %sender% command %string% [with permission %string%] [(using|with) %click action% [(button|click|action)]] [(using|with) cursor [item] %item stack%]
"
 
It's easiest to look at examples as opposed to the syntax(which can be super confusing at first). Firstly, use this button here to put your code in a code box:
a216b3249d.png
, it'll be so much easier to read, second, it's as easy as removing "to be unstealable" and adding "gui" before slot. So it would look like this:
code_language.skript:
format gui slot 0 of player with gray glass pane named "banana"
items formatted with tuske are unstealable by default
[doublepost=1503022848,1503022591][/doublepost]This example command is a great example of many diff ways you can use it.
code_language.skript:
command /guiExample:
    trigger:
        open virtual chest inventory to player
        format gui slot 0 of player with stone named "It won't do anything"
        format gui slot 1 of player with stone named "It will just close" to close
        format gui slot 2 of player with stone named "It will just close but only with pressing a number key" to close using number key
        format gui slot 3 of player with stone named "It will make the player execute a command, but he might not have permission" to run player command "/gui"
        format gui slot 4 of player with stone named "It will make the player execute a command with ""*"" permission" to run player command "/gui" with permission "*"
        format gui slot 5 of player with stone named "It will make the console execute a command" to run console command "/gui"
        format gui slot 6 of player with stone named "It will run the function doSomething()" to run function doSomething()
        format gui slot 7 of player with stone named "It will close and then run the function doSomething()" to close then run function doSomething()
        format gui slot 8 of player with stone named "It will run doSomething() if you click on it with a stone" to run function doSomething() with cursor stone
        format gui slot 9 of player with stone named "It will run the gui event" to run gui event
        format gui slot 10 of player with stone named "It will execute the code below":
            send "Hi" to player
            give a stone to player
            heal player
 
It's easiest to look at examples as opposed to the syntax(which can be super confusing at first). Firstly, use this button here to put your code in a code box:
a216b3249d.png
, it'll be so much easier to read, second, it's as easy as removing "to be unstealable" and adding "gui" before slot. So it would look like this:
code_language.skript:
format gui slot 0 of player with gray glass pane named "banana"
items formatted with tuske are unstealable by default
[doublepost=1503022848,1503022591][/doublepost]This example command is a great example of many diff ways you can use it.
code_language.skript:
command /guiExample:
    trigger:
        open virtual chest inventory to player
        format gui slot 0 of player with stone named "It won't do anything"
        format gui slot 1 of player with stone named "It will just close" to close
        format gui slot 2 of player with stone named "It will just close but only with pressing a number key" to close using number key
        format gui slot 3 of player with stone named "It will make the player execute a command, but he might not have permission" to run player command "/gui"
        format gui slot 4 of player with stone named "It will make the player execute a command with ""*"" permission" to run player command "/gui" with permission "*"
        format gui slot 5 of player with stone named "It will make the console execute a command" to run console command "/gui"
        format gui slot 6 of player with stone named "It will run the function doSomething()" to run function doSomething()
        format gui slot 7 of player with stone named "It will close and then run the function doSomething()" to close then run function doSomething()
        format gui slot 8 of player with stone named "It will run doSomething() if you click on it with a stone" to run function doSomething() with cursor stone
        format gui slot 9 of player with stone named "It will run the gui event" to run gui event
        format gui slot 10 of player with stone named "It will execute the code below":
            send "Hi" to player
            give a stone to player
            heal player
I did this to my first chest gui and got this http://imgur.com/a/97j3K
 
Is this correct? to run make console execute command "say Test"
Not quite, but getting there! Format it like this portion of the example command here:
code_language.skript:
format gui slot 5 of player with stone named "It will make the console execute a command" to run console command "/gui"
 
Not quite, but getting there! Format it like this portion of the example command here:
code_language.skript:
format gui slot 5 of player with stone named "It will make the console execute a command" to run console command "/gui"
Ok I changed it all without errors but now the GUI is broken, you can steal stuff from it and none of the commands work

Heres a piece of my skript, https://pastebin.com/d2EnD8D5
Is %arg-1% changed?
 
Okay so you don't need to check if arg 1 is set twice
I reloaded it on my server and it appears to be working just fine:emoji_slight_smile:
5e065362af.jpg

Nothing is moveable, the exit option closes it properly too, What is your MC version? I'm on 1.12.1, skript 2.2 dev 30d.
Just took your extra line out here and adjusted the indentation:
code_language.skript:
Command /punish <player>:
    trigger:
        if arg 1 is set:
            if player has permission "TC.menu.trainee":
                open chest with 3 rows named "&b[&cTrainee Menu&b] &dVictim: &6%arg-1%" to player
                wait 3 tick
                format gui slot 0 of player with gray glass pane named " "
                format gui slot 1 of player with gray glass pane named " "
                format gui slot 2 of player with gray glass pane named " "
                format gui slot 3 of player with gray glass pane named " "
                format gui slot 4 of player with gray glass pane named " "
                format gui slot 5 of player with gray glass pane named " "
                format gui slot 6 of player with gray glass pane named " "
                format gui slot 7 of player with gray glass pane named " "
                format gui slot 8 of player with gray glass pane named " "
                format gui slot 9 of player with gray glass pane named " "
                format gui slot 10 of player with gray glass pane named " "
                format gui slot 11 of player with book named "&8[&4Hacks&8]"
                format gui slot 12 of player with gray glass pane named " "
                format gui slot 13 of player with gray glass pane named " "
                format gui slot 14 of player with gray glass pane named " "
                format gui slot 15 of player with book named "&8[&aChat&8]"
                format gui slot 16 of player with gray glass pane named " "
                format gui slot 17 of player with gray glass pane named " "
                format gui slot 18 of player with gray glass pane named " "
                format gui slot 19 of player with gray glass pane named " "
                format gui slot 20 of player with paper named "&8&l[&4&lHacks of Any Kind&8&l]" with lore "&7Type: &6Warn &8// &6Reports to all staff members" to run player command "/say Test"
                format gui slot 21 of player with gray glass pane named " "
                format gui slot 22 of player with gray glass pane named " "
                format gui slot 23 of player with gray glass pane named " "
                format gui slot 24 of player with paper named "&8&l[&4&lChat Abuse of Any Kind&8&l]" with lore "&7Type: &6Warn &8// &6Reports to all staff members" to run player command "/say Test2"
                format gui slot 25 of player with gray glass pane named " "
                format gui slot 26 of player with barrier named "&4Exit" to close
[doublepost=1503025106,1503025005][/doublepost]I've noticed as well sometimes that when I make a lot of GUI or function changes sometimes my server just needs a restart to work properly again, so you may need to do that as well
 
Status
Not open for further replies.