Tutorial by: AlexLew


Good morning, everybody! Today, I'll tell you how to make guis with tuske.

How does TuSke GUI work?

TuSke GUIs are very similar to SkQuery GUIs in their composition:

open (virtual %inventory type% inventory [with size %integer%] [(named|with (name|title)) %string%]) to %players%

Many people are not going to understand this code, so we will translate it:

Open a virtual inventory with a size of X lines named Y to the player.

Now that we have our inventory, we're going to put things in it:

(format|create|make) [a] gui slot %numbers% of %players% with %itemstack% to [do] nothing
(format|create|make) [a] gui slot %numbers% of %players% with %itemstack% to close [using %click action% [(button|click|action)]]
(format|create|make) [a] gui slot %numbers% of %players% with %itemstack% to [close then] run %command sender% command %string% [as op] [using %click action% [(button|click|action)]] [with cursor [item] %itemstack%]
(format|create|make) [a] gui slot %numbers% of %players% with %itemstack% to [close then] run function %function% [using %click action% [(button|click|action)]] [with cursor [item] %itemstack%]

This is all the possibilities for adding items to the inventory.
To understand a little better, tell you what:

| : Wants to say "or" .

[a]... : Is not obligatory.

%number% : Is the slot of the item.

%players% : Is the player/a player

%itemstack% : Is the item.

%command sender% : Is the person/player/console executing the command

%click action% : Is the click used

%function% : Executes a function

%string% : Is the command

Well, I hope you've already managed to figure out what was the hardest part.
Using this addon a lot, I was able to test the different ways of using it. We will now see which are the best "options".

What are the best "options"?

When I talk about "options", I am of course talking about "or" and "%string%, %function%, %click share%, %click%...
Well.
The "option" to use to put an item, the best, is this one:

format gui slot %numbers% of %players% with %itemstack% to [do] nothing

The "to [do] nothing" can be modified.

Why didn't I choose "create or "make"? Simply because these two "options" make your server paddle too much. The average time of a skript reload with these two "options" is 20 seconds to 1 minute while with "format", the time is not 5 seconds (I let you test by yourself).

What is the translation of all these "options"?

First of all, we will display the GUI and explain the functionalities of each one:

open virtual chest inventory with size X named "Y" to player
format gui slot %numbers% of %players% with %itemstack% to [do] nothing

Displays a GUI to the player's "%numbers%" slot with the item "%itemstack%" that does not move when clicked.

format gui slot %numbers% of %players% with %itemstack% to close [using %click action%]

Displays a GUI to the player's %numbers% slot with the item "%itemstack%" that closes when you click on it (and can be feminized with a particular click as right, left click... (using %click action%)).

format gui slot %numbers% of %players% with %itemstack% to run %command sender% command %string%

Displays a GUI to the player's "%numbers%" slot with the item "%itemstack%" that executes a command when clicked.

format gui slot %numbers% of %players% with %itemstack% to close then run %command sender% command %string% [as op] [using %click action% [(button|click|action)]] [with cursor [item] %itemstack%]

Displays a GUI to the player's %numbers% slot with the item "%itemstack%" that closes and executes a command when clicking on it ([as op] = is op;[with cursor[item] %itemstack%] = with the cursor on the item "%itemstack%").

format gui slot %numbers% of %players% with %itemstack% to close then run function %function%

Displays a GUI to the player's %numbers% slot with the item "%itemstack%" that closes and executes a function when clicked.

What are clicks events for?

Click events allow you to make several effects with only 1 item in the virtual inventory.
Example: An iron block: Right click, it sends a message to the player. We're doing a left-hand clique, he's doing a broadcast.

format gui slot 1 of player with Iron Block to close then run player command "/broadcast" with left click
format gui slot 1 of player with Iron Block to close then run player command "/send" with right click

Do you understand the idea?

Here is a simple example:

open virtual chest inventory with size 1 named "This menu is a test" to player
format gui slot 4 of player with diamond sword named "The name of my object" to close then run player command "/macommande"

For functions, it is the same idea:

open virtual chest inventory with size 1 named "This menu is a test" to player
format gui slot 4 of player with diamond sword named "The name of my object" to run function MyFunction(player, "Blablabla")

To use the clicks, you will have to create the same item several times but with a different effect:

open virtual chest inventory with size 1 named "This menu is a test" to player
format gui slot 4 of player with diamond sword named "The name of my object" to run function MyFunction(player, "Blablabla") with "right" click
format gui slot 4 of player with diamond sword named "The name of my object" to run function MySecondFunction(player, "Blablabla") with "left" click

Well, you can also execute several effects from a slot like this:

open virtual chest inventory with size 1 named "This menu is a test" to player
format gui slot 4 of player with diamond sword named "The name of my object" to run:
    set {_myvariable} to 4
    send "Omg, it's the slot %{_myvariable}%!"

Hopefully this little tutorial will get you more.


Did you find AlexLew's tutorial helpful?


You must be logged in to comment