Arras Auto Respawn (Presses Enter on strokeText)

chatgpt script

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Arras Auto Respawn (Presses Enter on strokeText)
// @namespace    autorespawnEnterStroke
// @description  chatgpt script
// @version      1.0
// @match        *://arras.io/*
// @match        *://arras.glitch.me/*
// @match        *://*arras*/*
// @grant        none
// @license      dont steal
// ==/UserScript==

(function() {
    'use strict';

    const origStrokeText = CanvasRenderingContext2D.prototype.strokeText;

    // Function to simulate the Enter key
    function pressEnter() {
        const ev1 = new KeyboardEvent("keydown", {
            key: "Enter",
            code: "Enter",
            keyCode: 13,
            which: 13,
            bubbles: true
        });
        const ev2 = new KeyboardEvent("keyup", {
            key: "Enter",
            code: "Enter",
            keyCode: 13,
            which: 13,
            bubbles: true
        });

        document.dispatchEvent(ev1);
        document.dispatchEvent(ev2);

        console.log("[AutoRespawn] Simulated ENTER key press.");
    }

    // Patch strokeText
    CanvasRenderingContext2D.prototype.strokeText = function(text, ...rest) {

        if (typeof text === "string") {
            const lower = text.trim().toLowerCase();

            // Detect the Respawn button text being drawn
            if (lower === "respawn") {
                console.log("[AutoRespawn] Respawn text detected — pressing Enter.");

                // Press Enter immediately and again shortly after
                pressEnter();
                setTimeout(pressEnter, 50);
                setTimeout(pressEnter, 150);
            }
        }

        return origStrokeText.call(this, text, ...rest);
    };

})();