avatar_tracker_update
Fires when a tracked avatar changes position, logs out, teleports, or becomes visible again.
Requires Bot.trackAvatars() to be called first.
Bot.on("avatar_tracker_update", function(event) { ... });See the Bot.trackAvatars() command for usage.
Reference
Make sure Bot.on("avatar_tracker_update", ...) is defined before calling Bot.trackAvatars() to avoid missing early updates.
This event comes with the following event object:
Variable | Description |
|---|---|
| The name of the event — always |
| The Second Life name of the bot |
| UUID of the bot |
| The tracked avatar's Second Life name (may be null if unknown) |
| UUID of the tracked avatar |
| The region name the avatar is currently in |
| 64-bit handle of the region |
| Avatar’s current position ( |
| Avatar’s movement speed vector ( |
| Direction the avatar is facing (radians) |
|
|
| Internal SmartBots timestamp of the update |
| Format version of the event payload |
| Bot client version string |
Comments
Not available for self-hosted QubicBot app yet.
Example
Bot.on("avatar_tracker_update", (event) => {
if (event.position) {
Bot.say(0, `${event.avatar_name} is at X: ${event.position.X.toFixed(2)}, Y: ${event.position.Y.toFixed(2)}, Z: ${event.position.Z.toFixed(2)}`);
} else {
Bot.say(0, `${event.avatar_name} is no longer visible.`);
}
});
//When the bot logs in, or script starts
Bot.on("after_login", (event) => {
//Start tracking the avatar
Bot.trackAvatars("4d9ce772-d3ee-4cce-9555-bfb06ffcb228");
});Example Output
{
"name":"avatar_tracker_update",
"bot_slname":"OneSmartBot Resident",
"heading":-0.8756585,
"bot_uuid":"bd67863e-b273-4c3b-8ae5-dd8f61229280",
"region":"DuoLife",
"sitting":false,
"avatar_name":"Alexander Pixels",
"avatar_uuid":"4d9ce772-d3ee-4cce-9555-bfb06ffcb228",
"velocity":{
"X":0,
"Y":0,
"Z":0
},
"position":{
"X":140.54955,
"Y":38.20348,
"Z":22.085785
},
"timestamp":63896593110303,
"event_version":3,
"regionHandle":849922488517376,
"version":"131.01.00"
}Fires when a tracked avatar changes position, logs out, teleports, or becomes visible again.
Requires Bot.trackAvatars() to be called first.