LlPatrolPoints debugging

From Second Life Wiki
Jump to: navigation, search

<lsl> float speed = 5.0; float wanderRadius = 15.0; //add your coordinate points here list points = [ <40, 30, 10>, <40, 20, 10>, <40, 20, 10>];

debugMsg(string msg) {

   //llOwnerSay(msg); //comment this line out to turn off debug messages

}

setup() {

   llDeleteCharacter();
   llResetScript();

}

doStuff() {

   llPatrolPoints(points, []);

}

default {

   state_entry()
   {
       llCreateCharacter([CHARACTER_DESIRED_SPEED, speed, CHARACTER_ORIENTATION, VERTICAL, CHARACTER_RADIUS, 0.2, CHARACTER_LENGTH, 0.5]);
       doStuff(); //either replace this with your functionality or replace the function doStuff()
   }
  
   //touch_start(integer total_number)
   //{
   //    setup(); //comment this handler line out when done testing unless touch events desired
   //}
  
   on_rez(integer start_param)
   {    
       setup(); 
   }
  
   path_update(integer update, list none)
   {
       if (update == 0) //near goal
       {
           debugMsg("");
       }
       else if (update == 1) //goal reached
       {
           debugMsg("");
       }
       else //errors
       {
           debugMsg("");
       }
   }

} </lsl>


Get coordinate points (add to a prim, touch prim to get closest good pathfinding coordinate): <lsl>

default {

   state_entry()
   {
      // llSay(0, "Hello, Avatar!");
   }
   touch_start(integer total_number)
   {
      llOwnerSay((string)llGetClosestNavPoint(llGetPos(), []));
   }

} </lsl>