Remote Morph Control

Written by: Headmaster

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");
            }
                                                                                                                    
                                                                 
        }
    }
}