Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. const botPort = 169;
  2. var BotServer = new WebSocket('ws://192.168.1.2:' + botPort);
  3. window.meme = function() {
  4. console.log("Connecting to bot server...");
  5. };
  6.  
  7. var BotCount = 0
  8. BotServer.onmessage = function(event) {
  9. BotCount = Number(event.data);
  10. }
  11.  
  12.  
  13. var BotName = "MrSonic Masters YT";
  14.  
  15. window.start = function() {
  16. BotServer.send(JSON.stringify({reason: 'establish', server: window.agar.currentServer}));
  17. setInterval(function() {
  18. BotServer.send(JSON.stringify({reason: 'pos', posX: window.agar.playerX, posY: window.agar.playerY}));
  19. BotServer.send(JSON.stringify({reason: 'n', n: BotName}));
  20. BotServer.send(JSON.stringify({reason: 'bc'}));
  21. }, 50);
  22. };
  23.  
  24. window.startDemBot = function() {
  25. console.log('Sending request to server to start bots...');
  26. console.log('Sending packet name as ' + BotName);
  27. console.log('Changing status...');
  28. window.start();
  29. var botStat = document.getElementById('botStatus');
  30. botStat.innerHTML = 'Status of bots : Running!';
  31. botStat.style.color = 'green';
  32. };
  33.  
  34. document.addEventListener("keydown", function(k) {
  35. var key = String.fromCharCode(k.keyCode).toUpperCase();
  36. switch (key) {
  37. case "E":
  38. BotServer.send(JSON.stringify({reason: 'botEvent', evt: "split"}));
  39. break;
  40. case "R":
  41. BotServer.send(JSON.stringify({reason: 'botEvent', evt: "eject"}));
  42. break;
  43. }
  44. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement