# not_at_target

*LSL event*

```lsl
not_at_target()
```

This event may be triggered multiple times if the target has not been reached.

Triggered if an object has not yet reached the target set by the call to [llTarget](/functions/llTarget/).

```lsl title="How to use" frame="terminal"
not_at_target()
{

}
```

## Examples

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

```lsl collapse={1-20}
integer target_id;
vector target_pos;

default
{
    state_entry()
    {
        target_pos = llGetPos() + <5.0, 0.0, 0.0>;
        target_id = llTarget(target_pos, 0.5);
        llSetStatus(STATUS_PHYSICS, TRUE);
        llMoveToTarget(target_pos, 0.4);
    }
    at_target(integer tnum, vector targetpos, vector ourpos)
    {
        if (tnum == target_id)
        {
            llOwnerSay("object is within range of target");
            llOwnerSay("target position: " + (string)targetpos + ", object is now at: " + (string)ourpos);
            llOwnerSay("this is " + (string)llVecDist(targetpos, ourpos) + " meters from the target");
            llTargetRemove(target_id);
        }
    }
    not_at_target()
    {
        llOwnerSay(
            "not there yet - object is at " + (string)llGetPos() +
            ", which is " + (string)llVecDist(target_pos, llGetPos()) +
            " meters from the target (" + (string)target_pos + ")"
        );
    }
}
```

</details>

## See also

### Functions

- [llTarget](/functions/llTarget/) — Setup a target position
- [llTargetRemove](/functions/llTargetRemove/) — Stop a target position
- [llRotTarget](/functions/llRotTarget/) — Setup a target rotation
- [llRotTargetRemove](/functions/llRotTargetRemove/) — Stop a target rotation

### Events

- [at_target](/events/at_target/)
- [at_rot_target](/events/at_rot_target/)
- [not_at_rot_target](/events/not_at_rot_target/)

---

*Source: [Not at target](https://wiki.secondlife.com/wiki/Not_at_target) on the Second Life Wiki. Content from the Second Life Wiki article Not at target (revision 1199205, 2016-02-21), CC BY-SA 3.0.*

---

From lsl.dev: https://lsl.dev/events/not_at_target/
