MxoBot Example Bot

Demo bot to illustrate LibNevin. MxoBot

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require https://updategreasyfork.deno.dev/scripts/462620/1233374/MxoBot%20Example%20Bot.js

// ==UserScript==
// @name         MxoBot Example Bot
// @namespace    http://tampermonkey.net/<3nevin
// @version      1.1
// @description  Demo bot to illustrate LibNevin. MxoBot
// @author       ngixl
// @match        https://pixelplace.io/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=pixelplace.io
// @grant        unsafeWindow
// @require      https://gf.zukizuki.org/scripts/462620-mxobot-example-bot/code/MxoBot%20Example%20Bot.js
// ==/UserScript==
/* global NevinCore, NevinWaitForElm*/

const core = new MxoCore({
    timeout: 25
});

MxoWaitForElm('#canvas').then(function(c) {
    c.addEventListener('click', function() {
        const [sx, sy] = document.getElementById('coordinates').textContent.split(',').map(Number)
        core.picker.requestImageFromFileDialog(core.palette).then(a => {
            console.log(core.mxoWS.ws.readyState)
            a.image.addEventListener('load', function() {
                core.engine.tasks = [...core.engine.tasks, ...a.convertToTasks(sx,sy, core.mxoWS)]
            })
        })
    })
})