1. 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!


    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Refresh GUI while player is in GUI

Discussion in 'Skript' started by 0ldCast, Mar 22, 2020.

Thread Status:
Not open for further replies.
  1. 0ldCast

    0ldCast Member

    Jan 6, 2018
    Likes Received:

    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
  2. Wynnevir

    Wynnevir Well-Known Member

    Jul 9, 2017
    Likes Received:
    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 (Text):
    1. function listFilter(p: player, page: number):  
    2.     create gui with virtual chest with 6 rows named "test":
    3.         make gui slot 1 with diamond named "refresh":
    4.             listFilter({_p}, 0)
    5.     open last gui to {_p}  
    7. command /itemfilter:
    8.     aliases: /if
    9.     trigger:
    10.         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
Thread Status:
Not open for further replies.

Share This Page