Closed rochadvdgit closed 5 years ago
/minebot look & /minebot pathfind will do exactly what you want. What problems are you experiencing? If you are not familiar with coding, dont worry, it is not hard at all. Just follow the steps on the wiki.
https://github.com/michaelzangl/minebot/wiki/Javascript-Examples
My problem is about how to use the comand /minebot look in the script. I tried minescript.strategy("minebot", "look", "10.5, 20,5 30.5") but it doesnt works.
Here is my code: function generateRunOnceStarategy(runFunc) { var runFunc = runFunc; var RunOneTickStrategy = Java.type("net.famzangl.minecraft.minebot.ai.strategy.RunOneTickStrategy"); var myRunOnce = Java.extend(RunOneTickStrategy, { singleRun: function(h) { runFunc(h); } }); return new myRunOnce(); } function pause(time) { minescript.doStrategy(minescript.strategy( "minebot", "pause", (time * 1) + "")); } function doLeftClick() { function doLeftClickHandler(aiHelper) { aiHelper.overrideAttack(); }
minescript.doStrategy(minescript.strategy("minebot", "pause", "2"));
minescript.doStrategy(generateRunOnceStarategy(doLeftClickHandler));
} function doRightClick() { function doRightClickHandler(aiHelper) { aiHelper.overrideUseItem(); }
minescript.doStrategy(minescript.strategy("minebot", "pause", "1"));
minescript.doStrategy(generateRunOnceStarategy(doRightClickHandler));
minescript.doStrategy(minescript.strategy("minebot", "pause", "1"));
} function home(name) { minescript.serverCommand("/home " + name); pause(10); } home("home1") pause(6) minescript.doStrategy(minescript.strategyWalkTowards(10, 30)) pause(2) minescript.strategy("minebot", "look", "10.5, 20.5 30.5") //here is my problem<<<< pause(2) doRightClick() home("home2") pause(6) doLeftClick()
The command in game is "/minebot look 10.5 20.5 30.5". You need to surround each argument with quotation marks in your script.
You had: minescript.strategy("minebot", "look", "10.5, 20,5 30.5")
But it should be: minescript.strategy("minebot", "look", "10.5", "20.5", "30.5");
Also, you should put it within minescript.doStrategy(); So your final line of code should look like this: minescript.doStrategy(minescript.strategy("minebot", "look", "10.5", "20.5", "30.5"));
Worked perfect! Thaks a lot!
There is a way to make it look to a specific block? Ex i wan to pathfind to x, z coordinate, then look to the x,y,z block and do a left click on it. How can I script it?