This is the acutal dialog caller function. Nothing really needs to be edited in here...
CODE
integer page;
Dialog(string msg,list call,key id) // Use that to call it
{
integer x;
buttons = []; //Stores the button numbers
disp = []; //Displays the information displayed on the dialog from the ORIGINAL list
if(page == 1)
{
x = 0;
}
else
{
x = page*9 - 9;
}
for(x = 0;x < llGetListLength(call);x++)
{
integer g = x + 1;
disp += [(string)g+") "+llList2String(call,x)];
}
if(llGetListLength(disp) < 12)
{
for(x = 0;x < llGetListLength(disp);x++)
{
integer add = x + 1;
buttons += [(string)add];
}
}
else
{
integer y;
for(y = x;y < x + 10;y++)
{
integer g = y + 1;
disp += [(string)g+") "+llList2String(call,y)];
buttons == [(string)g];
}
if(page != llCeil(llGetListLength(disp) / 10))
{
buttons += ["Next"];
}
if(page == llCeil(llGetListLength(disp) / 10))
{
buttons += ["Previous"];
}
if(page != 1 && page != llCeil(llGetListLength(disp) / 10))
{
buttons += ["Previous"];
}
}
llDialog(id,msg+" (Page "+(string)page+")\n\n"+llDumpList2String(disp,"\n"),buttons,chan);
}
Here is an example script using that to call...
CODE
integer chan;
list colors = ["Red","Green","Blue"];
default
{
state_entry()
{
chan = llRound(llFrand(99999)+1); // Random channel for security
llListen(chan,"","","");
}
touch(integer t)
{
Dialog("Choose a Color",colors,llDetectedKey(0));
}
listen(integer c,string n,key id,string m)
{
if(m == "Next")
{
page++;
Dialog("Choose a Color",colors,llDetectedKey(0));
}
if(m == "Previous")
{
page--;
Dialog("Chooes a Color",colors,llDetectedKey(0));
}
if(m != "Previous" && m != "Next")
{
string find = llList2String(colors,(integer)m - 1);
llSay(0,"Hey I got "+find);
}
}
}
Have Fun!