Union Client Scripts

Forum for alternative clients, mods & discussions on the same.

Moderator: Phades

User avatar
Arcanist
Posts: 2664
Joined: Mon Mar 19, 2012 2:01 pm

Re: Union Client Scripts

Post by Arcanist »

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).
Zarxes
Posts: 143
Joined: Mon Feb 21, 2011 6:06 pm

Re: Union Client Scripts

Post by Zarxes »

Hey Arcanist, there seems to be also a Problem with the autobutcher bot. He does not start butchering at the beginning and after he dumps the meat (skin is already removed). He does unload it into cupboards though. So the script kinda works if you klick butcher manually.
User avatar
Arcanist
Posts: 2664
Joined: Mon Mar 19, 2012 2:01 pm

Re: Union Client Scripts

Post by Arcanist »

The carcass must be in the centre of the tile.
Zarxes
Posts: 143
Joined: Mon Feb 21, 2011 6:06 pm

Re: Union Client Scripts

Post by Zarxes »

Thanks for the answer, it works now. I really could have come up with that solution by myself.
User avatar
Arcanist
Posts: 2664
Joined: Mon Mar 19, 2012 2:01 pm

Re: Union Client Scripts

Post by Arcanist »

Code: Select all

//#! 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();
Takes fibre from ground, puts linen into banner signs
Zarxes
Posts: 143
Joined: Mon Feb 21, 2011 6:06 pm

Re: Union Client Scripts

Post by Zarxes »

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)
User avatar
Mernil
Posts: 133
Joined: Tue Jul 29, 2014 9:54 pm

Re: Union Client Scripts

Post by Mernil »

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)
You may have some luck replacing it with

Code: Select all

Math.random(); 
This function returns a number between 0 and 1.
Zarxes
Posts: 143
Joined: Mon Feb 21, 2011 6:06 pm

Re: Union Client Scripts

Post by Zarxes »

f.write("//#! uniq = "+uniqName[modeNum]+Random(10000000, 100000000)+"\n");
i think that might be the line which is causing these problems

gonna try this then:
f.write("//#! uniq = "+uniqName[modeNum]+Math.Random(10000000, 100000000)+"\n");


Edit: Nice one, that seems to have fixed it!

Edit2:
A new Problem appeared when trying to start the resulting script:
[JSBot ScriptSyntax Error] ReferenceError: "CollectMount2" is not defined. (dere
sre - Mountain#61)
User avatar
Lordtimo
Posts: 437
Joined: Wed Jun 01, 2011 12:00 pm

Re: Union Client Scripts

Post by Lordtimo »

Open Mountain bot, and show line 61.
Zarxes
Posts: 143
Joined: Mon Feb 21, 2011 6:06 pm

Re: Union Client Scripts

Post by Zarxes »

That should be the line: CollectMount2(accName, charName, collectCurios, dropCurios, dropQuality, startPos, waypoints);

(I just copied a working version of a friend in the meantime)

Return to “The Wizards' Tower”