Keep GUI open after change/Refresh 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.
Apr 9, 2017
28
1
0
35
Hi so I have a function to open a chest GUI and do some other stuff and in one part I have another function to set a variable to true or false and it will change the GUI items when you re-open it but I want it to stay open or after I click the item it runs the other function and re-opens the GUI so it seems like it is open
If you need some clarifition it might be easier if just chat back and forth using Discord if you have it and want to use it so here is my Discord: termanator1128#5236
Here are the functions I have if you need them
code_language.skript:
function prefsSystem(p: player , t: number) :: number:
    if {_t} is 1:
        if {mineplex.pref.hg.%{_p}} is true:
            set {mineplex.hg.%{_p}} to false
        else:
            set {mineplex.hg.%{_p}} to true
    if {_t} is 2:
        if {mineplex.pref.hpv.%{_p}%} is true:
            set {mineplex.pref.hpv.%{_p}%} to false
            hide all players from {_p}
        else:
            set {mineplex.pref.hpv.%{_p}%} to true
            reveal all players from {_p}
            loop all players:
                if {mineplex.vanish.%loop-player%} is true:
                    add loop-player to {%{_p}%.vanishlist::*}
            loop all players:
                if loop-player does not have permission "mineplex.admin":
                    hide {%{_p}%.vanishlist::*} from all players
                    delete {%{_p}%.vanishlist::*}
    else if {_t} is 3:
        if {mineplex.pref.pc.%{_p}%} is true:
            set {mineplex.pref.pc.%{_p}%} to false
        else:
            set {mineplex.pref.pc.%{_p}%} to true
    else if {_t} is 4:
        if {mineplex.pref.pm.%{_p}%} is true:
            set {mineplex.pref.pm.%{_p}%} to false
        else:
            set {mineplex.pref.pm.%{_p}%} to true
    else if {_t} is 5:
        if {mineplex.pref.gwen.%{_p}%} is true:
            set {mineplex.pref.gwen.%{_p}%} to false
        else:
            set {mineplex.pref.gwen.%{_p}%} to true
    else if {_t} is 6:
        if {mineplex.pref.report.%{_p}%} is true:
            set {mineplex.pref.report.%{_p}%} to false
        else:
            set {mineplex.pref.report.%{_p}%} to true
    else if {_t} is 7:
        if {mineplex.pref.ff.%{_p}%} is true:
            set {mineplex.pref.ff.%{_p}%} to false
        else:
            set {mineplex.pref.ff.%{_p}%} to true
    else if {_t} is 8:
        if {mineplex.ff.%{_p}%} is true:
            set {mineplex.ff.%{_p}%} to false
            delete {mineplex.ff.list::%{_p}%}
        else:
            set {mineplex.ff.%{_p}%} to true
            set {mineplex.ff.list::%{_p}%} to true

function profile_system(arg1: text , arg2: text , p: player, p2: player) :: number:
    set {_wither} to "MHF_WSkeleton" parsed as a player
    if {_arg1} is "menu":
        if {_arg2} is "profile":
            wait 2 ticks
            open chest with 3 rows named "My Profile" to {_p}
            wait 4 ticks
            format slot 11 of {_p} with {_p}'s skull named "&eStats and Achievements" with lore "&f||&fView your Statistics and Achievements||&ffor all of the games on Mineplex!||&f||&fType &a/stats &fto access this anywhere!" to close then run [profile_system("menu", "stats", {_p}, {_p2})]
            format slot 13 of {_p} with redstone comparator item named "&ePreferences" with lore "&f||&fSet your preferences to your liking||&fso you can enjoy the game more!||&f||&fType &a/prefs &fto access this anywhere!" to close then run [profile_system("menu", "prefs", {_p}, {_p2})]
            format slot 15 of {_p} with glistering melon named "&eMineplex Player Server" with lore "&f||&fCreate a server where you are the Host.||&fYou can Choose the game, map and much more!||&f||&fType &a/mps &fto access this anywhere!" to be unstealable
        if {_arg2} is "prefs":
            wait 2 ticks
            open chest with 5 rows named "My Preferences" to {_p}
            wait 4 ticks
            format slot 0 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 1 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 2 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 3 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 4 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 5 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 6 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 7 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 8 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 9 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 17 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 18 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 26 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 27 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 35 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 36 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 37 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 38 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 39 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 40 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 41 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 42 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 43 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 44 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 19 of {_p} with paper named "&eUser Preferences" to run [profile_system("menu", "user", {_p}, {_p2})]
            format slot 21 of {_p} with redstone comparator item named "&eGame Mechanic Preferences" to close then run [profile_system("menu", "game", {_p}, {_p2})]
            format slot 23 of {_p} with compass named "&eMiscellaneous Preferences" to close then run [profile_system("menu", "miscellaneous", {_p}, {_p2})]
            format slot 25 of {_p} with red flower named "&eSocial Preferences" to close then run [profile_system("menu", "social", {_p}, {_p2})]
        if {_arg2} is "user":
            wait 2 tick
            open chest with 6 rows named "User Preferences" to {_p}
            wait 4 tick
            format slot 0 of {_p} with bed named "← Go Back" to close then run [profile_system("menu", "prefs", {_p}, {_p2})]
            format slot 1 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 2 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 3 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 4 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 5 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 6 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 7 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 8 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 9 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 17 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 18 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 26 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 27 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 35 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 36 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 44 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 45 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 46 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 47 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 48 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 49 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 50 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 51 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 52 of {_p} with light blue stained glass pane named "&f" to be unstealable
            format slot 53 of {_p} with light blue stained glass pane named "&f" to be unstealable
            if {mineplex.pref.hg.%{_p}%} is true:
                format slot 10 of {_p} with fire charge named "&aHub Games" with lore "&aEnabled||&f||&fClick to Disable||&f" to run
                format slot 19 of {_p} with light green dye named "&ahub Games" with lore "&aEnabled||&f||&fClick to Disable||&f" to run
            else:
                format slot 10 of {_p} with fire charge named "&cHub Games" with lore "&cDisabled||&f||&fClick to Enable||&f"
            if
        if {_arg2} is "stats":
            wait 2 tick
            open chest with 5 rows named "%{_p}%'s Stats" to {_p2}
            wait 4 tick
            set {_tm} to {mineplex.time.%{_p}%}
            if {_tm} is less than 60:
                set {_global.time} to "%{_final}%.0 Seconds"
            else if {_tm} is less than 3600:
                set {_final} to {_tm} / 60
                set {_global.time} to "%{_final}% Minutes"
            else if {_tm} is less than 86400:
                set {_final} to {_tm} / 3600
                set {_global.time} to "%{_final}% Hours"
            else if {_tm} is less than 604800:
                set {_final} to {_tm} / 86400
                set {_global.time} to "%{_final}% Days"
            else:
                set {_final} to {_tm} / 604800
                set {_global.time} to "%{_final}% Weeks"
            set {_global.gems} to getPlayerdata({_p}, "stats.global.gems")
            set {_global.games} to getPlayerdata({_p}, "stats.global.games")
            set {_global.dailyr} to getPlayerdata({_p}, "stats.global.dailyr")
            set {_global.voted} to getPlayerdata({_p}, "stats.global.voted")
            set {_global.chests} to getPlayerdata({_p}, "stats.global.chests")
            format slot 2 of {_p} with emerald named "&a&lGlobal" with lore "||&eGems Earned: &f%{_global.gems}%|| ||&eGames Played: &f%{_global.games}%||&eTime In Game: &f%{_global.time}%|| ||&eDaily Rewards: &f%{_global.dailyr}%||&eTimes Voted: &f%{_global.voted}%|| ||&eChests Opened: &f%{_global.chests}%" to be unstealable
 
I strongly recommend not using skQuery for GUIs. Here are a few reasons to why :
  • Need to wait a tick
  • Players can take items is the TPS is low
  • Lambdas
  • Doesn't work correctly with loops (there is a fix, but it is even worse than the problem)
  • And more weird and buggy shit
(REMIND : make this a macro)

Instead, I suggest using either TuSKe (which will be more familiar if you are using skQuery, and that's very well made to do what you want (use functions & stuff) or set slot + on inventory click, which is a tiny bit more flexible but somewhat messy to me.

(@LimeGlass REMIND : make a tutorial so I can link it)
 
I strongly recommend not using skQuery for GUIs. Here are a few reasons to why :
  • Need to wait a tick
  • Players can take items is the TPS is low
  • Lambdas
  • Doesn't work correctly with loops (there is a fix, but it is even worse than the problem)
  • And more weird and buggy shit
(REMIND : make this a macro)

Instead, I suggest using either TuSKe (which will be more familiar if you are using skQuery, and that's very well made to do what you want (use functions & stuff) or set slot + on inventory click, which is a tiny bit more flexible but somewhat messy to me.

(@LimeGlass REMIND : make a tutorial so I can link it)
Isn't this the tutorial you want? https://forums.skunity.com/threads/gui-manager-tutorial.2349/
 
I strongly recommend not using skQuery for GUIs. Here are a few reasons to why :
  • Need to wait a tick
  • Players can take items is the TPS is low
  • Lambdas
  • Doesn't work correctly with loops (there is a fix, but it is even worse than the problem)
  • And more weird and buggy shit
(REMIND : make this a macro)

Instead, I suggest using either TuSKe (which will be more familiar if you are using skQuery, and that's very well made to do what you want (use functions & stuff) or set slot + on inventory click, which is a tiny bit more flexible but somewhat messy to me.

(@LimeGlass REMIND : make a tutorial so I can link it)
I made a set slot tutorial on the old forum and it took like 3 hours to make. Now I need to remake it ffs all my time wasted. Maybe some day.
 
@Syst3ms Thanks for the suggestion but everything I have is with skQuery and don't feel like wasting my time learning something new and changing everything over when it works just fine. Just want my question answered.
 
I suggest you check out the features of the GUI Manager, it'll really help you, I think, and it is everything but a waste of time to learn. Eventually you'll run inside a bug or a limitation and then you'll have to switch, so, why not do it now ?
 
Status
Not open for further replies.