LibNevin

Library for creating bots in pixelplace.io

This script should not be not be installed directly. It is a library for other scripts to include with the meta directive // @require https://greasyfork.org/scripts/457456-libnevin/code/LibNevin.js?version=1141400

Author
ngixl
Version
0.0.1.20230123163107
Created
2023-01-01
Updated
2023-01-23
License
N/A

Nevin

Library for creating bots in pixelplace.io

This library has to be granted unsafeWindow.

With this library you can design more good looking bots, without worrying about its performance. Everything is configurable, so you can manipulate its actions freely.

Here is an example bot, which is just 14 lines! (Header not included)

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

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

NevinWaitForElm('#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.nevinWS.ws.readyState)
            a.image.addEventListener('load', function() {
                core.engine.tasks = [...core.engine.tasks, ...a.convertToTasks(sx,sy, core.nevinWS)]
            })
        })
    })
})