self_position

From SmartBots Developers Docs
Bot PlaygroundEvents
Revision as of 07:52, 12 October 2022 by Gg (Talk | contribs)

Jump to: navigation, search

Fires when bot receives a changes his position. Not available for QubicBot yet (?)

Bot.on("self_position", function(event) { ... });

Reference

This event comes with the following event object:

Variable Required Description
event object properties:
name The name of the event in this case region_restart
region The name of the region the bot is at.
heading The direction in degrees where the bot is facing.
bot_uuid The UUID of the bot.
active_group The active group uuid of the bot.
position The current position of the bot.

Position Format:

  • X
  • Y
  • Z

Comment

The event fires when bot's position and/or view direction changes. The view direction change threshold is 5 degrees (thus, you won't get a notification if bot turns for less than 5 degrees).

The event is usually sent real time but can be postponed to avoid flooding your script with self_position event.


Example

console.log(`${process.name} started`);

Bot.on("self_position", (event) => {
    console.log(`self position event:`, event);
});