# llPatrolPoints

*LSL function*

```lsl
void llPatrolPoints(list patrolPoints, list options);
```

- `list patrolPoints`: A list of at least two position vectors representing the patrol path.
- `list options`: A list of PATROL_* flags and parameters to configure the patrol behavior.

- Energy: 10

Directs a pathfinding character to patrol sequentially through the coordinates specified in patrolPoints, configured by options.

Sets the object patrolling between the points specified in **patrolPoints**.

```lsl title="How to use" frame="terminal"
llPatrolPoints([], []);
```

## Specification

Constant group [CharacterPatrolPointsParam](/constants/groups/CharacterPatrolPointsParam/):

```lsl
PATROL_PAUSE_AT_WAYPOINTS = 0
```

| Constant | Type | Value | Description |
| --- | --- | --- | --- |
| [PATROL_PAUSE_AT_WAYPOINTS](/constants/PATROL_PAUSE_AT_WAYPOINTS/) | integer | `0` | Whether the character should pause briefly after reaching each patrol point. |

<table>
	<tr>
		<th>Option</th>
		<th>V</th>
		<th>Parameters</th>
		<th>Default</th>
		<th>Description</th>
	</tr>
	<tr>
		<td>\[ [integer](https://wiki.secondlife.com/wiki/integer) `boolean` \]</td>
		<td>\[ [FALSE](/constants/FALSE/) \]</td>
		<td>Whether the character should pause briefly after reaching each patrol point.</td>
	</tr>
</table>

## Caveats

- Must use [llCreateCharacter](/functions/llCreateCharacter/) or script won't compile
- Vertical positions specified for any vectors should be chosen to be as close as possible to the actual height of the terrain requested. Large difference between the provided vertical position and the actual terrain/object will result in failure of the behavior.
- The **patrolPoints** list requires a minimum of two valid vectors.
- If a vector in the list is outside the nav volume (e.g.: too high,) it will be ignored.

## Examples

<details open>
<summary>Example 1</summary>

```lsl
default
{
    state_entry()
    {
        llCreateCharacter([CHARACTER_MAX_SPEED, 25, CHARACTER_DESIRED_SPEED, 15.0]);
        //MAX_SPEED is @ 20 by default
    }

    touch_start(integer total_number)
    {
        list points = [llGetPos() + <5,0,0>, llGetPos() - <5,0,0>];
        llPatrolPoints(points, [PATROL_PAUSE_AT_WAYPOINTS, TRUE]);
    }
}
```

</details>

## History

Date of Release [31/07/2012](https://wiki.secondlife.com/wiki/Release_Notes/Second_Life_Server/12#12-07-31-262785)

## See also

### Functions

- [llCreateCharacter](/functions/llCreateCharacter/)
- [llDeleteCharacter](/functions/llDeleteCharacter/)
- [llEvade](/functions/llEvade/)
- [llExecCharacterCmd](/functions/llExecCharacterCmd/)
- [llGetClosestNavPoint](/functions/llGetClosestNavPoint/)
- [llFleeFrom](/functions/llFleeFrom/)
- [llNavigateTo](/functions/llNavigateTo/)
- [llPatrolPoints](/functions/llPatrolPoints/)
- [llPursue](/functions/llPursue/)
- [llUpdateCharacter](/functions/llUpdateCharacter/)
- [llWanderWithin](/functions/llWanderWithin/)

### Events

- [path_update](/events/path_update/)

---

*Source: [LlPatrolPoints](https://wiki.secondlife.com/wiki/LlPatrolPoints) on the Second Life Wiki. Content from the Second Life Wiki articles LlPatrolPoints (revision 1215189, 2023-10-28) and Template:LSL Constants/llPatrolPoints (revision 1215208, 2023-10-28), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/functions/llPatrolPoints/
