Difference between revisions of "Aim Detection"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with 'This script detects whose aiming at you. <lsl> //This script was designed by TG Scripters, support further scripts by keeping this tag.// //Han Shuffle// default { state_ent...')
 
m (Cleaned up style for readability and removed pointless (unused) timer event and llSetPos())
Line 1: Line 1:
This script detects whose aiming at you.
This script detects whose aiming at you.


<lsl>
<lsl>//This script was designed by TG Scripters, support further scripts by keeping this tag.//
//This script was designed by TG Scripters, support further scripts by keeping this tag.//
//Han Shuffle//
//Han Shuffle//
//Cleaned up a bit by another resident.
default
default
{
{
     state_entry()
     state_entry()
     {
     {
      //  llSetPos(<0,0,0>);
        llSetText("", <1.0, 1.0, 1.0>, 1.0);
      llSensorRepeat("","", AGENT,90,PI,.1);
        llSensorRepeat("", "", AGENT, 90, PI, 0.1);
     }
     }
     timer(){
     sensor(integer n)
    llSetText("",<1,1,1>,1); 
    {
        llSetTimerEvent(0);
        integer i;
    }
        list sweep;
 
        for(i = 0; i !=n; i++)
  sensor(integer n){
        {
      integer i;
            float dist = llVecDist(llGetPos(), llDetectedPos(i));
      list sweep;
            if(llVecDist(llGetPos(), llDetectedPos(i) + llRot2Fwd(llDetectedRot(i)) * dist) < 1.5)
      for(i=0;i!=n;i++){
            {
          float dist = llVecDist(llGetPos(),llDetectedPos(i));
                if(llGetAgentInfo(llDetectedKey(i)) & AGENT_MOUSELOOK)
        if(llVecDist(llGetPos(),llDetectedPos(i)+llRot2Fwd(llDetectedRot(i))*dist) < 1.5){
                    sweep += llDetectedName(i);
            if(llGetAgentInfo(llDetectedKey(i)) & AGENT_MOUSELOOK){
               
          sweep+=llDetectedName(i);
           
             }
             }
            }
             if(i == n-1)
           
                llSetText(llDumpList2String( sweep, "\n"), <1.0, 1.0, 1.0>, 1.0);
             if(i == n-1){
            llSetText(llDumpList2String( sweep,"\n"),<1,1,1>,1);
            }
           
         }
         }
     
     }
     }
}
}</lsl>
 
</lsl>

Revision as of 02:01, 17 April 2010

This script detects whose aiming at you.

<lsl>//This script was designed by TG Scripters, support further scripts by keeping this tag.// //Han Shuffle// //Cleaned up a bit by another resident.

default {

   state_entry()
   {
       llSetText("", <1.0, 1.0, 1.0>, 1.0);
       llSensorRepeat("", "", AGENT, 90, PI, 0.1);
   }
   sensor(integer n)
   {
       integer i;
       list sweep;
       for(i = 0; i !=n; i++)
       {
           float dist = llVecDist(llGetPos(), llDetectedPos(i));
           if(llVecDist(llGetPos(), llDetectedPos(i) + llRot2Fwd(llDetectedRot(i)) * dist) < 1.5)
           {
               if(llGetAgentInfo(llDetectedKey(i)) & AGENT_MOUSELOOK)
                   sweep += llDetectedName(i);
           }
           if(i == n-1)
               llSetText(llDumpList2String( sweep, "\n"), <1.0, 1.0, 1.0>, 1.0);
       }
   }

}</lsl>