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.
Actions 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).
Actions have a 3-step lifecycle:
Validation is run when you initialize the action. This is where the action checks if the parameters passed are valid. For example, if you try to boot a player that doesn't exist, the validation will fail and the action will not be executed.
Checking is then run every 33ms to ensure that the action can be executed. For example, if you try to reload the bot's gun while it is already reloading, the check will fail and the action will not be executed.
Once checking passes, the action is immediately executed. Actions are fully synchronous.
Actions are run with bot.emit(name, ...params). For example, to send a chat message, you would do:
bot.emit('chat', 'Hello everyone!');
Click here for a full list of actions.
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 hooks.
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.
Actions 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).
Actions have a 3-step lifecycle:
Validation is run when you initialize the action. This is where the action checks if the parameters passed are valid. For example, if you try to boot a player that doesn't exist, the validation will fail and the action will not be executed.
Checking is then run every 33ms to ensure that the action can be executed. For example, if you try to reload the bot's gun while it is already reloading, the check will fail and the action will not be executed.
Once checking passes, the action is immediately executed. Actions are fully synchronous.
Actions are run with bot.emit(name, ...params). For example, to send a chat message, you would do:
bot.emit('chat', 'Hello everyone!');
Click here for a full list of actions.
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 hooks.
That's the basics - now here's all the stuff you can do!