LlWanderWithin debugging

From Second Life Wiki
Jump to navigation Jump to search

<lsl> float speed = 2.0; vector wanderRange = <15.0, 15.0, 15.0>;

debugMsg(string msg) {

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

}

setup() {

   llDeleteCharacter();
   llResetScript();

}

doStuff() {

   llWanderWithin(llGetPos(), wanderRange, []);

}

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("");
       }
       llOwnerSay("Got a pathing failure " + (string)update);

llDie();

   }

} </lsl>