Ring Skyjet

From The SchomEmunity Wiki
Jump to: navigation, search
  list entrants;
  integer lis;
  integer i;
  default
  {
     state_entry()
     {
         llVolumeDetect(TRUE);
         llCollisionFilter("Skyjet",NULL_KEY,TRUE);   
     }
     collision_start(integer total)
     {
         for(i=0;i<total;i++)
         {
             entrants+=[llKey2Name(llDetectedOwner(i)),llGetWallclock(),llVecMag(llDetectedPos(i)-llGetPos())];
             llOwnerSay("Ring 1:"+llKey2Name(llDetectedOwner(i))+","+(string)llGetWallclock()+","+(string)llVecMag(llDetectedPos(i)-llGetPos()));
         }
     }
     touch_start(integer detected)
     {
         lis=llListen(0,"",NULL_KEY,"");
         llSay(0,"Say 'Times' to get each entrant's passing time,
                 'Accuracy' to get how far each was from the middle,
                 and 'Results' to show both");
         llSay(0,"Owner: say 'Clear' to clear records");
     }
     
     listen(integer channel,string name,key id,string message)
     {
         if(id==llGetOwner() && message=="Clear")entrants=[];
         else for(i=0;i<llGetListLength(entrants)/3;i++)
         {
             if(message=="Times")llSay(0,llList2String(entrants,3*i)+":"+(string)llList2Float(entrants,3*i+1));
             else if(message=="Accuracy")llSay(0,llList2String(entrants,3*i)+":"+(string)llList2Float(entrants,3*i+2));
             else if(message=="Results")llSay(0,llList2String(entrants,3*i)+":"+(string)llList2Float(entrants,3*i+1)+","+(string)llList2Float(entrants,3*i+2));
         }
         llListenRemove(lis);
     }
  }