blocks= require('blocks'); function redHouse(argument) { this.box("2",10,1,10) .fwd(1) .right(1) .box0(blocks.wool.red,8,4,8) .up(4) .box("42",8,1,8) .down(4) .back(1) .left(1); }; Drone.extend(redHouse); function blueHouse(argument) { this.box("2",10,1,10) .fwd(1) .right(1) .box0(blocks.wool.blue,8,4,8) .up(4) .box("42",8,1,8) .down(4) .back(1) .left(1); }; Drone.extend(blueHouse); function yellowHouse(argument) {
.box("139",17,1,1) .down(8) .randEW() .fwd(1) .up(7) .box("5",17,1,3) .fwd(3) .down(7) .box("4",17,8,1) .up(8) .box("139",17,1,1) .down(8) .randEW() .move("EWroot"); } Drone.extend(wallEW); function randEW() { for (var i = 0; i < 20; i++) { var xCord = Math.floor(Math.random()*15); var yCord = Math.floor(Math.random()*7); this.chkpt("reset") .up(1) .right(1) .right(xCord) .up(yCord) .box0("48") .move("reset"); }; }; Drone.extend(randEW);
// this.move('arena').up(1).left(6).back(6); // this.cylinder0(blocks.quartz, radius + 6, 4); // this.move('arena').up(1).left(7).back(7); // this.cylinder0(blocks.quartz, radius + 7, 1); // this.move('arena').up(2).left(7).back(7); // this.cylinder0(blocks.glowstone, radius + 7, 1); // this.move('arena').up(3).left(7).back(7); // this.cylinder0(blocks.glass, radius + 7, 3); // this.move('arena').up(1).left(8).back(7); // this.cylinder0(blocks.quartz, radius + 8, 6); // this.move('arena').up(1).left(9).back(8); // this.cylinder0(blocks.quartz, radius + 9, 7); this.move('arena').up(1); } function createRing(d, radius, moveSize, blockType, height, moveUp) { if (typeof height == 'undefined') { height = 1; } if (typeof moveUp == 'undefined') { moveUp = 1; } d.move('arena').up(moveUp).left(moveSize).back(moveSize); d.cylinder0(blockType, radius + moveSize, height); } var Drone = require('drone'); Drone.extend(spleefArena);
'use strict'; var Drone= require('drone'), blocks= require('blocks'); function house(){ this.chkpt("houseStart") .up(1) .box0('5',9,4,9) .up(3) .right(1) .down(3) .right(1) .door() .left(2) .up(4) .box("5",9,1,9) .down(4) .right(1) .fwd(8) .ladder(6) .back(7) .down(5) .stairs(15) .move("houseStart"); }; Drone.extend(house)
blocks = require('blocks'); function battlement( sections ) { var i ; if (typeof sections == 'undefined'){ sections = 5; } for (i = 0; i < sections; i++ ){ this .up(1) .box(blocks.brick.stone,10,10,1) .right(3) .door() .left(3) .fwd(4) .box(blocks.brick.stone,10,10,1) .back(3) .up(8) .box(blocks.oak,10,1,3) .down(8) .right(3) .fwd(3) .ladder(10) .back(4) .right(7) .down(1) } }; Drone.extend( battlement );
.fwd(Math.ceil(columnBaseSize/2)); for (var i=1;i<=(columnSideCount*2)-1;i++) { this.back() .box(139).fwd().box(139).fwd().box(139) .back(); this.fwd(Math.ceil((columnBaseSize + columnSpacing)/2)); } // -------------------------------------- // FUN // -------------------------------------- if ( columnRadius > 1 ) { // sign this.move('baseStartPoint') .up(3) .right(Math.ceil(columnBaseSize/2)) .fwd(columnBaseSize-3) .wallsign(['You can','go up']) // ladder .right() .box(65,1,columnHeight+2,1); } this.move('greekTemple'); } Drone.extend( greekTemple );
function myskyscraper( floors,nr ) { var i ; var x; if ( typeof floors == 'undefined' ) { floors = 10; } // bookmark the drone's position so it can return there later for (x =0;x < nr;x++){ this.chkpt('myskyscraper'); for ( i = 0; i < floors; i++ ) { this .box(61,20,1,20) //70 = oven .up() .box0(103,20,3,20) //103 = melon .up(3); } this.box('35:6',20,1,20) //70 = oven this.move('myskyscraper'); this.left(40); } // return the drone to where it started }; var Drone = require('drone'); Drone.extend( myskyscraper );
// /js torchblock(blocks.sandstone) // // [4] to place a repeater on a new block // /js repeaterblock(blocks.sandstone) // // [5] To create a long redstone wire (with necessary repeaters, powererd by a single torch) // /js wirestraight(blocks.sandstone, distance) // // [6] To create a 'road' with redstone torches and wire lining each side // /js redstoneroad(blocks.stone, blocks.sandstone, 25) Drone.extend('wireblock',function(blockType) { this.chkpt('wireblock') .box(blockType,1,2,1) // 2 blocks tall, top block will be wire dropped on lower .up(); this.world.getBlockAt(this.x,this.y,this.z).setTypeId(55); //apply wire return this.move('wireblock'); }); Drone.extend('wire',function () { this.chkpt('wire') .up(); this.world.getBlockAt(this.x,this.y,this.z).setTypeId(55); // apply wire return this.move('wire'); });
blocks = require('blocks') sounds = require('sounds'); function bt() { this.up(1) .box0("98",10,4,6) .right(2) .door() .right(5) .door() .fwd(1) .left(4) .down(1) .box("5",7,1,4) .right(1) .up(1) .fwd(4) .ladder(4) .right(3) .ladder(4) .back(1) .left(1) .box("145",1,1,1) .left(1) .box("61",1,1,1) .left(1) .box(blocks.furnace,1,1,1); }; Drone.extend(bt)
.right(); } // // add door // torch = blocks.torch + ':' + Drone.PLAYER_TORCH_FACING[this.dir]; this .move('fort') .right( ( side / 2 ) - 1 ) .door2() // double doors .back() .left() .up() .box( torch ) // left torch .right( 3 ) .box( torch ); // right torch // // add ladder up to battlements // this .move('fort') .right( ( side / 2 ) - 3 ) .fwd() // move inside fort .turn( 2 ) .box( blocks.air, 1, height - 1, 1) .ladder( height - 1 ) .move( 'fort' ); } Drone.extend(fort);
lineLength--; } this.move('greekRoof') .fwd(1); var a = lineDrawData(midPoint,height), lineLength = midPoint-0.5; for (var i=0;i<a.length;i++) { if ( a[i] == -1 ) { this.up() .box(1,(lineLength*2)+1,1,1); // pediment } // roof top this.back() .box(b,1,1,depth+2) .right((lineLength*2)+1) .box(b,1,1,depth+2) .left((lineLength*2)+1) .fwd() .right(); lineLength--; } this.move('greekRoof'); this.box0(b,width,1,depth+2); // top of frieze } Drone.extend( greekRoof );
// rollercoaster.js // This code is a CanaryMod/ScripCraft port of Mikael Jönsson's code published on http://vaxjo.coderdojo.se/scriptcraft-rollercoaster/ // Tested with CanaryMod-1.2.0 and ScriptCraft 3.1.4, Java 8 var Drone = require('drone'); function rail_up(block_type, length) { var drone = this; drone.box(block_type, 1, 1, length); drone.up(); drone.box(blocks.rail, 1, 1, length); drone.fwd(length); } Drone.extend(rail_up); // Testkör i chatten: // js rail_up(blocks.stone, 5) function rail_fwd(block_type, length) { var drone = this; drone.rail_up(block_type, length); drone.down(); } Drone.extend(rail_fwd); // Testkör i chatten: // js rail_fwd(blocks.stone, 5) function rail_down(block_type, length) { var drone = this; drone.down();
echo(player.name + ' Is Now a Royal Guard of the Empire!') } else if (color == 3) { echo(player.name + ' Is Now The Emperor! All Hail' + player.name) } else if (color == 4) { echo(player.name + ' Is Now The Empress! All Hail' + player.name) } else if (color == 10) { echo(player.name + ' Joined The Hive!') } else if (color == 11) { echo(player.name + ' Is Now a Broodguardian!') } else if (color == 12) { echo(player.name + ' Is Now The Broodlord!') } else if (color == 13) { echo(player.name + ' Is Now The BroodQueen!') } else if (color == 100) { echo(player.name + ' Joined The Guardians!') } else if (color == 1000) { echo(player.name + ' Joined The Tribe!') } } var Drone = require('drone'); Drone.extend(joinTeam);
d.maze(); ``` ![maze example](img/mazeex1.png) ***/ var Drone = require('drone'), blocks = require('blocks'); // User-facing code starts here // Example: Try /js maze(5,7) Drone.extend( function maze( width, length ) { if (typeof width === 'undefined'){ width = 10; } if (typeof length === 'undefined'){ length = 10; } var m = maze_make(width, length); if (m.x > 0 && m.y > 0) { maze_draw(maze_display(m), this); } } ); // // Implementation // function maze_make(x,y) { var n=x*y-1; if (n<0) { console.log ("illegal maze dimensions"); return ({x: 0, y: 0}); } var horiz=[];
drone.fwd(); // Create the path to the target drone.box(blocks.iron, 3, 1, leng - 1); drone.fwd(leng - 1); drone.left(2); drone.up(1); // Now let's make the target. It's a bit more involved // Start by listing which colors it should consist of colors = [blocks.wool.yellow, blocks.wool.red, blocks.wool.white, blocks.wool.black]; for (i = 0; i < colors.length; i += 1) { bm = drone.getBlockIdAndMeta(colors[i]); drone.arc({ blockType: bm[0], meta: bm[1], radius: 3 - i, strokeWidth: 1, quadrants: {topright: true, topleft: true, bottomright: true, bottomleft: true}, orientation: 'vertical' }).right().up(); } } Drone.extend(target); // Test: CanaryMod 1.2 (Minecraft 1.8), ScriptCraft 3.1.3
this.box(blocks.tnt, 1, 1, 1); this.move('sky'); this.left(1); this.box(blocks.tnt, 1, 1, 1); this.move('sky'); this.fwd(1); this.box(blocks.tnt, 1, 1, 1); this.move('sky'); this.back(1); this.box(blocks.tnt, 1, 1, 1); this.move('sky'); this.right(1); this.box(blocks.tnt, 1, 1, 1); this.move('sky'); this.box(blocks.redstone, 1, 1, 1); this.move('ground'); this.move('sky'); this.move('ground'); this.move('sky'); this.move('ground'); this.move('sky'); this.move('ground'); this.move('sky'); this.move('ground'); this.move('sky'); this.box(blocks.air, 1, 1, 1); this.move('ground') } var Drone = require('drone'); Drone.extend(bombDrop);