Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The movement problem #118

Closed
areny7 opened this issue Feb 16, 2021 · 2 comments
Closed

The movement problem #118

areny7 opened this issue Feb 16, 2021 · 2 comments

Comments

@areny7
Copy link

areny7 commented Feb 16, 2021

How do I make the robot not execute the following code until it gets to its destination, and then execute the following code when the robot stops performing the motion?

@vinaghost
Copy link

const { once } = require('events');
.
.
.
// your code
bot.pathfinder.setMovements(defaultMove);
bot.pathfinder.setGoal(new GoalBlock(x, y, z));
await once(bot, 'goal_reached');
// your following code

@TheDudeFromCI
Copy link
Member

I recommend using bot.pathfinder.goto() instead of setGoal(). It contains the once inside of it already, plus it comes for support for stuff like throwing an error when there's no path found and all that.

@Karang Karang closed this as completed Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants