Difference between revisions of "LlWanderWithin debugging"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with "<lsl> float speed = 2.0; float wanderRadius = 15.0; debugMsg(string msg) { //llOwnerSay(msg); //comment this line out to turn off debug messages } setup() { llDeleteCha…")
 
m (type)
 
Line 1: Line 1:
<lsl>
<lsl>
float speed = 2.0;
float speed = 2.0;
float wanderRadius = 15.0;
vector wanderRange = <15.0, 15.0, 15.0>;
 
debugMsg(string msg)
debugMsg(string msg)
{
{
     //llOwnerSay(msg); //comment this line out to turn off debug messages
     //llOwnerSay(msg); //comment this line out to turn off debug messages
}
}
 
setup()
setup()
{
{
Line 13: Line 13:
     llResetScript();
     llResetScript();
}
}
 
doStuff()
doStuff()
{
{
     llWanderWithin(llGetPos(), wanderRadius, []);
     llWanderWithin(llGetPos(), wanderRange, []);
}
}
 
default
default
{
{
Line 26: Line 26:
         doStuff(); //either replace this with your functionality or replace the function doStuff()
         doStuff(); //either replace this with your functionality or replace the function doStuff()
     }
     }
 
     //touch_start(integer total_number)
     //touch_start(integer total_number)
     //{
     //{
     //    setup(); //comment this handler line out when done testing unless touch events desired
     //    setup(); //comment this handler line out when done testing unless touch events desired
     //}
     //}
 
     on_rez(integer start_param)
     on_rez(integer start_param)
     {     
     {     
         setup();  
         setup();  
     }
     }
 
     path_update(integer update, list none)
     path_update(integer update, list none)
     {
     {

Latest revision as of 11:01, 24 August 2012

<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>