Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Sample Multiple Page Menu
- //
- integer MENUCHANNEL;
- key TouchedBy;
- integer listenMenuHandle; // dialog menu
- integer MenuPage=0;
- list MenuList;
- DisplayMenu() {
- integer length = llGetListLength(MenuList);
- integer start = (MenuPage * 9)+MenuPage;
- integer end = start + 9;
- list menu = [];
- if (start > 0){
- menu = [ "<<" ];
- } else{
- menu = [ " " ];
- }
- menu += llList2List(MenuList,start,start);
- if (end < length-1){
- menu += [ ">>" ];
- }
- if (length>1) menu += llList2List(MenuList,start + 1, end);
- llDialog(TouchedBy, "message", menu , MENUCHANNEL);
- llSetTimerEvent(120.0);
- listenMenuHandle=llListen(MENUCHANNEL,"",NULL_KEY,"");
- }
- default {
- on_rez(integer start) {
- llResetScript();
- }
- state_entry() {
- llSetText("Multi Page Menu Example",ZERO_VECTOR,1.0);
- MENUCHANNEL=-1 - (integer)("0x" + llGetSubString( (string) llGetKey(), -7, -1) );
- MenuList=["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22"];
- }
- touch_start(integer total_number) {
- TouchedBy=llDetectedKey(0);
- MenuPage=0;
- DisplayMenu();
- }
- listen(integer channel, string name, key id, string message) {
- if (channel==MENUCHANNEL){
- if (message==">>") {
- MenuPage+=1;
- DisplayMenu();
- } else if(message=="<<"){
- MenuPage-=1;
- DisplayMenu();
- } else if(message==" "){
- DisplayMenu();
- } else {
- //
- //do something with Message hre
- }
- }
- }
- timer() {
- llSetTimerEvent(0);
- llListenRemove(listenMenuHandle);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement