Jump to content
3asel

Infinite GUI pages

Recommended Posts

This script wasn't intended to be something that could be helpful to others, but seems like it will help a lot of you new learners.

The following example is how it works:

                            # {_page} is the page number
set {_end} to {_page} * 27  # {_end} is set to last slot in a 27 slot GUI
set {_start} to {_end} - 27 # {_start} is set to the first slot

loop {exampleList::*}:
    add 1 to {_pos}
    if {_pos} is between {_start} and {_end}:
        make next gui slot with loop-value

What are the variables?

{_page} is defined as the page number

{_start} is defined as the first slot in the GUI (slot 0)

{_end} is defined as the last slot in the GUI (slot 26)

image.png.1ae7efbb98e5587702fa3077bbee7822.png

The script in action:

command /gui [<integer>]:
    trigger:
  
        set {exampleList::*} to stone, grass block, granite, sand, paper, bone and chest
  
        set {_page} to 1
        set {_end} to {_page} * 27
        set {_start} to {_end} - 27
  
        if arg-1 is set:
            if arg-1 > 0:
                set {_page} to arg-1

        create a gui with virtual chest with 4 rows named "Example":
  
            loop {exampleList::*}:
                add 1 to {_pos}
                if {_pos} is between {_start} and {_end}:
                    make next gui slot with loop-value
  
            make gui slot 27 with paper named "<< Back":
                set {_back} to {_page} - 1
                if {_page} > 0:
                    make player execute "/gui %{_back}%"
  
            make gui slot 35 with paper named "Next >>":
                set {_next} to {_page} + 1
                make player execute "/gui %{_next}%"
  
        open last gui to player
  

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now



×
×
  • Create New...