Simple MultiPage Dialog Menu System

Expired

From Rolig Loon:

// Simple Multipage Menu  --  Rolig Loon --  August 2013

// The Menu routine in this script will parse your input list (gNames) into menu pages
//    of 12 buttons each, including a forward button and a back button, as appropriate.
//    It generates a page's buttons on demand, so that the list of button labels is
//    never more than 12 items long.
//    It does NOT trim potential menu items to fit the 25-character limit (or the 
//    12-character display limit), nor does it sort buttons or do other fancy things
//    that you are free to add for yourself.


list gNames = ["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"];  // Your list of potential menu choices
integer gMenuPosition;  // Index number of the first button on the current page
integer gLsn;   // Dialog Listen Handle

Menu()
{
    integer Last;
    list Buttons;
    integer All = llGetListLength(gNames);
    if(gMenuPosition >= 9)   //This is NOT the first menu page
    {
        Buttons += "    <----";
        if((All - gMenuPosition) > 11)  // This is not the last page
        {
            Buttons += "    ---->";
        }
        else    // This IS the last page
        {
            Last = TRUE;
        }            
    }    
    else if (All > gMenuPosition+9) // This IS the first page
    {
        if((All - gMenuPosition) > 11)  // There are more pages to follow
        {
            Buttons += "    ---->";
        }
        else    // This IS the last page
        {
            Last = TRUE;
        }            
    }
    else    // This is the only menu page
    {
        Last = TRUE;
    }
    if (All > 0)
    {
        integer b;
        integer len = llGetListLength(Buttons);
        // This bizarre test does the important work ......        
        for(b = gMenuPosition + len + Last - 1 ; (len <12)&&(b < All); ++b)
        {
            Buttons = Buttons + [llList2String(gNames,b)];
            len = llGetListLength(Buttons);
        }
    }
    gLsn = llListen(-12345,"","","");    
    llSetTimerEvent(10.0);
    llDialog(llGetOwner()," \n",Buttons,-12345);
}

default
{
    touch_start(integer num)
    {
        llListenRemove(gLsn);
        gMenuPosition = 0;
        Menu();
    }
    
    listen(integer channel, string name, key id, string msg)
    {
        llListenRemove(gLsn);
        llSetTimerEvent(0.0);
        if (~llSubStringIndex(msg,"---->"))
        {
            gMenuPosition += 10;
            Menu();
        }
        else if (~llSubStringIndex(msg,"<----"))
        {
            gMenuPosition -= 10;
            Menu();
        }
        else
        {
            //Do whatever the selected button directs..... your choice
        }
    }
    
    timer()
    {
        llSetTimerEvent(0.0);
        llListenRemove(gLsn);
    }
}

 

Remote Color Control

Expired

Remote color control with menu"

Object:

vector red = <0.86,0.0,0.14>; 
vector green  = <0,0.9,0>; 
vector white  = <1 ,1,1>;
vector black  = <0.12,0.1,0.12>;
vector steel  = <0.27,0.51,0.71>;
vector blue  = <0.1,0.31,0.98>;
vector orange  = <1 ,.6,0>;
vector yellow  = <1 ,1,0.1>;
vector brown  = <0.5,0.25,0>;
vector pink  = <0.85,0,0.75>;
vector purple  = <0.8,0.21,0.8>;
vector lime  = <0.18,0.75,0.34>;
vector sky  = <0.53,0.81,0.92>;
vector lavander  = <0.2,0.2,0.4>;

default
{
    state_entry()
    {
                llSetStatus(STATUS_PHANTOM, TRUE);
 llListen(913, "", NULL_KEY, "" );
    }
    
    on_rez(integer num)
    {
        llResetScript();
    }

    listen(integer number, string name, key id, string message)
    {        //--------------LightEffects----------
       
if(message=="redl")
        {
            llSetColor(red, ALL_SIDES);
        }
        if(message=="greenl")
        {
            llSetColor(green, ALL_SIDES);
        }
        if(message=="lavanderl")
        {
            llSetColor(lavander, ALL_SIDES);
        }
        if(message=="skyl")
        {
            llSetColor(sky, ALL_SIDES);
        }
        if(message=="purplel")
        {
            llSetColor(purple, ALL_SIDES);
        }
        if(message=="limel")
        {
            llSetColor(lime, ALL_SIDES);
        }
        if(message=="brownl")
        {
            llSetColor(brown, ALL_SIDES);
        }
        if(message=="orangel")
        {
            llSetColor(orange, ALL_SIDES);
        }
        if(message=="steell")
        {
            llSetColor(steel, ALL_SIDES);
        }
        if(message=="whitel")
        {
            llSetColor(white, ALL_SIDES); 
        }
        if(message=="blackl")
        {
            llSetColor(black, ALL_SIDES);
        }
        if(message=="bluel")
        {
            llSetColor(blue, ALL_SIDES);
        }
        if(message=="yellowl")
        {
            llSetColor(yellow, ALL_SIDES);
        }
        if(message=="pinkl")
        {
            llSetColor(pink, ALL_SIDES);
        }
        if(message=="greenl")
        {
            llSetColor(green, ALL_SIDES); 
        }  
                if(message=="off")
        {
            llSetColor(white, ALL_SIDES); 
        }

        }

}

 

Remote:

integer menu_handler;
integer menu_channel;

menu(key user,string title,list buttons)//make dialog easy, pick a channel by itself and destroy it after 5 seconds
{
    menu_channel = (integer)(llFrand(99999.0) * -1);//yup a different channel at each use
    menu_handler = llListen(menu_channel,"","","");
    llDialog(user,title,buttons,menu_channel);
    llSetTimerEvent(5.0);
}

default
{
state_entry()
    { llSetTouchText("Remote!");
    }
    touch_start(integer t)
    {
        menu(llDetectedKey(0),"Choose a color from the List below...",["white","red","green","blue","steel","orange","yellow","pink","purple","sky","lavander","OFF"]);
    }
    timer() //so the menu timeout and close its listener
    {
        llSetTimerEvent(0.0);
        llListenRemove(menu_handler);
    }
    listen(integer channel,string name,key id,string message)
    {
        if (channel == menu_channel) //in case you have others listeners
        {
           integer c_channel = 913;//-----THIS IS THE CHANNEL FOR COMMANDS----
            if(message == "white")
            {
        llShout(c_channel, "whitel");
            }
            else if(message == "red")
            {
        llShout(c_channel, "redl");
            }

            else if(message == "green")
            {
        llShout(c_channel, "greenl");
            }        
            else if(message == "blue")
            {
        llShout(c_channel, "bluel");
            }
            else if(message == "black")
            {
        llShout(c_channel, "blackl");
            }                
            else if(message == "steel")
            {
        llShout(c_channel, "steell");
            }
            else if(message == "orange")
            {
        llShout(c_channel, "orangel");        
            }
            else if(message == "yellow")
            {
        llShout(c_channel, "yellowl");                                
            }
            else if(message == "purple")
            {
        llShout(c_channel, "purplel");                                                                      }                                                              
            else if(message == "pink")
            {
        llShout(c_channel, "pinkl");                                                                      }                 
            else if(message == "lime")
            {
        llShout(c_channel, "limel");                                                                      }                         
            else if(message == "sky")
            {
        llShout(c_channel, "skyl");                                                                      }                                 
            else if(message == "lavander")
            {
        llShout(c_channel, "lavanderl");                                                                      }        
                                  else if(message == "OFF")
            {
        llShout(c_channel, "off");                                                                                                
                                                                 
        }
    }
}}

 

Remote Morph Control

Expired

Remote prim morph control with menu

Object:

default
{
    state_entry()
    {
                llSetStatus(STATUS_PHANTOM, TRUE);
 llListen(922, "", NULL_KEY, "" );

    }
    
    on_rez(integer num)
    {
        llResetScript();
    }

    listen(integer number, string name, key id, string message)
    {                 
       list mypar = llGetPrimitiveParams([PRIM_SIZE,PRIM_TYPE]);
   if(message=="box")
        {
        llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_BOX, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1 .0, 1.0, 0.0>, <0.0, 0.0, 0.0>]);
                
        } 
           if(message=="cylinder")
        {
        llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_CYLINDER, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1 .0, 1.0, 0.0>, <0.0, 0.0, 0.0>]);
        } 
           if(message=="sphere")
        {

        llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_SPHERE, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <0.0, 1.0, 0.0>]);
        } 
           if(message=="prism")
        {
        llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_PRISM, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <0.0, 0.0, 0.0>, <0.0, 0.0, 0.0>]);
        } 
           if(message=="torus")
        {

        llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_TORUS, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1 .0, 0.25, 0.0>, <0.0, 0.0, 0.0>, <0.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 1.0, 0.0, 0.0]);;
        } 
           if(message=="tube")
        {

        llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_TUBE, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1 .0, 0.25, 0.0>, <0.0, 0.0, 0.0>, <0.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 1.0, 0.0, 0.0]);
        } 
                   if(message=="ring")
        {

        llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_RING, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <1 .0, 0.25, 0.0>, <0.0, 0.0, 0.0>, <0.0, 1.0, 0.0>, <0.0, 0.0, 0.0>, 1.0, 0.0, 0.0]);
        } 
                           if(message=="cone")
        {

        llSetPrimitiveParams([PRIM_TYPE, PRIM_TYPE_CYLINDER, 0, <0.0, 1.0, 0.0>, 0.0, <0.0, 0.0, 0.0>, <0.0, 0.0, 0.0>, <0.0, 0.0, 0.0>]);
        } 



        }

}

 

Remote:

integer menu_handler;
integer menu_channel;

menu(key user,string title,list buttons)//make dialog easy, pick a channel by itself and destroy it after 5 seconds
{
    menu_channel = (integer)(llFrand(99999.0) * -1);//yup a different channel at each use
    menu_handler = llListen(menu_channel,"","","");
    llDialog(user,title,buttons,menu_channel);
    llSetTimerEvent(5.0);
}

default
{state_entry()
    { llSetTouchText("Remote!");
    }
    touch_start(integer t)
    {
        menu(llDetectedKey(0),"ShapeShifter Control Panel \n  \n Put this script in all prims you wish to control.",["box","cylinder","sphere","prism","torus","tube","ring","cone"]);
    }
    timer() //so the menu timeout and close its listener
    {
        llSetTimerEvent(0.0);
        llListenRemove(menu_handler);
    }
    listen(integer channel,string name,key id,string message)
    {
        if (channel == menu_channel) //in case you have others listeners
        {
           integer c_channel = 922;//-----THIS IS THE CHANNEL FOR COMMANDS----
            if(message == "box")
            {
        llShout(c_channel, "box");
            }
            else if(message == "cylinder")
            {
        llShout(c_channel, "cylinder");
            } 
                        else if(message == "sphere")
            {
        llShout(c_channel, "sphere");
            } 
                        else if(message == "prism")
            {
        llShout(c_channel, "prism");
            } 
                        else if(message == "torus")
            {
        llShout(c_channel, "torus");
            } 
                        else if(message == "tube")
            {
        llShout(c_channel, "tube");
            } 
                        else if(message == "ring")
            {
        llShout(c_channel, "ring");
            } 
                      else if(message == "cone")
            {
        llShout(c_channel, "cone");
            }
                                                                                                                    
                                                                 
        }
    }
}