OWOP voider for ourworldofpixels

Automatically voids an area you specify. Cursor movements are currently not supported

  1. // Made by voyager, improved by Armağan
  2. // ==UserScript==
  3. // @name OWOP voider for ourworldofpixels
  4. // @match *.ourworldofpixels.com/*
  5. // @description Automatically voids an area you specify. Cursor movements are currently not supported
  6. // @version 1.7
  7. // @namespace https://greasyfork.org/users/220233
  8. // ==/UserScript==
  9. var x1 = 0;
  10. var y1 = 0;
  11. var x2 = 0;
  12. var y2 = 0;
  13. var r;
  14. var g;
  15. var b;
  16. function hexToRgb(hex) {
  17. var result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);
  18. return result ? {
  19. r: parseInt(result[1], 16),
  20. g: parseInt(result[2], 16),
  21. b: parseInt(result[3], 16)
  22. } : null;
  23. }
  24. function run()
  25. {
  26. var running = setInterval(function() {
  27. loop:
  28. for (var i = 0; i < Math.abs(x2 - x1); i++) {
  29. for (var j = 0; j < Math.abs(y2 - y1); j++) {
  30. if (OWOP.world.getPixel(i + x1, j + y1)[0] != r && OWOP.world.getPixel(i + x1, j + y1)[1] != g && OWOP.world.getPixel(i + x1, j + y1)[2] != b) {
  31. if((i + x1)<=(OWOP.mouse.tileX+30) && (i + x1)>=(OWOP.mouse.tileX-30) && (j + y1)>=(OWOP.mouse.tileY-30) && (j + y1)<=(OWOP.mouse.tileY+30))
  32. {
  33. OWOP.world.setPixel(i + x1, j + y1, [r, g, b], false)
  34. break loop;
  35. }
  36. }
  37. }
  38. }
  39. }, 1);
  40. }
  41. function openSeekbarWindow() {
  42. OWOP.windowSys.addWindow(new OWOP.windowSys.class.window('VOIDER BY VOYAGER', {}, function(win) {
  43. win.container.title = 'Voids an area';
  44. win.container.style.height = 'auto';
  45. win.container.style.width = '100px';
  46. win.container.style.overflow = 'hidden';
  47. win.addObj(document.createTextNode('X1 : '));
  48. var inputx1 = OWOP.util.mkHTML('input', {
  49. id: 'x1input',
  50. oninput: function() {
  51. x1 = parseInt(this.value);
  52. }
  53. });
  54. win.addObj(inputx1);
  55. win.addObj(document.createTextNode('Y1 : '));
  56. var inputy1 = OWOP.util.mkHTML('input', {
  57. id: 'y1input',
  58. oninput: function() {
  59. y1 = parseInt(this.value);
  60. }
  61. });
  62. win.addObj(inputy1);
  63. win.addObj(document.createTextNode('X2 : '));
  64. var inputx2 = OWOP.util.mkHTML('input', {
  65. id: 'x2input',
  66. oninput: function() {
  67. x2 = parseInt(this.value);
  68. }
  69. });
  70. win.addObj(inputx2);
  71. win.addObj(document.createTextNode('Y2 : '));
  72. var inputy2 = OWOP.util.mkHTML('input', {
  73. id: 'y2input',
  74. oninput: function() {
  75. y2 = parseInt(this.value);
  76. }
  77. });
  78. win.addObj(inputy2);
  79. win.addObj(document.createTextNode('Color : '));
  80. var colorin = OWOP.util.mkHTML('input', {
  81. type: 'color',
  82. id: 'voidcolor',
  83. onchange: function() {
  84. r = hexToRgb(this.value).r;
  85. g = hexToRgb(this.value).g;
  86. b = hexToRgb(this.value).b;
  87. }
  88. });
  89. win.addObj(colorin);
  90. var button = OWOP.util.mkHTML('button', {
  91. id: 'voidbutton',
  92. innerHTML: 'Void!',
  93. onclick: function() {
  94. if (document.getElementById("x1input").value != "") {
  95. if (document.getElementById("y1input").value != "") {
  96. if (document.getElementById("x2input").value != "") {
  97. if (document.getElementById("y2input").value != "") {
  98. run();
  99. }
  100. }
  101. }
  102. }
  103. }
  104. });
  105. win.addObj(button);
  106. }).move(window.innerWidth - 500, 32));
  107. }
  108.  
  109. if (typeof OWOP != 'undefined') openSeekbarWindow();
  110. window.addEventListener('load', function() {
  111. setTimeout(openSeekbarWindow, 1234);
  112. });