Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const botPort = 169;
- var BotServer = new WebSocket('ws://192.168.1.2:' + botPort);
- window.meme = function() {
- console.log("Connecting to bot server...");
- };
- var BotCount = 0
- BotServer.onmessage = function(event) {
- BotCount = Number(event.data);
- }
- var BotName = "MrSonic Masters YT";
- window.start = function() {
- BotServer.send(JSON.stringify({reason: 'establish', server: window.agar.currentServer}));
- setInterval(function() {
- BotServer.send(JSON.stringify({reason: 'pos', posX: window.agar.playerX, posY: window.agar.playerY}));
- BotServer.send(JSON.stringify({reason: 'n', n: BotName}));
- BotServer.send(JSON.stringify({reason: 'bc'}));
- }, 50);
- };
- window.startDemBot = function() {
- console.log('Sending request to server to start bots...');
- console.log('Sending packet name as ' + BotName);
- console.log('Changing status...');
- window.start();
- var botStat = document.getElementById('botStatus');
- botStat.innerHTML = 'Status of bots : Running!';
- botStat.style.color = 'green';
- };
- document.addEventListener("keydown", function(k) {
- var key = String.fromCharCode(k.keyCode).toUpperCase();
- switch (key) {
- case "E":
- BotServer.send(JSON.stringify({reason: 'botEvent', evt: "split"}));
- break;
- case "R":
- BotServer.send(JSON.stringify({reason: 'botEvent', evt: "eject"}));
- break;
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement