Difference between revisions of "User:Ackley Bing/List2DialogButtons"
Jump to navigation
Jump to search
Ackley Bing (talk | contribs) |
Ackley Bing (talk | contribs) |
||
Line 12: | Line 12: | ||
if (j>12) | if (j>12) | ||
buttons= | buttons= | ||
["<<" | ["<<",llList2String(chain,(i+9)%j),">>"] | ||
+llList2List(chain,(i+6)%j,(i+8)%j) | |||
+llList2List(chain,(i+3)%j,(i+5)%j) | |||
+llList2List(chain, | +llList2List(chain,i,(i+2)%j); | ||
+llList2List(chain, | |||
+llList2List(chain, | |||
else | else | ||
{ | { | ||
Line 26: | Line 24: | ||
return buttons; | return buttons; | ||
} | } | ||
default | default | ||
{ | { | ||
Line 42: | Line 39: | ||
if(message=="<<"|message==">>") | if(message=="<<"|message==">>") | ||
{ | { | ||
integer | integer j=llGetListLength(Gdummylist); | ||
if (message=="<<") Gindex=(Gindex-10)%j; | |||
else if (message==">>") Gindex=(Gindex+10)%j; | |||
else if( | |||
llDialog(llGetOwner()," ",List2DialogButtons(Gdummylist,Gindex),1); | llDialog(llGetOwner()," ",List2DialogButtons(Gdummylist,Gindex),1); | ||
} | } |
Revision as of 21:16, 23 May 2016
// List2DialogButtons() for llDialog use
// example: llDialog(id,"",List2DialogButtons(Gdummylist,Gindex),1);
// Uses "<<" & ">>" dialog buttons for navigation
list Gdummylist=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];
//list Gdummylist=["1","2","3","4","5","6","7","8","9","10","11","12"];
integer Gindex;
list List2DialogButtons(list chain, integer i)
{
list buttons;
integer j=llGetListLength(chain);
if (j>12)
buttons=
["<<",llList2String(chain,(i+9)%j),">>"]
+llList2List(chain,(i+6)%j,(i+8)%j)
+llList2List(chain,(i+3)%j,(i+5)%j)
+llList2List(chain,i,(i+2)%j);
else
{
integer k;
do buttons+=llList2List(chain,k,k);
while(++k<j);
}
return buttons;
}
default
{
state_entry()
{
llListen(1,"",llGetOwner(),"");
}
touch_start(integer index)
{
Gindex=0;
llDialog(llGetOwner()," ",List2DialogButtons(Gdummylist,Gindex),1);
}
listen(integer channel, string name, key id, string message)
{
if(message=="<<"|message==">>")
{
integer j=llGetListLength(Gdummylist);
if (message=="<<") Gindex=(Gindex-10)%j;
else if (message==">>") Gindex=(Gindex+10)%j;
llDialog(llGetOwner()," ",List2DialogButtons(Gdummylist,Gindex),1);
}
else
{
integer find_index=llListFindList(Gdummylist,[message]);
if(~find_index)
{
//Gindex=find_index;
//Action(Gindex);
}
}
}
}