Difference between revisions of "User:Toy Wylie/Meeroos/Meeroo Finder"

From Second Life Wiki
Jump to navigation Jump to search
(refined)
(New version)
Line 1: Line 1:
Copy this script into a normal 0.5m box, sit on it and say the name of the Meeroo you are looking for. If it is within 96.0 meters of range, the box will move right above it.
Copy this script into a normal 0.5m box, sit on it and say the name of the Meeroo you are looking for on channel 6. If it is within 96.0 meters of range, the finder will move towards it and follow it around. Make sure to type the exact meeroo name, capital letters matter. So if your Roo was named "Kiki Meeroo", type: '''/6Kiki'''


<lsl>default
<lsl>key target;
 
follow(key k)
{
    if(k==NULL_KEY)
        llSetTimerEvent(0.0);
    else
        llSetTimerEvent(0.5);
 
    target=k;
}
 
rebuild()
{
    llSetPrimitiveParams(
    [
        PRIM_TYPE,PRIM_TYPE_CYLINDER,
            PRIM_HOLE_DEFAULT,
            <0.0,1.0,0.0>,
            0.5,
            <0.0,0.0,0.0>,
            <1.0,1.0,0.0>,
            <0.0,0.0,0.0>,
        PRIM_SIZE,<1.0,1.0,0.0375>,
        PRIM_TEXTURE,
            ALL_SIDES,
            TEXTURE_BLANK,
            <1.0,1.0,0.0>,
            <0.0,0.0,0.0>,
            0.0,
        PRIM_COLOR,
            ALL_SIDES,
            <0.0,0.5,1.0>,
            0.6,
        PRIM_GLOW,
            ALL_SIDES,
            0.3
    ]);
}
 
default
{
{
     on_rez(integer dummy)
     on_rez(integer dummy)
Line 10: Line 50:
     state_entry()
     state_entry()
     {
     {
         llSitTarget(<0.25,0.0,0.55>,ZERO_ROTATION);
        rebuild();
         llListen(0,"",llGetOwner(),"");
        target=NULL_KEY;
         llSitTarget(<0.0,0.0,0.80>,ZERO_ROTATION);
         llSetClickAction(CLICK_ACTION_SIT);
     }
     }


Line 26: Line 68:
     sensor(integer num)
     sensor(integer num)
     {
     {
        target=llDetectedKey(0);
         while(llVecDist(llGetPos(),llDetectedPos(0))>9.0)
         while(llVecDist(llGetPos(),llDetectedPos(0))>9.0)
             llSetLinkPrimitiveParamsFast(LINK_THIS,
             llSetLinkPrimitiveParamsFast(LINK_THIS,
             [
             [
                 PRIM_POSITION,llDetectedPos(0)+<0.0,0.0,1.0>
                 PRIM_POSITION,llDetectedPos(0)
             ]);
             ]);
        follow(llDetectedKey(0));
    }
    changed(integer change)
    {
        if(change==CHANGED_LINK)
        {
            key avatar=llAvatarOnSitTarget();
            if(avatar!=NULL_KEY)
            {
                llListen(6,"",avatar,"");
                llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION);
            }
            else
            {
                llResetScript();
            }
        }
    }
    run_time_permissions(integer perms)
    {
        if(perms & PERMISSION_TRIGGER_ANIMATION)
        {
            llStopAnimation("sit");
        }
    }
    timer()
    {
        list details=llGetObjectDetails(target,[OBJECT_POS,OBJECT_ROT]);
        vector pos=llList2Vector(details,0);
        rotation rot=llList2Rot(details,1);
         llSetLinkPrimitiveParamsFast(LINK_THIS,
         llSetLinkPrimitiveParamsFast(LINK_THIS,
         [
         [
             PRIM_POSITION,llDetectedPos(0)+<0.0,0.0,1.0>
             PRIM_POSITION,pos,
            PRIM_ROTATION,rot*llEuler2Rot(<0.0,0.0,-90.0>*DEG_TO_RAD)
         ]);
         ]);
     }
     }
}
}
</lsl>
</lsl>

Revision as of 04:38, 7 July 2011

Copy this script into a normal 0.5m box, sit on it and say the name of the Meeroo you are looking for on channel 6. If it is within 96.0 meters of range, the finder will move towards it and follow it around. Make sure to type the exact meeroo name, capital letters matter. So if your Roo was named "Kiki Meeroo", type: /6Kiki

<lsl>key target;

follow(key k) {

   if(k==NULL_KEY)
       llSetTimerEvent(0.0);
   else
       llSetTimerEvent(0.5);
   target=k;

}

rebuild() {

   llSetPrimitiveParams(
   [
       PRIM_TYPE,PRIM_TYPE_CYLINDER,
           PRIM_HOLE_DEFAULT,
           <0.0,1.0,0.0>,
           0.5,
           <0.0,0.0,0.0>,
           <1.0,1.0,0.0>,
           <0.0,0.0,0.0>,
       PRIM_SIZE,<1.0,1.0,0.0375>,
       PRIM_TEXTURE,
           ALL_SIDES,
           TEXTURE_BLANK,
           <1.0,1.0,0.0>,
           <0.0,0.0,0.0>,
           0.0,
       PRIM_COLOR,
           ALL_SIDES,
           <0.0,0.5,1.0>,
           0.6,
       PRIM_GLOW,
           ALL_SIDES,
           0.3
   ]);

}

default {

   on_rez(integer dummy)
   {
       llResetScript();
   }
   state_entry()
   {
       rebuild();
       target=NULL_KEY;
       llSitTarget(<0.0,0.0,0.80>,ZERO_ROTATION);
       llSetClickAction(CLICK_ACTION_SIT);
   }
   listen(integer c,string name,key k,string message)
   {
       llSensor(message+" Meeroo",NULL_KEY,SCRIPTED,96.0,PI);
   }
   no_sensor()
   {
       llOwnerSay("Not found.");
   }
   sensor(integer num)
   {
       target=llDetectedKey(0);
       while(llVecDist(llGetPos(),llDetectedPos(0))>9.0)
           llSetLinkPrimitiveParamsFast(LINK_THIS,
           [
               PRIM_POSITION,llDetectedPos(0)
           ]);
       follow(llDetectedKey(0));
   }
   changed(integer change)
   {
       if(change==CHANGED_LINK)
       {
           key avatar=llAvatarOnSitTarget();
           if(avatar!=NULL_KEY)
           {
               llListen(6,"",avatar,"");
               llRequestPermissions(avatar,PERMISSION_TRIGGER_ANIMATION);
           }
           else
           {
               llResetScript();
           }
       }
   }
   run_time_permissions(integer perms)
   {
       if(perms & PERMISSION_TRIGGER_ANIMATION)
       {
           llStopAnimation("sit");
       }
   }
   timer()
   {
       list details=llGetObjectDetails(target,[OBJECT_POS,OBJECT_ROT]);
       vector pos=llList2Vector(details,0);
       rotation rot=llList2Rot(details,1);
       llSetLinkPrimitiveParamsFast(LINK_THIS,
       [
           PRIM_POSITION,pos,
           PRIM_ROTATION,rot*llEuler2Rot(<0.0,0.0,-90.0>*DEG_TO_RAD)
       ]);
   }

} </lsl>