// **THIS SCRIPT IS NO LONGER SUPPORTED** // Use this instead: pastebin.com/WQRPj4bV // version 1.4.1 // This is a small script I've been working on. It has several features, including bots, a pathfinder, texting, and an easy-to-use GUI with several settings. // INSTALLATION: // 1. Copy this ENTIRE SCRIPT. // 2. Open cursors.io and make sure you are on the "Click to Begin" screen. // 3. Open inspect element then navigate to the "Console" tab. // 4. Paste the whole script in. It might take a few seconds. // 5. Press enter. // 6. Unless you know what you're doing, ignore the alerts that come up and don't change their values. You can only have a maximum of 2 bots on cursors.io. // 7. Wait until the popup that says they're connected, then you're good to go! Note that you must click to move. Some levels may kick you for doing so. By default moving DOES NOT CLICK, so you'll have to switch the pathfinder movement setting if you want to move. // CONTROLS: (sorry mac users) // Click: Move yourself and your bots to the specified location. // You can only go AROUND walls, not THROUGH them. // // Shift + Click: Leave behind a bot at the specified location. // // Alt + Click: Return an abandoned bot. You'll still have to click again to move it. // // Ctrl + Click: Force yourself and your bots to move to the specified location. // The pathfinder will NOT work here. // // Letters a-z (lowercase): Adds the specified character to your message. At the moment this will NOT show up. // // Enter: Sends the typed in message. If you don't have any open bots, it will give an error. // // NUMPAD1: Sets the moveMethod to 1 (Silent pathfinder) // // NUMPAD2: Sets the moveMethod to 2 (Clicking pathfinder) // // NUMPAD3: Sets the moveMethod to 3 (An unusable silent pathfinder (supposed to draw)) // Below is the code for the script. Feel free to take it and change anything you'd like. If you've got any problems, join our discord server: discord.gg/WcDjD8w var cps=100, spamClicking = !1; function init(view, value, attr) { function Class() { attr.x = view.getUint16(value, true); value += 2; attr.y = view.getUint16(value, true); value += 2; attr.width = view.getUint16(value, true); value += 2; attr.height = view.getUint16(value, true); value += 2; } function done() { var color = view.getUint32(value, true).toString(16); for (; 6 > color.length;) { color = "0" + color; } value += 4; attr.color = "#" + color; } var name = view.getUint8(value); value += 1; attr.type = name; switch (name) { case 255: break; case 0: attr.x = view.getUint16(value, true); value += 2; attr.y = view.getUint16(value, true); value += 2; attr.size = view.getUint8(value); value += 1; attr.isCentered = !!view.getUint8(value); value += 1; name = read(view, value); attr.text = name[0]; value = name[1]; break; case 1: Class(); var py = !attr.color; done(); break; name = attr.x | 0; var y = attr.y | 0; var version = attr.width | 0; var h = attr.height | 0; if (py) { py = y; for (; py < y + h; ++py) { var info = name; for (; info < name + version; ++info) { ++tmp[info + 400 * py]; } } } break; case 2: Class(); attr.isBad = !!view.getUint8(value); value += 1; break; case 3: Class(); attr.count = view.getUint16(value, true); value += 2; done(); break; case 4: Class(); attr.count = view.getUint16(value, true); value += 2; done(); break; default: throw Error("Unknown object type " + name);; } return value; } function read(view, offset) { var optsData = ""; var lo = 0; var chunk = 0; for (; 0 != (chunk = view.getUint8(offset)); ++offset) { lo <<= 8; lo |= chunk; if (!(chunk & 128)) { optsData += String.fromCharCode(lo); lo = 0; } } if (0 != lo) { optsData += String.fromCharCode(lo); } return [optsData, offset + 1]; } function proc(data) { var view = new DataView(data.buffer), v, index, parts, x; if (view.getUint8(0) == 1) { var push = function(view, element) { return element + 2 + 4 * view.getUint16(element, true) }; index = view.getUint16(1, true); index = push(view, 3 + 8 * index); v = view.getUint16(index, true); index += 2; parts = 0; for (; parts < v; parts++) { x = view.getUint32(index, true); item = 0; a: for (; item < items.length; item++) { if (items[item].id == x) { items.splice(item, 1); break a; } } index += 4; } v = view.getUint16(index, true); index += 2; parts = 0; for (; parts < v; parts++) { a: { item = view.getUint32(index, true);x = 0; for (; x < items.length; x++) { if (items[x].id == item) { item = items[x]; break a; } } item = { id: item };items.push(item); } index += 4;index = init(view, index, item); } return; } items = []; head = [view.getUint16(1, true), view.getUint16(3, true)]; v = view.getUint16(5, true); index = 7; parts = 0; for (; parts < v; parts++) { item = {}; item.id = view.getUint32(index, true); index += 4; index = init(view, index, item); if (item.x > 0) item.x--, item.width++; if (item.y > 0) item.y--, item.height++; if (item.x + item.width < 400) item.width++; if (item.y + item.height < 300) item.height++; items.push(item); } } var avoidGreenArea = false function dos(head) { // Pathfinder var gridX = 400, gridY = 300; var grid = []; visit = []; for (var i = 0; i < gridY; i++) { grid[i] = []; visit[i] = []; for (var j = 0; j < gridX; j++) grid[i][j] = 0, visit[i][j] = 0; } items.forEach(function(d) { if ((d.type == 1) || (d.type == 2 && (d.isBad || avoidGreenArea))) for (var j = 0; j < d.height; j++) { if (d.y+j<=299) for (var i = 0; i < d.width; i++) { if (d.x+i<=399) grid[d.y + j][d.x + i] = 3 } } }); var bfs = [head], bfs2 = []; while (bfs.length) { bfs.forEach(function(dat) { var x = dat[0], y = dat[1]; if (grid[y][x] == 3) return; grid[y][x] = 3; for (var X = x + 1; X < gridX && !(grid[y][X] & 1); X++) { grid[y][X] |= 1; if (!visit[y][X]) { visit[y][X] = [x, y], bfs2.push([X, y]); } } for (var X = x - 1; X >= 0 && !(grid[y][X] & 1); X--) { grid[y][X] |= 1; if (!visit[y][X]) { visit[y][X] = [x, y], bfs2.push([X, y]); } } for (var Y = y + 1; Y < gridY && !(grid[Y][x] & 2); Y++) { grid[Y][x] |= 2; if (!visit[Y][x]) { visit[Y][x] = [x, y], bfs2.push([x, Y]); } } for (var Y = y - 1; Y >= 0 && !(grid[Y][x] & 2); Y--) { grid[Y][x] |= 2; if (!visit[Y][x]) { visit[Y][x] = [x, y], bfs2.push([x, Y]); } } }); bfs = bfs2; bfs2 = []; } } var tmp = WebSocket.prototype.send; WebSocket.prototype.send = function(x) { WebSocket.prototype.send = tmp; tmp = this; this.send = function() {}; var t2 = this.onmessage; this.onmessage = function(x) { var msg = new Uint8Array(x.data); if (msg[0] == 1 || msg[0] == 4) { proc(msg); } return t2.call(this, x) } } var ff = navigator.userAgent.indexOf("Chrome") == -1; var num_1 = prompt('1/2 WebSocket Location (where to connect. only change if you know what you\'re doing)', 'ws://157.245.226.69:2828'), num_2 = 0, num_3 = 1 * prompt('2/2 WebSocket Total (how many bots. only change if you know what you\'re doing.', 2); console.log(num_1); var pool = [], cursors = []; if (!isNaN(parseInt(num_3))) { alert('Result: Valid WebSocket total. Connecting bots...'); } else alert('Result: Invalid WebSocket total.'); if (!isNaN(parseInt(num_3))) { for (var i = 0; i < num_3; i++) { pool.push(new WebSocket(`${num_1}`)); // websocket } pool[num_3-1].onopen = function(x){alert('Result: All bots have been successfully connected.')}; } var position = []; canvas.onclick = function(e) { var xy = [(e.layerX - (ff ? canvas.offsetLeft : 0)) / 2 | 0, (e.layerY - (ff ? canvas.offsetTop : 0)) / 2 | 0]; position = [(e.layerX - (ff ? canvas.offsetLeft : 0)) / 2 | 0, (e.layerY - (ff ? canvas.offsetTop : 0)) / 2 | 0]; var mov = []; if (e.altKey) { if (cursors.length < 1) return; for (ii=0;ii= 39 && e.keyCode <= 41) || e.keyCode == 44 || e.keyCode == 46 || (e.keyCode >= 48 && e.keyCode <= 59 && e.location == 0) || (e.keyCode >= 65 && e.keyCode <= 90) || (e.keyCode >= 97 && e.keyCode <= 122) || e.keyCode == 32 || e.keyCode == 63) { message = message.concat(String.fromCharCode(e.keyCode)); return; } switch(e.keyCode) { case 13: drawWord(message.toLowerCase(), head[0], head[1]); message = ""; e.preventDefault(); break; default: return; } } var j=0; function drawLetter(a, x, y) { var letter = alphabet[a]; if (letter == null) return; var g = new ArrayBuffer(9), e = new DataView(g); for (var i = 0; i < letter.length; i++) { e.setUint8(0, 3); e.setUint16(1, x+alphabet[a][i][1]*fontSize, !0); e.setUint16(3, y+alphabet[a][i][0]*fontSize, !0); e.setUint16(5, x+alphabet[a][i][3]*fontSize, !0); e.setUint16(7, y+alphabet[a][i][2]*fontSize, !0); if (mainCursorWriting) { if (j==0) WebSocket.prototype.send.call(tmp, g); else if (botWriting) WebSocket.prototype.send.call(pool[j-1], g); else WebSocket.prototype.send.call(tmp, g); } else if (botWriting) { if (j!=0) WebSocket.prototype.send.call(pool[j-1], g); else if (mainCursorWriting) WebSocket.prototype.send.call(tmp, g); else WebSocket.prototype.send.call(pool[j-1], g); } j++; if (j>=(botWriting?pool.length:0)+(mainCursorWriting?1:0)) j=0; } } var timeout = 70, wordIndex = 0; function drawWord(s, x, y) { setTimeout(function () { drawLetter(s.charCodeAt(0), x, y); wordIndex++; if (s.length > 0) drawWord(s.substring(1, s.length), x+fontSize*3, y); else { wordIndex = 0; letterOffset = 0; } }, timeout); } document.onkeydown = hkd; document.onkeypress = hkp; var pathfinderDelay = 0; function move(x, mov, type = moveMethod, i = 0) { if (x.readyState != 1) return; if (i == 0 && x) x.rdy = 0; var buf = new ArrayBuffer(type==3?13:9), q = new DataView(buf); q.setUint8(0, type, 1); if (type!==3 && i= 249 && xy[0] <= 266) && (xy[1] >= 65 && xy[1] <= 80)) { // decrease pathfinder delay display.style.cursor = 'pointer'; } else if ((xy[0] >= 302 && xy[0] <= 318) && (xy[1] >= 65 && xy[1] <= 80)) { // increase pathfinder delay display.style.cursor = 'pointer'; } else if ((xy[0] >= 10 && xy[0] <= 133) && (xy[1] >= 122 && xy[1] <= 136)) { // return all bots display.style.cursor = 'pointer'; } else if ((xy[0] >= 450 && xy[0] <= 468) && (xy[1] >= 95 && xy[1] <= 107)) { // decrease text delay display.style.cursor = 'pointer'; } else if ((xy[0] >= 514 && xy[0] <= 532) && (xy[1] >= 95 && xy[1] <= 107)) { // increase text delay display.style.cursor = 'pointer'; } else if ((xy[0] >= 609 && xy[0] <= 701) && (xy[1] >= 82 && xy[1] <= 97)) { // toggle dark theme display.style.cursor = 'pointer'; } else if ((xy[0] >= 279 && xy[0] <= 326) && (xy[1] >= 82 && xy[1] <= 97)) { // toggle pathfinder mode display.style.cursor = 'pointer'; } else if ((xy[0] >= 280 && xy[0] <= 316) && (xy[1] >= 97 && xy[1] <= 107)) { // toggle avoid exits display.style.cursor = 'pointer'; } else display.style.cursor = 'auto'; } display.onmousedown = function(e) { // for like buttons and stuff var xy = [(e.layerX - (ff ? canvas.offsetLeft : 0)) | 0, (e.layerY - (ff ? canvas.offsetTop : 0)) | 0]; if ((xy[0] >= 249 && xy[0] <= 266) && (xy[1] >= 65 && xy[1] <= 80)) { // decrease pathfinder delay display.style.cursor = 'pointer'; pathfinderDelay -= 5; if (pathfinderDelay < 0) pathfinderDelay = 0; } else if ((xy[0] >= 302 && xy[0] <= 318) && (xy[1] >= 65 && xy[1] <= 80)) { // increase pathfinder delay display.style.cursor = 'pointer'; pathfinderDelay += 5; if (pathfinderDelay > 250) pathfinderDelay = 250; } else if ((xy[0] >= 10 && xy[0] <= 133) && (xy[1] >= 122 && xy[1] <= 136)) { // return all bots display.style.cursor = 'pointer'; returnAllBots(); } else if ((xy[0] >= 450 && xy[0] <= 468) && (xy[1] >= 95 && xy[1] <= 107)) { // decrease text delay display.style.cursor = 'pointer'; timeout -= 10; if (timeout < 25) timeout = 25; } else if ((xy[0] >= 514 && xy[0] <= 532) && (xy[1] >= 95 && xy[1] <= 107)) { // increase text delay display.style.cursor = 'pointer'; timeout += 10; if (timeout > 750) timeout = 750; } else if ((xy[0] >= 609 && xy[0] <= 701) && (xy[1] >= 82 && xy[1] <= 93)) { // toggle dark theme display.style.cursor = 'pointer'; darkTheme=!darkTheme; if (darkTheme == false) { document.body.style.backgroundColor = '#ffffff'; } else if (darkTheme == true) { document.body.style.backgroundColor = '#000000'; } } else if ((xy[0] >= 279 && xy[0] <= 326) && (xy[1] >= 82 && xy[1] <= 93)) { // toggle pathfinder mode display.style.cursor = 'pointer'; moveMethod==2?moveMethod=1:moveMethod=2; } else if ((xy[0] >= 280 && xy[0] <= 316) && (xy[1] >= 95 && xy[1] <= 107)) { // toggle avoid exits display.style.cursor = 'pointer'; avoidGreenArea=!avoidGreenArea } else display.style.cursor = 'auto'; } function updateDisplay() { dpl.save(); dpl.clearRect(0,0,800,192); // message display dpl.lineWidth = 2.5; dpl.font = '18px NovaSquare'; dpl.fillStyle = '#ffffff'; dpl.globalAlpha = 0.5; dpl.strokeText('Message: '+message,10,28); dpl.strokeRect(5,38,790,2.5); dpl.globalAlpha = 1; dpl.fillText('Message: '+message,10,28); dpl.fillRect(5,38,790,2.5); // title display dpl.font = '16px NovaSquare'; dpl.globalAlpha = 0.5; dpl.strokeText('Bots',10,58); dpl.strokeText('Pathfinder',210,58); dpl.strokeText('Text',410,58); dpl.strokeText('Miscellanious',610,58); dpl.globalAlpha = 1; dpl.fillText('Bots',10,58); dpl.fillText('Pathfinder',210,58); dpl.fillText('Text',410,58); dpl.fillText('Miscellanious',610,58); // bots display dpl.font = '12px NovaSquare'; dpl.globalAlpha = 0.5; dpl.strokeText('Ready: '+pool.length,10,78); dpl.strokeText('Deployed: '+cursors.length,10,92); dpl.strokeText('Disconnected: '+disconnected,10,106); dpl.strokeText('Connected: '+connected,10,120); dpl.strokeText('[Return All Deployed]',10,134); dpl.globalAlpha = 1; dpl.fillText('Ready: '+pool.length,10,78); dpl.fillText('Deployed: '+cursors.length,10,92); dpl.fillText('Disconnected: '+disconnected,10,106); dpl.fillText('Connected: '+connected,10,120); dpl.fillText('[Return All Deployed]',10,134); // pathfinder display dpl.font = '12px NovaSquare'; dpl.globalAlpha = 0.5; dpl.strokeText('Delay: [<] '+pathfinderDelay+'ms [>]',210,78); dpl.strokeText('Movement: '+(moveMethod==1?'[Normal]':moveMethod==2?'[Clicks]':'[?????]'),210,92); dpl.strokeText('Avoid exits: ['+avoidGreenArea+']',210,106); dpl.globalAlpha = 1; dpl.fillText('Delay: [<] '+pathfinderDelay+'ms [>]',210,78); dpl.fillText('Movement: '+(moveMethod==1?'[Normal]':moveMethod==2?'[Clicks]':'[?????]'),210,92); dpl.fillText('Avoid exits: ['+avoidGreenArea+']',210,106); // text display dpl.font = '12px NovaSquare'; dpl.globalAlpha = 0.5; dpl.strokeText('Font: '+fontType,410,78); dpl.strokeText('Size: '+fontSize,410,92); dpl.strokeText('Delay: [<] '+timeout+'ms [>]',410,106); dpl.globalAlpha = 1; dpl.fillText('Font: '+fontType,410,78); dpl.fillText('Size: '+fontSize,410,92); dpl.fillText('Delay: [<] '+timeout+'ms [>]',410,106); // misc display dpl.font = '12px NovaSquare'; dpl.globalAlpha = 0.5; dpl.strokeText('Spam Clicking Rate: '+cps+'cps',610,78); dpl.strokeText('[Change Theme]',610,92); dpl.globalAlpha = 1; dpl.fillText('Spam Clicking Rate: '+cps+'cps',610,78); dpl.fillText('[Change Theme]',610,92); // credit display dpl.font = '12px NovaSquare'; dpl.globalAlpha = 0.5; dpl.strokeText('Created by 8y8x',790 - dpl.measureText('Created by 8y8x').width,168); dpl.strokeText('Special thanks to cledis',790 - dpl.measureText('Special thanks to cledis').width,182); dpl.globalAlpha = 1; dpl.fillText('Created by 8y8x',790 - dpl.measureText('Created by 8y8x').width,168); dpl.fillText('Special thanks to cledis',790 - dpl.measureText('Special thanks to cledis').width,182); dpl.restore(); requestAnimationFrame(updateDisplay); } requestAnimationFrame(updateDisplay);