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, 3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3,-1,-1,-1,-1,
- -1,-1,-1,-1,-1, 3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3,-1,-1,-1,-1,-1,
- -1,-1,-1,-1,-1,-1,-1, 3, 3, 3, 3, 3, 3, 3, 3, 3,-1,-1,-1,-1,-1,-1,-1
- ];
- var colorsABGR = [];
- var rpi = {
- x: 886,
- y: 520,
- width: 23,
- height: 31
- };
- var placed = 0;
- // hooks
- var client;
- var canvasse;
- var jQuery;
- var test = 0;
- r.placeModule("Rpi", 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 {
- drawTestRPI();
- }
- });
- 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 drawTestRPI(){
- 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 % rpi.width;
- return {
- x: rpi.x + x,
- y: rpi.y + (i - x) / rpi.width
- };
- }
- function getPixel(x, y){
- return canvasse.writeBuffer[canvasse.getIndexFromCoords(x, y)];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement