Solved Multi-page /hist command

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

Jun 3, 2023
25
1
3
15
Code:
command /history [<text>]:
    permission: history.use
    permission message: {@prefix} {@permission_message}
    trigger:
        if {uuid::%arg-1%} is set:
            send "{@prefix} &c--- &7[Logs for %{ign::%{uuid::%arg-1%}%}%] &c---"
            set {_index} to 0
            loop {punslogs::%{uuid::%arg-1%}%}:
                add 1 to {_index}
            send "&7Displaying &c%{_index}% &7punishments."
            set {_index} to 0
            loop {punslogs::%{uuid::%arg-1%}%}:
                add 1 to {_index}
                send "&c##%{_index}% &7%loop-value%"
        else:
            send "{@prefix} &7User mot joined."

^ That is my code, and I am having trouble making it multi-paged, can you help with that
 
How bout u find the punishments, add them to a list and display elements page*10 to page*10+9 of the list
 
So how’d you fix it (for someone that finds this post in 5 months)
I just did a division by page_size rounded up, to find the maximum amt of pages, then offset the start index to arg-2 (<number=1>) to arg-2*10, if arg-2 is not 1, if it is then i didnt do a multiplication, then I looped (pagesize) times, checking if the index is set, if it isnt the loop stops, so it sends

Entry *
Entry *


instead of
2 entry *s and 8 <none>s
For reference; Page size is 10