Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * -1 = pass
- * 0 = white
- * 1 = lgray
- * 2 = dgray
- * 3 = black
- * 4 = lpink
- * 5 = red
- * 6 = orange
- * 7 = brown
- * 8 = yellow
- * 9 = lgreen
- * 10 = green
- * 11 = cyan
- * 12 = blue
- * 13 = hard blue
- * 14 = light purple/pink
- * 15 = purple
- */
- var colors = [
- /*
- 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 */
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 3, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
- 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 3, 3, 3, 9,10, 10,10, 9, 9, 10, 9, 9,10, 9,10, 9, 9,
- 9, 9, 9, 3, 9, 9, 9, 9, 9, 9,10, 9, 9, 9, 3, 3, 9, 3, 9,10, 9, 9, 9,10, 9,10, 9,10, 9,10, 9, 9,
- 9, 9, 9, 3, 3, 3, 9, 9, 9, 9, 9, 9, 9, 3, 3, 6, 6, 3, 9,10, 10,10, 9,10, 9,10, 9, 9, 10, 9, 9, 9,
- 9, 9, 9, 3, 3, 3, 3, 3, 9, 9, 9, 9, 3, 3, 6, 6, 0, 3, 9,10, 9, 9, 9,10, 9,10, 9,10, 9,10, 9, 9,
- 9,10, 9, 3, 6, 6, 3, 3, 3, 3, 3, 3, 3, 6, 6, 0, 0, 3, 9,10, 9, 9, 9, 9, 10, 9, 9,10, 9,10, 9, 9,
- 9, 9, 9, 3, 6, 0, 6, 6, 3, 6, 6, 6, 6, 6, 6, 0, 0, 3, 9, 9, 9, 9, 9, 9, 9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, -1,-1,-1,-1,
- 9, 9, 9, 9, 9, 9,10,10, 10,10,10,10, 10,10,10,10, 10,10,10,10, 10,10,10,10, 9, 9,-1,-1, -1,-1,-1,-1,
- 9, 9, 9, 9, 9, 9, 9, 9, 10,10,10,10, 10,10,10,10, 10,10,10,10, 10,10, 9, 9, 9,-1,-1,-1, -1,-1,-1,-1,
- ];
- var colorsABGR = [];
- var fox = {
- x: 31,
- y: 68,
- width: 32,
- height: 31
- };
- var placed = 0;
- // hooks
- var client;
- var canvasse;
- var jQuery;
- var test = 0;
- r.placeModule("fox", function(e){
- client = e("client");
- canvasse = e("canvasse");
- jQuery = e("jQuery");
- for(var i=0; i<client.palette.length; i++){
- colorsABGR[i] = client.getPaletteColorABGR(i);
- }
- // Start
- if(!test){
- attempt();
- } else {
- drawTestFox();
- }
- });
- function attempt(){
- var toWait = client.getCooldownTimeRemaining();
- if(toWait === 0){
- for(var i=0; i<colors.length; i++){
- if(colors[i] === -1){
- continue;
- }
- var targetPoint = getPoint(i);
- var pixelColor = getPixel(targetPoint.x, targetPoint.y);
- if(pixelColor !== colorsABGR[colors[i]]){
- client.setColor(colors[i]);
- client.drawTile(targetPoint.x, targetPoint.y);
- console.log('Pixel Placed at: (' + targetPoint.x + ',' + targetPoint.y + ')');
- break;
- }
- }
- }
- setTimeout(attempt, toWait + Math.round(Math.random() * 1500));
- }
- function drawTestFox(){
- for(var i=0; i<colors.length; i++){
- if(colors[i] === -1){
- continue;
- }
- var targetPoint = getPoint(i);
- canvasse.drawTileAt(targetPoint.x, targetPoint.y, colorsABGR[colors[i]]);
- }
- }
- function getPoint(i){
- var x = i % fox.width;
- return {
- x: fox.x + x,
- y: fox.y + (i - x) / fox.width - fox.height
- };
- }
- function getPixel(x, y){
- return canvasse.writeBuffer[canvasse.getIndexFromCoords(x, y)];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement