The first and most important thing to do with your bot is to join a game. You should start by checking out the Joining Your First Game page, which will teach you how to join a game with your bot.
Once you've joined a game, there are many things you can do.
You should first understand the basic ways a Bot interacts with a game. The bot object has various properties and methods that allow you to interact with the game, like bot.game or bot.players.
Anyone, new to advanced, should pay careful attention to the next few sections.
Dispatches are how we command the bot to do something. This can be anything from reloading the bot's gun to booting a player (assuming the bot is the game host).
Dispatches have an initial check run to make sure things like information passed are correct, the game mode is correct, etc. When you dispatch, it'll return a boolean value indicating whether the dispatch was valid:
const valid = bot.dispatch(new ChatDispatch('hi')); // returns true since "hi" is a valid chat message
const valid2 = bot.dispatch(new ChatDispatch('')); // returns false since you cannot send an empty chat message
Once the validation has passed, the dispatch is checked 30 times a second to see if it can be run. If it can, it is run. If it cannot, it is ignored and will be checked around 33ms later. This allows you to queue events, even if they can't technically be run yet. Dispatches are fully synchronous.
Click here for a full list of dispatches.
Hooks are how we listen to events in the game. This can be anything from when a player joins the game to when a RPEGG rocket hits something.
bot.on('playerJoin', (player) => console.log(`${player.name} has joined the game!`));
Click here for a full list of dispatches.
That's the basics - now here's all the stuff you can do!
The first and most important thing to do with your bot is to join a game. You should start by checking out the Joining Your First Game page, which will teach you how to join a game with your bot.
Once you've joined a game, there are many things you can do.
You should first understand the basic ways a Bot interacts with a game. The bot object has various properties and methods that allow you to interact with the game, like bot.game or bot.players.
Anyone, new to advanced, should pay careful attention to the next few sections.
Dispatches are how we command the bot to do something. This can be anything from reloading the bot's gun to booting a player (assuming the bot is the game host).
Dispatches have an initial check run to make sure things like information passed are correct, the game mode is correct, etc. When you dispatch, it'll return a boolean value indicating whether the dispatch was valid:
const valid = bot.dispatch(new ChatDispatch('hi')); // returns true since "hi" is a valid chat message
const valid2 = bot.dispatch(new ChatDispatch('')); // returns false since you cannot send an empty chat message
Once the validation has passed, the dispatch is checked 30 times a second to see if it can be run. If it can, it is run. If it cannot, it is ignored and will be checked around 33ms later. This allows you to queue events, even if they can't technically be run yet. Dispatches are fully synchronous.
Click here for a full list of dispatches.
Hooks are how we listen to events in the game. This can be anything from when a player joins the game to when a RPEGG rocket hits something.
bot.on('playerJoin', (player) => console.log(`${player.name} has joined the game!`));
Click here for a full list of dispatches.
That's the basics - now here's all the stuff you can do!