move
From SmartBots Developers Docs
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:
| |
| state | yes | value which controls the "instruction" completion:
| |
| 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");