Change gui menu on press

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

Nailes

Member
Apr 10, 2019
20
0
0
20
Hello, i am anting to know if it is possible to change what is in a gui menu based on what was pressed on the gui menu before without making several gui menus. Example: In gui menu i press plotmine 1 then it opens gui menu where i can change the blocks, then if i press plotmine 2 it opens the same gui menu just where i can change the blocks to something other then from plotmine 1, thanks here is code.
Code:
command /plotminesetup:
    description: Menu that players use to setup their plotmines
    executable by: players
    permission: plotmine.setup
    trigger:
        set {_netherstar::*} to "&bSmå &8»&7 %{plotmines.small.%player%}%&8/%{plotmines.small.all.%player%}%", "&bMellem &8»&7 %{plotmines.medium.%player%}%&8/%{plotmines.medium.all.%player%}%", "&bStore &8»&7 %{plotmines.big.%player%}%&8/%{plotmines.big.all.%player%}%", "" and "&cKlik for at gå tilbage"
        if {plotmines.small.all.%player%}, {plotmines.medium.all.%player%} or {plotmines.big.all.%player%} is greater than 0:
            wait 2 ticks   
            open chest with 6 rows named "&9&lPlotmine - Opsæt" to player
            wait 1 tick
            format slot 0 of player with blue stained glass pane named "-" to be unstealable
            format slot 1 of player with purple stained glass pane named "-" to be unstealable
            format slot 2 of player with blue stained glass pane named "-" to be unstealable
            format slot 3 of player with purple stained glass pane named "-" to be unstealable
            format slot 4 of player with blue stained glass pane named "-" to be unstealable
            format slot 5 of player with purple stained glass pane named "-" to be unstealable
            format slot 6 of player with blue stained glass pane named "-" to be unstealable
            format slot 7 of player with purple stained glass pane named "-" to be unstealable
            format slot 8 of player with blue stained glass pane named "-" to be unstealable
            format slot 10 of player with iron pickaxe named "&9&lSmå plotmines" with lore "&7Her ses dine små plotmines" to be unstealable   
            format slot 13 of player with gold pickaxe named "&9&lMellem plotmines" with lore "&7Her ses dine mellem plotmines" to be unstealable
            format slot 16 of player with diamond pickaxe named "&9&lStore plotmines" with lore "&7Her ses dine store plotmines" to be unstealable   
            format slot 19 of player with red clay named "&c&lLille plotmine 1" with lore "&7Du ejer ikke en lille plotmine" to be unstealable
            format slot 22 of player with red clay named "&c&lMellem plotmine 1" with lore "&7Du ejer ikke en mellem plotmine" to be unstealable
            format slot 25 of player with red clay named "&c&lStor plotmine 1" with lore "&7Du ejer ikke en stor plotmine" to be unstealable
            format slot 28 of player with red clay named "&c&lLille plotmine 2" with lore "&7Du ejer ikke lille plotmine nr. 2" to be unstealable
            format slot 31 of player with red clay named "&c&lMellem plotmine 2" with lore "&7Du ejer ikke mellem plotmine nr. 2" to be unstealable
            format slot 34 of player with red clay named "&c&lStor plotmine 2" with lore "&7Du ejer ikke stor plotmine nr. 2" to be unstealable
            format slot 37 of player with red clay named "&c&lLille plotmine 3" with lore "&7Du ejer ikke lille plotmine nr. 3" to be unstealable
            format slot 40 of player with red clay named "&c&lMellem plotmine 3" with lore "&7Du ejer ikke mellem plotmine nr. 3" to be unstealable
            format slot 43 of player with red clay named "&c&lStor plotmine 3" with lore "&7Du ejer ikke stor plotmine nr. 3" to be unstealable
            format slot 49 of player with nether star named "&9&lDine plotmines" with lore {_netherstar::*} to close then run [execute player command "/plotmine"]
            format slot 45 of player with blue stained glass pane named "-" to be unstealable
            format slot 46 of player with purple stained glass pane named "-" to be unstealable
            format slot 47 of player with blue stained glass pane named "-" to be unstealable
            format slot 48 of player with purple stained glass pane named "-" to be unstealable
            format slot 50 of player with purple stained glass pane named "-" to be unstealable
            format slot 51 of player with blue stained glass pane named "-" to be unstealable
            format slot 52 of player with purple stained glass pane named "-" to be unstealable
            format slot 53 of player with blue stained glass pane named "-" to be unstealable
        if {plotmines.small.all.%player%} is greater than 0:
            format slot 19 of player with lime clay named "&2&lLille plotmine 1" with lore "&7Klik for at sætte/fjerne dine plotmines" to be unstealable
        if {plotmines.small.all.%player%} is greater than 1:
            format slot 28 of player with lime clay named "&2&lLille plotmine 2" with lore "&7Klik for at sætte/fjerne dine plotmines" to be unstealable
        if {plotmines.small.all.%player%} is greater than 2:
            format slot 37 of player with lime clay named "&2&lLille plotmine 3" with lore "&7Klik for at sætte/fjerne dine plotmines" to be unstealable
        if {plotmines.medium.all.%player%} is greater than 0:
            format slot 22 of player with lime clay named "&2&lMellem plotmine 1" with lore "&7Klik for at sætte/fjerne dine plotmines" to be unstealable
        if {plotmines.medium.all.%player%} is greater than 1:
            format slot 31 of player with lime clay named "&2&lMellem plotmine 2" with lore "&7Klik for at sætte/fjerne dine plotmines" to be unstealable
        if {plotmines.medium.all.%player%} is greater than 2:
            format slot 40 of player with lime clay named "&2&lMellem plotmine 3" with lore "&7Klik for at sætte/fjerne dine plotmines" to be unstealable
        if {plotmines.big.all.%player%} is greater than 0:
            format slot 25 of player with lime clay named "&2&lStor plotmine 1" with lore "&7Klik for at sætte/fjerne dine plotmines" to be unstealable
        if {plotmines.big.all.%player%} is greater than 1:
            format slot 34 of player with lime clay named "&2&lStor plotmine 2" with lore "&7Klik for at sætte/fjerne dine plotmines" to be unstealable
        if {plotmines.big.all.%player%} is greater than 2:
            format slot 43 of player with lime clay named "&2&lStor plotmine 3" with lore "&7Klik for at sætte/fjerne dine plotmines" to be unstealable
        else if {plotmines.small.%player%}, {plotmines.medium.%player%} and {plotmines.big.%player%} is 0:
            message "&c&lFEJL &8» &7Du ejer ingen plotmines, køb dem i /buy"
            
command /plotmineblocks:
    description: Change what blocks are in your plotmine
    executable by: players
    permission: plotmine.blocks
    trigger:
        set {_netherstar::*} to "&bSmå &8»&7 %{plotmines.small.%player%}%&8/%{plotmines.small.all.%player%}%", "&bMellem &8»&7 %{plotmines.medium.%player%}%&8/%{plotmines.medium.all.%player%}%", "&bStore &8»&7 %{plotmines.big.%player%}%&8/%{plotmines.big.all.%player%}%", "" and "&cKlik for at gå tilbage"
        if {plotmines.small.all.%player%}, {plotmines.medium.all.%player%} or {plotmines.big.all.%player%} is greater than 0:
            wait 2 ticks   
            open chest with 6 rows named "&9&lPlotmine - Opsæt" to player
            wait 1 tick
            format slot 0 of player with blue stained glass pane named "-" to be unstealable
            format slot 1 of player with purple stained glass pane named "-" to be unstealable
            format slot 2 of player with blue stained glass pane named "-" to be unstealable
            format slot 3 of player with purple stained glass pane named "-" to be unstealable
            format slot 4 of player with blue stained glass pane named "-" to be unstealable
            format slot 5 of player with purple stained glass pane named "-" to be unstealable
            format slot 6 of player with blue stained glass pane named "-" to be unstealable
            format slot 7 of player with purple stained glass pane named "-" to be unstealable
            format slot 8 of player with blue stained glass pane named "-" to be unstealable
            format slot 49 of player with nether star named "&9&lDine plotmines" with lore {_netherstar::*} to close then run [execute player command "/plotmine"]
            format slot 45 of player with blue stained glass pane named "-" to be unstealable
            format slot 46 of player with purple stained glass pane named "-" to be unstealable
            format slot 47 of player with blue stained glass pane named "-" to be unstealable
            format slot 48 of player with purple stained glass pane named "-" to be unstealable
            format slot 50 of player with purple stained glass pane named "-" to be unstealable
            format slot 51 of player with blue stained glass pane named "-" to be unstealable
            format slot 52 of player with purple stained glass pane named "-" to be unstealable
            format slot 53 of player with blue stained glass pane named "-" to be unstealable
 
Add arguments in the command, for example.
code_language.skript:
command /plotmine [<string>]:
    trigger:
        if arg 1 is not set:
            #The inventory you want.
            stop
       else if arg 1 is "1":
            #The second inventory.
#...
At least I would do it this way.
 
But would it be posible to do like.
Code:
if (item in last gui) is pressed:
     format slot
 
First, you should really use TuSKe instead of skript gui management but oh well.

Second:

Code:
format slot 8 of player with {item} named "%{_itemname}%" to run [format slot 8 of player with {item2} named "%{_itemname2}%"]

However, I would do it this way to make the code more straightforward and not stretch on one big line, and you can add more stuff to the command when you click the item:

Code:
format slot 8 of player with {item} named "%{itemname}%" to run [make player execute command "/phase2"]

command /phase2:
    trigger:
        format slot 8 of player with {item2} named "%{itemname2}% to be unstealable
 
Ok, thanks. I am just worried cause i have 9 different mines that you can click on so that means that i will have to make 9 new commands.
 
Code:
format slot 8 of player with {item} named "%{itemname}%" to run [make player execute command "/phase2 8"]
 
command /phase2 [<string>]:
    trigger:
        if arg 1 isn't set:
            stop:
        if arg 1 is set:
            if arg 1 is "0":
                format slot 0 of player with {item0} named "%{itemname0}% to be unstealable
           if arg 1 is "1":
                format slot 1 of player with {item1} named "%{itemname1}% to be unstealable
            if arg 1 is "2":
                format slot 2 of player with {item2} named "%{itemname2}% to be unstealable
            if arg 1 is "3":
                format slot 3 of player with {item3} named "%{itemname3}% to be unstealable
            if arg 1 is "4":
                format slot 4 of player with {item4} named "%{itemname4}% to be unstealable
            if arg 1 is "5":
                format slot 5 of player with {item5} named "%{itemname5}% to be unstealable
            if arg 1 is "6":
                format slot 6 of player with {item6} named "%{itemname6}% to be unstealable
            if arg 1 is "7":
                format slot 7 of player with {item7} named "%{itemname7}% to be unstealable
            if arg 1 is "8":
                format slot 8 of player with {item8} named "%{itemname8}% to be unstealable
 
Code:
format slot 8 of player with {item} named "%{itemname}%" to run [make player execute command "/phase2 8"]
 
command /phase2 [<string>]:
    trigger:
        if arg 1 isn't set:
            stop:
        if arg 1 is set:
            if arg 1 is "0":
                format slot 0 of player with {item0} named "%{itemname0}% to be unstealable
           if arg 1 is "1":
                format slot 1 of player with {item1} named "%{itemname1}% to be unstealable
            if arg 1 is "2":
                format slot 2 of player with {item2} named "%{itemname2}% to be unstealable
            if arg 1 is "3":
                format slot 3 of player with {item3} named "%{itemname3}% to be unstealable
            if arg 1 is "4":
                format slot 4 of player with {item4} named "%{itemname4}% to be unstealable
            if arg 1 is "5":
                format slot 5 of player with {item5} named "%{itemname5}% to be unstealable
            if arg 1 is "6":
                format slot 6 of player with {item6} named "%{itemname6}% to be unstealable
            if arg 1 is "7":
                format slot 7 of player with {item7} named "%{itemname7}% to be unstealable
            if arg 1 is "8":
                format slot 8 of player with {item8} named "%{itemname8}% to be unstealable
That's SkQuery GUI, the TuSKe way is:
code_language.skript:
format a gui slot %number% of player with %item% named "%{itemname}%" to do nothing
 
Yea thanks i have TuSKe, but how does this string work. Like is there a way to do if i press one thing in the first gui it effects whats in the next one, i have tried making it to maybe make it easier to understand:
Code:
command /plotmineedit:
    executable by: players
    permission: plotmine.edit
    trigger:
        if {plotmines.small.all.%player%}, {plotmines.medium.all.%player%} or {plotmines.big.all.%player%} is greater than 0:
            wait 2 ticks   
            open chest with 6 rows named "&9&lTest" to player
            wait 1 tick
            format slot 1 of player with book named "&c&lClick to go to next menu" to close then set string to 1
            format slot 2 of player with book named "&c&lClick to go to next menu" to close then set string to 2

command /plotmineedit2 [<string>]
    executable by: players
    permission: plotmine.edit
    trigger:
        open chest with 3 rows named "test"
        wait 2 ticks
        if arg 1 is 1:
            format slot 1 of player with book named "test"
        if arg 2 is 1:
            format slot 2 of player with book named "test"
 
Status
Not open for further replies.