To Annie's post above she actually told me not to do this when I did it like 4 years ago...
What the heck and she doesn't even credit me here for maybe giving her some kind of subliminal inspiration whatever... :< [Source] Hurry before she changes it. /gg
Anyways I just wanted to post a neat function I came up with for anybody who might want to use it.
DisplayPages Function:
Basically, it takes a bunch of options that you want to put into a menu and adds pages so the players can move through them easily.
///This function takes an array of strings and builds a menu players can navigate.
///Usage: DisplayPages(.@string_array${, .@page_size });
///Output: This function returns the selected item index from the given array.
function script DisplayPages {
.@page_size = getarg(1, 10);
.@len = getarraysize(getarg(0));
.@pages = .@len / .@page_size;
.@pages -= .@len > .@page_size && .@len % .@page_size ? 0 : 1;
do {
copyarray .@copy$[0], getelementofarray(getarg(0), .@page_size * .@page), .@page_size;
if( .@page < .@pages ) .@copy$[.@page_size] = "Next Page =>";
if( .@page > 0 ) .@copy$[.@page_size +1] = "<= Previous Page";
.@menu = select(implode(.@copy$,":"));
if( .@menu == .@page_size +1 ) .@page++;
else if( .@menu == .@page_size +2 ) .@page--;
deletearray .@copy$;
} while( .@menu > .@page_size );
.@menu += .@page_size * .@page;
return .@menu-1;
}
Example NPC:
prontera,146,188,4 script Warper 97,{
mes "[Warper]";
mes "Select the map you want to warp to.";
next;
setarray .@maps$, "prontera", "morocc", "payon", "geffen", "izlude", "jawaii", "dewata", "eclage", "moscovia", "ayothaya", "lighthalzen", "alberta", "aldebaran", "xmas", "comodo", "hugel", "rachel", "veins", "pvp_n_1-5", "pvp_n_1-4";
.@selection = DisplayPages(.@maps$, 5);
warp .@maps$[.@selection], 0, 0;
end;
}