move

From SmartBots Developers Docs
Jump to: navigation, search

Start or stop bot movement and rotations.

Bot.move(instruction, state);

Reference

This command accepts the following parameters:

Variable Required Description


Input:
instruction yes The movement instruction. One of the following:
  • FORWARD - start/stop the forward movement
  • BACKWARD - start/stop the backward movement
  • LEFT - start/stop turning to the left
  • RIGHT - start/stop turning to the right
  • FLY - start/stop flying
  • STOP - stops all movements
state yes value which controls the "instruction" completion:
  • START - starts "instruction"
  • STOP - stops "instruction"
Output:
Function returns a Promise with the following data:
success bool true if command completed successfully
error string error string if command has failed

Details

This function allows establishing a direct control over bot's movement.

This function may be a bit laggy, and you might find Bot.walkTo() command to be more precise. However, use this command if you want a direct control over the bot's movement.

Related events:

  • self_position event will deliver you the bot position while it changes

Examples

Bot.move("FORWARD", "START");

// Walk forward for 2 seconds
await process.sleep(2_000);

Bot.move("FORWARD", "STOP");