Endless Gui's

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

SoMuchWessel

Active Member
Apr 3, 2017
147
3
18
46
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?
 
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:
function listNote(pl: offline player,p: player, page: number):
    set {_liststart} to 45*{_page}
    set {_i} to 1
    set {_a} to 0
    wait 3 ticks
    create gui with virtual chest with size 6 named "{@i-t}":
        loop {notelist::%{_pl}%::*}:
            set {_id} to loop-index
            set {_v} to loop-value
            set {_vlist::*} to {_v} split at "["
            (loop-index parsed as integer) > {_liststart}
            if {notify::%{_pl}%::%{_id}%} is true:
                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":
                    if gui-click-action is left mouse button with shift:
                        noteNotify({_pl}, {_p}, {_id})
                        listNote({_pl}, {_p}, 0)
                    if gui-click-action is right mouse button with shift:
                        delNote({_pl}, {_p}, {_id})
                        listNote({_pl}, {_p}, 0)
            else:
                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":
                    if gui-click-action is left mouse button with shift:
                        noteNotify({_pl}, {_p}, {_id})
                        listNote({_pl}, {_p}, 0)
                    if gui-click-action is right mouse button with shift:
                        delNote({_pl}, {_p}, {_id})
                        listNote({_pl}, {_p}, 0)
            if "%loop-value%" contains "Jailed" or "Jail":
                if {notify::%{_pl}%::%{_id}%} is true:
                    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":
                        if gui-click-action is left mouse button with shift:
                            noteNotify({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                        if gui-click-action is right mouse button with shift:
                            delNote({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                else:
                    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":
                        if gui-click-action is left mouse button with shift:
                            noteNotify({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                        if gui-click-action is right mouse button with shift:
                            delNote({_pl}, {_p}, {_id})   
                            listNote({_pl}, {_p}, 0)
            if "%loop-value%" contains "Muted" or "Mute":
                if {notify::%{_pl}%::%{_id}%} is true:
                    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":
                        if gui-click-action is left mouse button with shift:
                            noteNotify({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                        if gui-click-action is right mouse button with shift:
                            delNote({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                else:
                    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":
                        if gui-click-action is left mouse button with shift:
                            noteNotify({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                        if gui-click-action is right mouse button with shift:
                            delNote({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
            if "%loop-value%" contains "Banned", "Ban", "Temp-Banned", "Tempbanned" or "Temp banned":
                if {notify::%{_pl}%::%{_id}%} is true:
                    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":
                        if gui-click-action is left mouse button with shift:
                            noteNotify({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                        if gui-click-action is right mouse button with shift:
                            delNote({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                else:
                    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":
                        if gui-click-action is left mouse button with shift:
                            noteNotify({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                        if gui-click-action is right mouse button with shift:
                            delNote({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
            if "%loop-value%" contains "TicketOpen:":
                if {notify::%{_pl}%::%{_id}%} is true:
                    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":
                        if gui-click-action is left mouse button with shift:
                            noteNotify({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                        if gui-click-action is right mouse button with shift:
                            delNote({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)                           
                else:
                    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":
                        if gui-click-action is left mouse button with shift:
                            noteNotify({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                        if gui-click-action is right mouse button with shift:
                            delNote({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
            if "%loop-value%" contains "TicketClosed":
                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":
                    if gui-click-action is right mouse button with shift:
                        delNote({_pl}, {_p}, {_id})
                        listNote({_pl}, {_p}, 0)
            add 1 to {_a}
            if {_a} = ((45*{_i})):
                exit loop           
        make gui slot 48 with eye of ender named "{@g-c}Refresh":
            listNote({_pl}, {_p}, 0)
        make gui slot 50 with fire charge named "{@g-c}Delete All Notes":
            delAll({_pl}, {_p})
        if size of {notelist::%{_pl}%::*} > {_liststart} + 45:
            make gui slot 53 with emerald named "{@g-c}Next Page":
                listNote({_pl}, {_p}, ({_page} + 1))
        if {_page} > 0:
            make gui slot 45 with emerald named "{@g-c}Previous Page":
                listNote({_pl}, {_p}, ({_page} - 1))
    open last gui to {_p}
 
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:
function listNote(pl: offline player,p: player, page: number):
    set {_liststart} to 45*{_page}
    set {_i} to 1
    set {_a} to 0
    wait 3 ticks
    create gui with virtual chest with size 6 named "{@i-t}":
        loop {notelist::%{_pl}%::*}:
            set {_id} to loop-index
            set {_v} to loop-value
            set {_vlist::*} to {_v} split at "["
            (loop-index parsed as integer) > {_liststart}
            if {notify::%{_pl}%::%{_id}%} is true:
                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":
                    if gui-click-action is left mouse button with shift:
                        noteNotify({_pl}, {_p}, {_id})
                        listNote({_pl}, {_p}, 0)
                    if gui-click-action is right mouse button with shift:
                        delNote({_pl}, {_p}, {_id})
                        listNote({_pl}, {_p}, 0)
            else:
                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":
                    if gui-click-action is left mouse button with shift:
                        noteNotify({_pl}, {_p}, {_id})
                        listNote({_pl}, {_p}, 0)
                    if gui-click-action is right mouse button with shift:
                        delNote({_pl}, {_p}, {_id})
                        listNote({_pl}, {_p}, 0)
            if "%loop-value%" contains "Jailed" or "Jail":
                if {notify::%{_pl}%::%{_id}%} is true:
                    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":
                        if gui-click-action is left mouse button with shift:
                            noteNotify({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                        if gui-click-action is right mouse button with shift:
                            delNote({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                else:
                    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":
                        if gui-click-action is left mouse button with shift:
                            noteNotify({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                        if gui-click-action is right mouse button with shift:
                            delNote({_pl}, {_p}, {_id})  
                            listNote({_pl}, {_p}, 0)
            if "%loop-value%" contains "Muted" or "Mute":
                if {notify::%{_pl}%::%{_id}%} is true:
                    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":
                        if gui-click-action is left mouse button with shift:
                            noteNotify({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                        if gui-click-action is right mouse button with shift:
                            delNote({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                else:
                    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":
                        if gui-click-action is left mouse button with shift:
                            noteNotify({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                        if gui-click-action is right mouse button with shift:
                            delNote({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
            if "%loop-value%" contains "Banned", "Ban", "Temp-Banned", "Tempbanned" or "Temp banned":
                if {notify::%{_pl}%::%{_id}%} is true:
                    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":
                        if gui-click-action is left mouse button with shift:
                            noteNotify({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                        if gui-click-action is right mouse button with shift:
                            delNote({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                else:
                    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":
                        if gui-click-action is left mouse button with shift:
                            noteNotify({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                        if gui-click-action is right mouse button with shift:
                            delNote({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
            if "%loop-value%" contains "TicketOpen:":
                if {notify::%{_pl}%::%{_id}%} is true:
                    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":
                        if gui-click-action is left mouse button with shift:
                            noteNotify({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                        if gui-click-action is right mouse button with shift:
                            delNote({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)                          
                else:
                    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":
                        if gui-click-action is left mouse button with shift:
                            noteNotify({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
                        if gui-click-action is right mouse button with shift:
                            delNote({_pl}, {_p}, {_id})
                            listNote({_pl}, {_p}, 0)
            if "%loop-value%" contains "TicketClosed":
                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":
                    if gui-click-action is right mouse button with shift:
                        delNote({_pl}, {_p}, {_id})
                        listNote({_pl}, {_p}, 0)
            add 1 to {_a}
            if {_a} = ((45*{_i})):
                exit loop          
        make gui slot 48 with eye of ender named "{@g-c}Refresh":
            listNote({_pl}, {_p}, 0)
        make gui slot 50 with fire charge named "{@g-c}Delete All Notes":
            delAll({_pl}, {_p})
        if size of {notelist::%{_pl}%::*} > {_liststart} + 45:
            make gui slot 53 with emerald named "{@g-c}Next Page":
                listNote({_pl}, {_p}, ({_page} + 1))
        if {_page} > 0:
            make gui slot 45 with emerald named "{@g-c}Previous Page":
                listNote({_pl}, {_p}, ({_page} - 1))
    open last gui to {_p}

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
 
Status
Not open for further replies.