Difference between revisions of "LlExecCharacterCmd"

From Second Life Wiki
Jump to navigation Jump to search
(might work...)
m (Made the example work on both Aditi and Agni)
Line 15: Line 15:
<lsl>
<lsl>
vector patrol;
vector patrol;
 
default
default
{
{
Line 21: Line 21:
     {
     {
         patrol = llGetPos();
         patrol = llGetPos();
         llCreateCharacter([CHARACTER_DESIRED_SPEED, 50.0]);
         llCreateCharacter([CHARACTER_MAX_SPEED, 25, CHARACTER_DESIRED_SPEED, 15.0]);
         state awake;
         state awake;
     }
     }
}
}
 
state awake
state awake
{
{
     state_entry()
     state_entry()
     {
     {
         llOwnerSay("entering guarding");
         llSay(0, "I am guarding now");
         list points = [patrol + <5,0,0>, patrol - <5,0,0>];
         list points = [patrol + <5,0,0>, patrol - <5,0,0>];
         llPatrolPoints(points, []);
         llPatrolPoints(points, []);
     }
     }
   
     touch_start(integer total_number)
     touch_start(integer total_number)
     {
     {
Line 40: Line 40:
     }
     }
}
}
 
state sleep
state sleep
{
{
     state_entry()
     state_entry()
     {
     {
         llOwnerSay("entering sleeping");
         llSay(0, "Going to sleep");
         llExecCharacterCmd(CHARACTER_CMD_STOP, []);
         llExecCharacterCmd(CHARACTER_CMD_SMOOTH_STOP, []);
     }
     }
   
     touch_start(integer total_number)
     touch_start(integer total_number)
     {
     {

Revision as of 14:19, 12 May 2012

Summary

Function: llExecCharacterCmd( integer command, list options );

Send a command to the pathing system.

• integer command Command to be sent.
• list options No options currently used.

Currently only supports stopping the current pathfinding operation or causing the character to jump.

Command Value Description & Required Parameters
CHARACTER_CMD_JUMP 0x1 Makes the character jump.

The option list is required to start with a height parameter: [float height]

• float height height to jump, between 0.1m and 2.0m
CHARACTER_CMD_SMOOTH_STOP 0x2 Stops any current pathfinding operation in a smooth like fashion.
CHARACTER_CMD_STOP 0x0 Stops any current pathfinding operation.

Caveats

  • If another script in the same object issues CHARACTER_CMD_STOP then pathing in all scripts is cancelled.
All Issues ~ Search JIRA for related Bugs

Examples

<lsl> vector patrol;

default {

   state_entry()
   {
       patrol = llGetPos();
       llCreateCharacter([CHARACTER_MAX_SPEED, 25, CHARACTER_DESIRED_SPEED, 15.0]);
       state awake;
   }

}

state awake {

   state_entry()
   {
       llSay(0, "I am guarding now");
       list points = [patrol + <5,0,0>, patrol - <5,0,0>];
       llPatrolPoints(points, []);
   }

   touch_start(integer total_number)
   {
       state sleep;
   }

}

state sleep {

   state_entry()
   {
       llSay(0, "Going to sleep");
       llExecCharacterCmd(CHARACTER_CMD_SMOOTH_STOP, []);
   }

   touch_start(integer total_number)
   {
       patrol = llGetPos();
       //Jump to attention!
       llExecCharacterCmd(CHARACTER_CMD_JUMP, [0.5]);
       state awake;
   }

}

</lsl>

Deep Notes

Search JIRA for related Issues

Signature

function void llExecCharacterCmd( integer command, list options );