Gartic.io Ultimate Auto Paint

script for Gartic.io with auto-draw, bot control, and more!

// ==UserScript==
// @name         Gartic.io Ultimate Auto Paint 
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  script for Gartic.io with auto-draw, bot control, and more!
// @author       JAVAD
// @match        https://gartic.io/*
// @grant        GM_addStyle
// ==/UserScript==

// Auto-draw function
function autoDraw(imageUrl) {
  var canvas = document.getElementById('canvas');
  var ctx = canvas.getContext('2d');
  var image = new Image();
  image.src = imageUrl;
  image.onload = function() {
    var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
    var pixels = imageData.data;
    for (var i = 0; i < pixels.length; i += 4) {
      var r = pixels[i];
      var g = pixels[i + 1];
      var b = pixels[i + 2];
      var a = pixels[i + 3];
      // Dithering algorithm goes here
      //...
    }
    ctx.putImageData(imageData, 0, 0);
  };
}

// Bot control panel
var panel = `
  <div class="ygnpanel">
    <h5 style="text-shadow:3px 3px black;padding-bottom:10px;">&nbsp;Gartic.io Ultimate Script</h5>
    <div title="Refresh Room" onclick='javascript:window.onbeforeunload=null;window.location.href=window.location.href;'>
      <svg class="ygnbtn" width="25" height="30" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
        <path d="M20 15c-.665 1.64-2.436 3.015-3.966 3.907A8.004 8.004 0 0 1 4.062 13">
      </svg>
    </div>
    <input type="text" id="imageUrl" placeholder="Enter image URL">
    <button onclick="autoDraw(document.getElementById('imageUrl').value)">Draw</button>
    <button onclick="resetchat()">Reset Chat</button>
    <button onclick="kbotready=1">Enable Bot</button>
  </div>
`;

// Add panel to page
GM_addStyle(`
 .ygnpanel {
    position: fixed;
    top: 0;
    left: 0;
    background-color: #333;
    padding: 10px;
    border-bottom-right-radius: 10px;
    z-index: 1000;
  }
 .ygnbtn {
    cursor: pointer;
  }
`);
document.body.innerHTML += panel;

// Auto-draw on page load
autoDraw('https://example.com/your-image.png'); // Replace with your image URL

// Bot control functions
function resetchat() {
  setTimeout(function() {
    if (document.querySelector("#chat")) {
      for (let i of document.querySelectorAll(".scrollElements")[2].querySelectorAll("span")) {
        i.innerText = "YGN";
      }
      setTimeout(function() {
        kbotready = 1;
      }, 300);
    }
  }, 300);
}

function w(x) {
  e = document.querySelector('input[name="chat"]');
  lv = e.value;
  e.value = x;
  ev = new Event('input', { bubbles: true });
  ev.simulated = true;
  t = e._valueTracker;
  if (t) {
    t.setValue(lv);
  }
  e.dispatchEvent(ev);
}

function en(x) {
  res = "";
  for (i in x) {
    res += String.fromCharCode(x[i].charCodeAt() + 1);
  }
  return res;
}

function de(x) {
  res = "";
  for (i in x) {
    res += String.fromCharCode(x[i].charCodeAt() - 1);
  }
  return res;
}