Difference between revisions of "LlExecCharacterCmd"

From Second Life Wiki
Jump to navigation Jump to search
m
 
(8 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Pathfinding alpha}}
{{LSL_Function
{{LSL_Function|
|func=llExecCharacterCmd
func=llExecCharacterCmd|
|func_desc=Send a command to the pathing system.
func_desc=Send a command to the pathing system.|
|func_footnote=Currently only supports stopping the current pathfinding operation or causing the character to jump.
func_footnote=Currently only supports stopping the current pathfinding operation.|
|p1_type=integer
p1_type=integer|
|p1_name=command
p1_name=command|
|p1_desc=Command to be sent.
p1_desc=Command to be sent.|
|p2_type=list
p2_type=list|
|p2_subtype=instructions
p2_name=options|
|p2_name=options
p2_desc=No options currently used.|
|p2_desc=<code>CHARACTER_CMD_*</code>|p2_hover=CHARACTER_CMD_*
constants={{LSL_Constants/llExecCharacterCmd}}|
|constants={{LSL_Constants/ExecCharacterCmd}}
caveats=* If another script in the same object issues CHARACTER_CMD_STOP then pathing in all scripts is cancelled.|
|caveats=* If another script in the same object issues [[CHARACTER_CMD_STOP]] then pathing in all scripts is cancelled.
examples=
|examples=
<lsl>
<source lang="lsl2">
vector patrol;
default
default
{
{
     state_entry()
     state_entry()
     {
     {
         llCreateCharacter([CHARACTER_DESIRED_SPEED, 50.0]);
        patrol = llGetPos();
         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 = [llGetPos() + <5,0,0>, llGetPos() - <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 37: 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)
     {
     {
        patrol = llGetPos();
        //Jump to attention!
        llExecCharacterCmd(CHARACTER_CMD_JUMP, [0.5]);
         state awake;
         state awake;
     }
     }
}
}
</lsl> |
</source>  
also_functions=
|also_functions=
* [[llCreateCharacter]]
* [[llCreateCharacter]]
* [[llDeleteCharacter]]
* [[llDeleteCharacter]]
Line 63: Line 69:
* [[llPursue]]
* [[llPursue]]
* [[llUpdateCharacter]]
* [[llUpdateCharacter]]
* [[llWanderWithin]]|
* [[llWanderWithin]]
also_events=
|also_events=
* [[path_update]]
* [[path_update]]
|history = Date of Release  [[ Release_Notes/Second_Life_Server/12#12.07.31.262785 | 31/07/2012 ]]
|cat1=Pathfinding
}}
}}

Latest revision as of 00:22, 22 January 2015

Summary

Function: llExecCharacterCmd( integer command, list options );

Send a command to the pathing system.

• integer command Command to be sent.
• list options CHARACTER_CMD_*

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.

Examples

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

Deep Notes

History

Date of Release 31/07/2012

Signature

function void llExecCharacterCmd( integer command, list options );