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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    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.

Endless Gui's

Discussion in 'Skript' started by SoMuchWessel, Oct 15, 2020.

Thread Status:
Not open for further replies.
  1. SoMuchWessel

    SoMuchWessel Active Member

    Joined:
    Apr 3, 2017
    Messages:
    147
    Likes Received:
    2
    Hey there,

    I came to the idea to make a GUI that covers a list variable.

    In a list variable, I put blocks/elements. If this list gets bigger than the GUI interface, I want it to cut it off and puts the rest in another GUI (like a page 2) until this one is full ect.

    But I can't come to a way to do this efficiently.

    Do you knows know things that can help me with this?
     
  2. Wynnevir

    Wynnevir Well-Known Member

    Joined:
    Jul 9, 2017
    Messages:
    1,016
    Likes Received:
    62
    Yes, it's called recursive. I have a gui script that does this exactly, though it's hard to cut out the extra bits from my phone this is the function for it. I have the full script in my resources if I've left anything out of this you think you need. It's very clunky because I did it early on while learning but it gets the job done xD
    Code (Text):
    1. function listNote(pl: offline player,p: player, page: number):
    2.     set {_liststart} to 45*{_page}
    3.     set {_i} to 1
    4.     set {_a} to 0
    5.     wait 3 ticks
    6.     create gui with virtual chest with size 6 named "{@i-t}":
    7.         loop {notelist::%{_pl}%::*}:
    8.             set {_id} to loop-index
    9.             set {_v} to loop-value
    10.             set {_vlist::*} to {_v} split at "["
    11.             (loop-index parsed as integer) > {_liststart}
    12.             if {notify::%{_pl}%::%{_id}%} is true:
    13.                 make gui slot {_a} with shiny paper named "{@n-f}" with lore "{@t-c}[%{_vlist::3}%||{@t-c}[%{_vlist::2}%||{@l-c}Sift+L-click to toggle Note Notify||{@l-c}Shift+R-click to delete":
    14.                     if gui-click-action is left mouse button with shift:
    15.                         noteNotify({_pl}, {_p}, {_id})
    16.                         listNote({_pl}, {_p}, 0)
    17.                     if gui-click-action is right mouse button with shift:
    18.                         delNote({_pl}, {_p}, {_id})
    19.                         listNote({_pl}, {_p}, 0)
    20.             else:
    21.                 make gui slot {_a} with paper named "{@n-f}" with lore "{@t-c}[%{_vlist::3}%||{@t-c}[%{_vlist::2}%||{@l-c}Sift+L-click to toggle Note Notify||{@l-c}Shift+R-click to delete":
    22.                     if gui-click-action is left mouse button with shift:
    23.                         noteNotify({_pl}, {_p}, {_id})
    24.                         listNote({_pl}, {_p}, 0)
    25.                     if gui-click-action is right mouse button with shift:
    26.                         delNote({_pl}, {_p}, {_id})
    27.                         listNote({_pl}, {_p}, 0)
    28.             if "%loop-value%" contains "Jailed" or "Jail":
    29.                 if {notify::%{_pl}%::%{_id}%} is true:
    30.                     make gui slot {_a} with shiny bars named "{@n-f}" with lore "{@t-c}[%{_vlist::3}%||{@t-c}[%{_vlist::2}%||{@l-c}Sift+L-click to toggle Note Notify||{@l-c}Shift+R-click to delete":
    31.                         if gui-click-action is left mouse button with shift:
    32.                             noteNotify({_pl}, {_p}, {_id})
    33.                             listNote({_pl}, {_p}, 0)
    34.                         if gui-click-action is right mouse button with shift:
    35.                             delNote({_pl}, {_p}, {_id})
    36.                             listNote({_pl}, {_p}, 0)
    37.                 else:
    38.                     make gui slot {_a} with bars named "{@n-f}" with lore "{@t-c}[%{_vlist::3}%||{@t-c}[%{_vlist::2}%||{@l-c}Sift+L-click to toggle Note Notify||{@l-c}Shift+R-click to delete":
    39.                         if gui-click-action is left mouse button with shift:
    40.                             noteNotify({_pl}, {_p}, {_id})
    41.                             listNote({_pl}, {_p}, 0)
    42.                         if gui-click-action is right mouse button with shift:
    43.                             delNote({_pl}, {_p}, {_id})  
    44.                             listNote({_pl}, {_p}, 0)
    45.             if "%loop-value%" contains "Muted" or "Mute":
    46.                 if {notify::%{_pl}%::%{_id}%} is true:
    47.                     make gui slot {_a} with shiny record named "{@n-f}" with lore "{@t-c}[%{_vlist::3}%||{@t-c}[%{_vlist::2}%||{@l-c}Sift+L-click to toggle Note Notify||{@l-c}Shift+R-click to delete":
    48.                         if gui-click-action is left mouse button with shift:
    49.                             noteNotify({_pl}, {_p}, {_id})
    50.                             listNote({_pl}, {_p}, 0)
    51.                         if gui-click-action is right mouse button with shift:
    52.                             delNote({_pl}, {_p}, {_id})
    53.                             listNote({_pl}, {_p}, 0)
    54.                 else:
    55.                     make gui slot {_a} with record named "{@n-f}" with lore "{@t-c}[%{_vlist::3}%||{@t-c}[%{_vlist::2}%||{@l-c}Sift+L-click to toggle Note Notify||{@l-c}Shift+R-click to delete":
    56.                         if gui-click-action is left mouse button with shift:
    57.                             noteNotify({_pl}, {_p}, {_id})
    58.                             listNote({_pl}, {_p}, 0)
    59.                         if gui-click-action is right mouse button with shift:
    60.                             delNote({_pl}, {_p}, {_id})
    61.                             listNote({_pl}, {_p}, 0)
    62.             if "%loop-value%" contains "Banned", "Ban", "Temp-Banned", "Tempbanned" or "Temp banned":
    63.                 if {notify::%{_pl}%::%{_id}%} is true:
    64.                     make gui slot {_a} with shiny barrier named "{@n-f}" with lore "{@t-c}[%{_vlist::3}%||{@t-c}[%{_vlist::2}%||{@l-c}Sift+L-click to toggle Note Notify||{@l-c}Shift+R-click to delete":
    65.                         if gui-click-action is left mouse button with shift:
    66.                             noteNotify({_pl}, {_p}, {_id})
    67.                             listNote({_pl}, {_p}, 0)
    68.                         if gui-click-action is right mouse button with shift:
    69.                             delNote({_pl}, {_p}, {_id})
    70.                             listNote({_pl}, {_p}, 0)
    71.                 else:
    72.                     make gui slot {_a} with barrier named "{@n-f}" with lore "{@t-c}[%{_vlist::3}%||{@t-c}[%{_vlist::2}%||{@l-c}Sift+L-click to toggle Note Notify||{@l-c}Shift+R-click to delete":
    73.                         if gui-click-action is left mouse button with shift:
    74.                             noteNotify({_pl}, {_p}, {_id})
    75.                             listNote({_pl}, {_p}, 0)
    76.                         if gui-click-action is right mouse button with shift:
    77.                             delNote({_pl}, {_p}, {_id})
    78.                             listNote({_pl}, {_p}, 0)
    79.             if "%loop-value%" contains "TicketOpen:":
    80.                 if {notify::%{_pl}%::%{_id}%} is true:
    81.                     make gui slot {_a} with shiny light green banner item named "{@t-c}[%{_vlist::3}%||{@t-c}[%{_vlist::2}%||{@l-c}Sift+L-click to toggle Note Notify||{@l-c}Shift+R-click to delete":
    82.                         if gui-click-action is left mouse button with shift:
    83.                             noteNotify({_pl}, {_p}, {_id})
    84.                             listNote({_pl}, {_p}, 0)
    85.                         if gui-click-action is right mouse button with shift:
    86.                             delNote({_pl}, {_p}, {_id})
    87.                             listNote({_pl}, {_p}, 0)                          
    88.                 else:
    89.                     make gui slot {_a} with light green banner item named "{@n-f}" with lore "{@t-c}[%{_vlist::3}%||{@t-c}[%{_vlist::2}%||{@l-c}Sift+L-click to toggle Note Notify||{@l-c}Shift+R-click to delete":
    90.                         if gui-click-action is left mouse button with shift:
    91.                             noteNotify({_pl}, {_p}, {_id})
    92.                             listNote({_pl}, {_p}, 0)
    93.                         if gui-click-action is right mouse button with shift:
    94.                             delNote({_pl}, {_p}, {_id})
    95.                             listNote({_pl}, {_p}, 0)
    96.             if "%loop-value%" contains "TicketClosed":
    97.                 make gui slot {_a} with red banner item named "{@n-f}" with lore "{@t-c}[%{_vlist::3}%||{@t-c}[%{_vlist::2}%||{@l-c}Shift+R-click to delete":
    98.                     if gui-click-action is right mouse button with shift:
    99.                         delNote({_pl}, {_p}, {_id})
    100.                         listNote({_pl}, {_p}, 0)
    101.             add 1 to {_a}
    102.             if {_a} = ((45*{_i})):
    103.                 exit loop          
    104.         make gui slot 48 with eye of ender named "{@g-c}Refresh":
    105.             listNote({_pl}, {_p}, 0)
    106.         make gui slot 50 with fire charge named "{@g-c}Delete All Notes":
    107.             delAll({_pl}, {_p})
    108.         if size of {notelist::%{_pl}%::*} > {_liststart} + 45:
    109.             make gui slot 53 with emerald named "{@g-c}Next Page":
    110.                 listNote({_pl}, {_p}, ({_page} + 1))
    111.         if {_page} > 0:
    112.             make gui slot 45 with emerald named "{@g-c}Previous Page":
    113.                 listNote({_pl}, {_p}, ({_page} - 1))
    114.     open last gui to {_p}
    115.        
     
  3. SoMuchWessel

    SoMuchWessel Active Member

    Joined:
    Apr 3, 2017
    Messages:
    147
    Likes Received:
    2
    I dont really understand a lot of this because there is 'your code' in it haha
    I am kinda looking for just the ground basics, so i can add my own things in it
     
  4. Wynnevir

    Wynnevir Well-Known Member

    Joined:
    Jul 9, 2017
    Messages:
    1,016
    Likes Received:
    62
    Just found the post I used to do itXD
    https://forums.skunity.com/threads/create-a-gui-with-as-many-pages-it-needs.4201/
    But there's a few diff ways you could
    --- Double Post Merged, Oct 15, 2020, Original Post Date: Oct 15, 2020 ---
    For sure, I wish sublime editor was easier to use on mobile xD
     
  5. SoMuchWessel

    SoMuchWessel Active Member

    Joined:
    Apr 3, 2017
    Messages:
    147
    Likes Received:
    2
    This seems like it could work, but he didnt include the final piece: The click mechanics haha
     
  6. Wynnevir

    Wynnevir Well-Known Member

    Joined:
    Jul 9, 2017
    Messages:
    1,016
    Likes Received:
    62
    For clicking I would look into Tuske's advanced guis. It makes them very easy and you don't have to use the inventory click event
     
Thread Status:
Not open for further replies.

Share This Page

Loading...