Who Is Online

7
Online

Sunday, 22 July 2018 01:36

Remote Morph Control

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

 

Flash Scratch to SL - Your Scripting Tool

Script ImageNeed to write a LSL script and don't know how to script?  I know I hate trying to get my head around LSLS when I an in a time crunch. So why not give Flash Scratch a try! Its a great tool for learning and scoding your own scripts for Second Life without having to pay someone to do it and without a crash course in LSL

A Huge thanks to John Bennet of ATLAS Institute at University of Colorado and Eric Rosenbaum at MIT for writing Scratch for SL to begin with.

Read more: Flash Scratch to SL - Your Scripting Tool