Ok after successfully stacking blocks or making buildings using ScriptCraft one-line command, now our kids programming class start to create something like this using functions:
There are some tricks to make ScriptCraft functions work. First, you have to save it in the right folder: plugins/drone/contrib/ . Second, you have to make sure that there is no errors. CanaryMod server is very helpful at pointing where the problems occur:
CanaryMod also make it possible to set up everything about the game. To practice with buildings, this is the setting should be set:
This will give you a flat empty world. If you want to start a new empty world, or apply new settings, just delete the world folder. Next time you start up CanaryMod server, it will generate a new world for you like this:
This is an example of ScriptCraft function to create a skycraper:
var Drone = require('../drone').Drone;
var blocks = require('blocks');
function skyscraper( floors )
{
echo(floors);
this.chkpt('skyscraper');
for (var i = 0; i < floors; i++)
{
this.box(blocks.iron,20,1,20).up().box0(blocks.glass_pane,20,3,30).up(3);
}
this.move('skyscraper');
};
Drone.extend(skyscraper);
just type it on the command line:
and you’ll get this:
this is another simpler function, just for stacking blocks:
var Drone = require('../drone').Drone;
var blocks = require('blocks');
function tumpuk( tingkat ) {
echo(tingkat);
this.chkpt('tumpuk');
for (var i = 0; i < tingkat; i++){
this.up(1).box0('35:6',1, 1, 1);
}
this.move('tumpuk');
};
Drone.extend(tumpuk);
type it on the command line:
and you will get this:
If you modify the code and want to re-run it on Minecraft, just type ‘reload’ or /js refresh() on the command prompt.
Next time we will learn to build awesome buildings like pyramid or maybe rocket launcher! 😉
How do you created, in the post, this cool code section with colored background and scroll bar?
LikeLiked by 1 person
hello kixty9 thx for reblogging. i typed the codes in between pre and code tags.
LikeLike
Thanks for the information. I started to use these tags on the sourcecodes of my blog about informatics.
LikeLiked by 1 person
ok kixty9 please let me whether it works or not
LikeLike
Today by chance I found a better way to post sourcecodes, as you can see here: https://en.support.wordpress.com/code/posting-source-code/. I will use this setting now. You can use it, just can’t use the “language” parameter, because the ScriptCraft isn’t supported. You can see my programs (in portuguese) on this page: https://hypervolution.wordpress.com/category/programas/
LikeLiked by 1 person
wow thanks! yes the “language” parameter and it didnt work 😦
LikeLike
Reblogged this on Minecraft 18.
LikeLiked by 1 person