Refresh GUI while player is in 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.

0ldCast

Member
Jan 6, 2018
1
0
0
35
Hello,

i want to refresh my GUI while player is in the GUI.

set slot 15 of player's current inventory to 1 bottle o' enchanting named "&aAktive Sellbuffs" with lore "&8||&eGlobaler Sellbuff||&8➥ &a+%{Sellbuff}% &8(&apermanent&8) ||||&ePrestige Sellbuff||&8➥ &a+X &8(&apermanent&8)"

There is a variable which is sometimes changing so i must refresh the gui, if the player is in the gui and the variable is changing. Please help
 
There may be a better way, and I'm just getting back into skript mind you, but I did this with a function once before. you set your gui up to run in a function, then make your gui command call the function. then within the gui whenever you need it refreshed, call the function. Here this is a short form of what I've been messing with:
Code:
function listFilter(p: player, page: number):  
    create gui with virtual chest with 6 rows named "test":
        make gui slot 1 with diamond named "refresh":
            listFilter({_p}, 0)
    open last gui to {_p}  

command /itemfilter:
    aliases: /if
    trigger:
        listFilter(player, 0)

would be more to the code of course but you can resend the function from within the gui through clicking the item

edit: also mind that if you do a function you can not use expressions like "player" because the function cant recognize it. that's why you see it as {_p}. The information for who {_p} is was sent when you ran the command and it called the function - "p: player"
There's a tutorial for them in general here
 
Status
Not open for further replies.