I was going to use some functions from Talon's API, but I didn't get around to it, so don't worry about that file.
As I said, I'll find that function and add it to the api when I get home (I'm at polytech at the moment).
Moderator: Phades
//#! name = Banner
//#! tooltip = Take fibre from ground, and make into banners
//#! uniq = arcanist_banner
//#! icon = gfx/invobjs/flaxfibre
include("jBotAPI");
include("jBotAPIArcanist");
include("pathfinder");
function main() {
var signs = selectMultiple("sign", "Banner Signs");
while(1){
var hemp = jFindObjectByName("flaxfibre", 50);
while (checkInventory().freeSlots() > 1 && hemp != null) { // picking up fibre
var hemp = jFindObjectByName("flaxfibre", 50);
if (!jIsPathFree(hemp.position()) && jMyCoords().dist(hemp.position()) > 11) jPFMoveOffset_LX(hemp.position(), 0);
jDoClick(hemp.getID(), 3, 0);
jWaitMove(1000);
jSleep(100);
if (jGetDraggingItem()) {
jDropObject(0);
}
var hemp = jFindObjectByName("flaxfibre", 15);
}
var loom = findObjectbyBLOB("loom", 1, 1, 1, 1, 1);
while (loom == null){
if (!jFindObjectByName("loom", 50)) {
jToConsole("Loom not found");
jExit();
}
jSleep(1000);
var loom = findObjectbyBLOB("loom", 1, 1, 1, 1, 1);
}
jSendDoubleAction("craft", "linencloth");
var craftno = toInt(checkInventory().getItems("flaxfibre").length / 5);
if (craftno > 0) {
jPFMoveOffset_LX(loom.position(), 2);
while (jIsMoving() || jMyCoords().dist(loom.position()) > 25) jSleep(500);
var player_pos = jMyCoords();
jDoClick(loom.getID(),3,0);
jSleep(1000);
var count = 0;
while (checkInventory().getItems("linencloth").length < craftno) { // crafting
jCraftItem(true);
jWaitProgress(actionTimeout);
jSleep(500);
dropFromCursor(1);
drinkWater(30);
count++;
if (count > 2 && checkInventory().getItems("linencloth").length < 1) { // if bot has not found loom
jDoClick(loom.getID(),3,0);
jSleep(5000);
}
}
jAbsClick(player_pos, 1, 0);
jSleep(1000);
putItemsToSigns ("linen", signs, "Village Banner", 1, 1);
}
}
}
main();
Zarxes wrote:I got a problem with the foragebot maker. Anyone got a clue what might cause this error message?
[JSBot ScriptSyntax Error] ReferenceError: "Random" is not defined. (Foragebotma
ker.jbot#170)
Math.random();
Users browsing this forum: Claude [Bot] and 0 guests