respawn script for tricksplit.io

instantly respawn with a press of a button

As of 2020-08-05. See the latest version.

// ==UserScript==
// @name         respawn script for tricksplit.io
// @namespace    http://tampermonkey.net/
// @version      2.3
// @description  instantly respawn with a press of a button
// @author       sos
// @match        https://tricksplit.io/
// @match        https://fanix.io/
// @grant        none
// ==/UserScript==
window.addEventListener('keydown', keydown);
window.addEventListener('keydown', keydown2);
window.addEventListener('keyup', keyup);
var menu = document.getElementsByClassName('menu');
var endPanel = document.getElementsByClassName('end');
var closePanel = document.getElementsByClassName('closePanel');
var chatInput = document.getElementsByClassName('chatInput');
var isTyping = false;
window.onload = function(){
    closePanel[0].click(); // automaticlly closes the newSkins window at the start of the game
    window.game.animationDelay = 50; // Set this to any animation delay you want, !WARNING! if you set the animation delay below 1, your game is not gonna work
    setTimeout(startCollection, 5000);
    chatInput[0].oninput = () => {
      isTyping = true;
    }

};

function startCollection() {
    var freeCoins = document.getElementById("freeCoins");
    freeCoins.onclick = function() {
        console.log('auto coins collection started');
        window.game.api.utils.claimFreeCoins();
        setInterval(collectCoins, 7210000);
    }
}


function collectCoins() {

   window.game.api.utils.claimFreeCoins();

}
function keydown2(event) {
        if (event.keyCode == 13) {
           isTyping = false;
        }
}
    function keydown(event) {
        if (event.keyCode == 68) {
           spawn();
        }
    }
function keyup(event) {
    if (event.keyCode == 68) { // 68 is equal to the key D if you want to change it then look at the link at the end of the script for the list of key codes numbers
        return;
    }
}


function spawn() {
   if (menu[0].style.display === "none" && isTyping === false) {
          window.game.socket.onClose("xd");
          endPanel[0].style.display = "none";
          document.getElementById('overlays').style.display = "none";
          setTimeout(spawn2, 1000);
   }
}
function spawn2() {
       window.game.spawn();
}


//     https://docstore.mik.ua/orelly/webprog/DHTML_javascript/0596004672_jvdhtmlckbk-app-b.html     \\ Link for key codes numbers