-
Notifications
You must be signed in to change notification settings - Fork 7
Bot
Leonid Pospelov edited this page Aug 3, 2019
·
4 revisions
Extends User
.
Emitted when Bot
sees the character creation menu.
bot.on('raceMenuShow', async () => {
bot.sendLook(new Look('Argonian', 'Female'));
});
Emitted when Bot
sees self spawn.
-
pos
- An array representing XYZ coordinates. -
angleZ
- An angle in degrees. -
cellOrWorld
- FormID of Cell or WorldSpace (0x0000003c for Tamriel).
bot.on('spawn', async (pos, angleZ, cellOrWorld) => {
if (cellOrWorld === 0x0000003c) {
console.log('spawned in Tamriel at', pos);
}
});
Emitted when Bot
sees self despawn (exiting to main menu).
bot.on('despawn', async () => {
console.log('despawned');
});
Emitted when an attached actor is teleported via setPos
.
-
pos
- An array representing XYZ coordinates.
bot.on('teleport', async (pos) => {
console.log('My new pos is', pos);
});
Emitted when an attached actor is rotated via setAngle
.
-
angleZ
- A number representing Z-Angle.
bot.on('rotate', async (angleZ) => {
console.log('My new angle is', angleZ);
});
Dumps state of the world seen by Bot
.
let state = await bot.getWorldState();
console.log(state);
/*
{
localActorId: Number,
actors: [{
movement: Movement,
look: Look | Null,
lastAnimEvent: String,
numMovementChanges: Number,
numAnimEvents: Number
}, ...]
}
*/
Sends a new look. The server may ignore it if Bot
is not in the character creation menu.
-
newLook
- An instance ofLook
.
await bot.sendLook(new Look('Nord', 'Male'));
Sends movement.
-
newMovement
- An instance ofMovement
.
let pos = [x, y, z];
await bot.sendMovement(new Movement(pos));
-
animEvent
- String. Sends an animation event.
await bot.sendAnimEvent('JumpStart');
Use bot.browser
to access events and methods associated with the browser.
Catches incoming custom packets (generated on the backend).
-
targetSystem
- String. Should represent one of the systems in your gamemode. -
data
- Object with data from the gamemode.
bot.browser.on('customPacket', async (targetSystem, data) => {
if (targetSystem === 'Echo') {
bot.browser.sendCustomPacket('EchoResponse', data);
}
})
Simulates sending a custom packet from embedded browser.
-
targetSystem
- String. Should represent one of the systems in your gamemode. -
data
- A serializable object with the information you want to be sent to the gamemode.
await bot.browser.sendCustomPacket('MyAwesomeSystem', { someData: '123' });