BMO BOT 9000

Print Images!!!!!!

  1. // ==UserScript==
  2. // @name BMO BOT 9000
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description Print Images!!!!!!
  6. // @author Bambi1
  7. // @match https://pixelplace.io/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=pixelplace.io
  9. // @run-at document-start
  10. // @grant none
  11. // ==/UserScript==
  12. let chatting = false;
  13.  
  14. // Your pixel array here(delete the brackets[])
  15. const pixelArray = [
  16. [50 ,50 ,50 ,50 ,50 ,37 ,37, 37, 37, 37, 37, 37, 37, 37, 36, 36, 36, 36, 36],//1
  17. [50, 50, 50, 50, 50, 37, 48, 48, 48, 48, 48, 48, 48, 37, 36, 36, 36, 36, 36],//2
  18. [50, 50, 50, 50, 50, 37, 48, 5, 48, 48, 48, 5, 48, 37, 36, 36, 36, 36, 36],//3
  19. [50, 50, 50, 50, 50, 37, 48, 48, 48, 48, 48, 48, 48, 37, 36, 36, 36, 36, 36],//4
  20. [50, 50, 50, 50, 50, 37, 48, 5, 5, 5, 5, 5, 48, 37, 36, 36, 36, 36 ,36],//5
  21. [50, 37, 50, 50, 50, 37, 48, 48, 5, 5, 5, 48, 48, 37, 36, 36, 36, 36, 36],//6
  22. [50, 37, 50, 50, 50, 37, 48, 48, 48, 48, 48, 48, 48, 37, 36, 36, 36, 36, 36],//7
  23. [50, 50, 37, 50, 50, 37, 37, 37, 37, 37, 37, 37, 37, 37, 36, 36, 36, 36, 36],//8
  24. [50, 50, 50, 37, 37, 37, 3, 3, 3, 3, 3, 37, 44, 37, 36, 47, 36, 36, 36],//9
  25. [50, 50, 50, 50, 50, 37, 37, 37, 37, 37, 37, 37, 37, 37, 36, 47, 36, 36, 36],//10
  26. [50, 50, 50, 50, 50, 37, 37, 11, 37, 37, 37, 37, 37, 37, 36, 47, 36, 36, 36],//11
  27. [50, 50, 50, 50, 50, 37, 11, 11, 11, 37, 37, 37, 37, 37, 36, 47, 36, 36, 36],//12
  28. [50, 50, 50, 50, 50, 37, 37, 11, 37, 37, 37, 32, 37, 37, 36, 47, 36, 36, 36],//13
  29. [50, 50, 50, 50, 50, 37, 37, 37, 37, 37, 20, 37, 7, 37, 36, 36, 36, 36, 36],//14
  30. [50, 50, 50, 50, 50, 37, 37, 37, 37, 37, 37, 37, 37, 37, 36, 36, 36, 36, 36],//15
  31. [50, 50, 50, 50, 50, 37, 37, 37, 37, 37, 37, 37, 37, 37, 36, 36, 36, 36, 36],//16
  32. [50, 50, 50, 50, 50, 50, 50, 37, 36, 50, 50, 50, 50, 50, 37, 36, 50, 50, 50, 50],//17
  33. [50, 50, 50, 50, 50, 50, 50, 37, 36, 50, 50, 50, 50, 50, 37, 36, 50, 50, 50, 50],//18
  34. [50, 50, 50, 50, 50, 50, 50, 37, 36, 50, 50, 50, 50, 50, 37, 36, 50, 50, 50, 50],//19
  35. // Add more rows as needed
  36. ];
  37. //^^^^^^^^^^^^^^^^^^^
  38. function fix(a, b) {
  39. Object.defineProperty(window.console, a, {configurable:false,enumerable:true,writable:false,value:b});
  40. }
  41. fix('log', console.log);
  42. fix('warn', console.warn);
  43. fix('error', console.error);
  44. fix('info', console.info);
  45. const originalWebSocket = window.WebSocket;
  46. var socket;
  47.  
  48. class WebSocketHook extends originalWebSocket {
  49. constructor(a, b) {
  50. super(a, b);
  51. socket = this;
  52. }
  53. }
  54.  
  55. window.WebSocket = WebSocketHook;
  56.  
  57.  
  58. function placePix(x, y, col) {
  59. socket.send(`42["p",[${x},${y},${col},1]]`);
  60. }
  61.  
  62. document.addEventListener('keydown', function(event) {
  63. // Check if the pressed key is 'j'
  64. if (event.key === 'j' & !chatting) {
  65. // Get the element with the id "coordinates"
  66. var coordinatesElement = document.getElementById('coordinates');
  67. var coordinatesValue = coordinatesElement.textContent;
  68. // Split the coordinates value into x and y parts
  69. var [x, y] = coordinatesValue.split(',');
  70. // Call the BMO function with the extracted x and y values
  71. console.log(parseInt(x), parseInt(y));
  72. image(parseInt(x), parseInt(y));
  73. }
  74. });
  75.  
  76. function image(SX, SY) {
  77.  
  78. const delayBetweenPixels = 25; // Adjust this value as needed
  79.  
  80. let rowIndex = 0;
  81. function placeNextRow() {
  82. if (rowIndex < pixelArray.length) {
  83. const row = pixelArray[rowIndex];
  84. let columnIndex = 0;
  85.  
  86. function placeNextPixel() {
  87. if (columnIndex < row.length) {
  88. const col = row[columnIndex];
  89. // Check if the color is not 50 before placing the pixel
  90. if (col !== 50) {
  91. placePix(SX + columnIndex, SY + rowIndex, col);
  92. }
  93. columnIndex++;
  94. if (col === 50) {
  95. placeNextPixel(); // Skip the delay for color 50
  96. } else {
  97. setTimeout(placeNextPixel, delayBetweenPixels);
  98. }
  99. } else {
  100. rowIndex++;
  101. placeNextRow();
  102. }
  103. }
  104.  
  105. placeNextPixel();
  106. }
  107. }
  108.  
  109. // Start placing pixels
  110. placeNextRow();
  111. }
  112. document.addEventListener('DOMContentLoaded', function() {
  113. 'use strict';
  114.  
  115. const chatInput = document.querySelector('input[name="chat"]');
  116. let chatting = false;
  117.  
  118. chatInput.addEventListener('focus', () => {
  119. chatting = true;
  120. console.log("chatting");
  121. });
  122.  
  123. chatInput.addEventListener('blur', () => {
  124. console.log("unchatting");
  125. chatting = false;
  126. });
  127. });