Union Client Scripts

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

Moderator: Phades

User avatar
borka
Posts: 9965
Joined: Thu Feb 03, 2011 7:47 pm
Location: World of Sprucecap

Re: Union Client Scripts

Post by borka »

why does the CMD window shows gfx/kritter/cow/s ? Does it point to s.res ?!?


what happens with

Code: Select all

objs = jGetObjects (5000, jCoord (0,0) , 'gfx/kritter/cow/cow) ;
or

Code: Select all

objs = jGetObjects (5000, jCoord (0,0) , 'gfx/kritter/cow/calf) ;
?!?
Avatar by SacreDoom
Java 8 - manually downloads - good to check for actual versions url here:
viewtopic.php?f=42&t=40331
Remember what the dormouse said: Feed your head Feed your head
tixcu
Posts: 4
Joined: Sat Sep 20, 2014 7:14 am

Re: Union Client Scripts

Post by tixcu »

Is anyone have a working version of susavaqe pearl bot ?
User avatar
SovietUnion
Posts: 266
Joined: Mon Mar 12, 2012 4:42 am
Location: Brno, Czech Republic

Re: Union Client Scripts

Post by SovietUnion »

I didn't find it anywhere in this forum, so just for reference:

to call a Ctrl + left click (disembarque a boat for example), use: jAbsClick(jMyCoords(), 1, 2);

The first parameter is the position where to click, the second one is the click type: 1 being left click, 3 being right click. The third param is the action added to the click. 2 is "press Ctrl key".

Does any of you guys have a full list of parameters and what they do? Trial and error is a bit time consuming. THX
Notable characters: Cpt. Danko, Kng. Danko

LS of MorningWood (as of W7)
North Star market owner (W11)
King of North Star Kingdom & Market (W12)
LS of MorningWood (W13), quit early cause reasons
Open village of North Star (W14)

"Not really. But meh.. who needs proper communication anyways"
User avatar
Mernil
Posts: 133
Joined: Tue Jul 29, 2014 9:54 pm

Re: Union Client Scripts

Post by Mernil »

SovietUnion wrote:I didn't find it anywhere in this forum, so just for reference:

to call a Ctrl + left click (disembarque a boat for example), use: jAbsClick(jMyCoords(), 1, 2);

The first parameter is the position where to click, the second one is the click type: 1 being left click, 3 being right click. The third param is the action added to the click. 2 is "press Ctrl key".

Does any of you guys have a full list of parameters and what they do? Trial and error is a bit time consuming. THX
Everything is in src/union/jsbot/*

About jAbsClick for instance (Doc translated with google translate):

Code: Select all

/ **
* Sent to the server -clicking on the map to the specified coordinates
* (Absolute , in the points card )
*
*param Coord
* coordinates
*param Btn
* Mouse button (1 - left , 3 - right )
*param Mod
* Keyboard modifier (1 - shift; 2 - ctrl; 4 - alt; 8 -
* Win)
* /
	public static void jAbsClick(Object coord, int btn, int mod) {
		Coord c = unWrapCoord(coord);
		JSBotUtils.mapAbsClick(c.x, c.y, btn, mod);
	}
TheMasterWolf
Posts: 124
Joined: Tue Jul 02, 2013 6:07 pm

Re: Union Client Scripts

Post by TheMasterWolf »

Anyone have a working farming bot and instructions on how to work it?
The Master of All Dictators!! Anger me and you will be sent to the chambers!
User avatar
Mernil
Posts: 133
Joined: Tue Jul 29, 2014 9:54 pm

Re: Union Client Scripts

Post by Mernil »

TheMasterWolf wrote:Anyone have a working farming bot and instructions on how to work it?
Sure, I do have it all.

Farming, seed sorting, replanting, resting on nearby chair, stacking extra seeds/carrots in a LC...
You name it.

PM me for details.

Oh, otherwise there are some common scripts, you might find them somewhere, they might not work... have fun with these.
User avatar
Arcanist
Posts: 2664
Joined: Mon Mar 19, 2012 2:01 pm

Re: Union Client Scripts

Post by Arcanist »

borka wrote:why does the CMD window shows gfx/kritter/cow/s ? Does it point to s.res ?!?


what happens with

Code: Select all

objs = jGetObjects (5000, jCoord (0,0) , 'gfx/kritter/cow/cow) ;
or

Code: Select all

objs = jGetObjects (5000, jCoord (0,0) , 'gfx/kritter/cow/calf) ;
?!?

If you look for cow/cow or cow/calf, or any other animal res, then it returns nothing.

If you apply ctrl + d, and hover over an animal, it shows the res for animal/s.res
It seems that the jbot engine can't see the rest of the animal, even though visually the user can.
It's weird.
Ocerion
Posts: 113
Joined: Tue Feb 08, 2011 6:53 am

Re: Union Client Scripts

Post by Ocerion »

Anyone happen to have a script that works like the trough filling one, except fills chicken coops? Obnoxiously I seem to be having the worst luck modifying the troughfilling one to work for it. Doesn't help that I have no idea what I'm doing I suppose.
User avatar
Arcanist
Posts: 2664
Joined: Mon Mar 19, 2012 2:01 pm

Re: Union Client Scripts

Post by Arcanist »

Ocerion wrote:Anyone happen to have a script that works like the trough filling one, except fills chicken coops? Obnoxiously I seem to be having the worst luck modifying the troughfilling one to work for it. Doesn't help that I have no idea what I'm doing I suppose.

What exactly are you having trouble with?


This will tell you exactly what is in selected cupboards.
Select none to select all.

Code: Select all

//#! name = Informa
//#! uniq = arcanist_informant
//#! icon = gfx/invobjs/tinyabacus
// Globals
include("jBotAPITalon");
include("jBotAPIArcanist");
include("jBotAPI");
include("pathfinder");

var cupboards = selectInRect("cupboard", 64, "Select in cupboards");
if (cupboards.length < 1) 
	var cupboards = jGetObjects(40, jCoord(0, 0), ["terobjs/cupboard"]);

var array1 = [] // Item resnames
var array2 = [] // Item counts

function main(){
	for (var key in cupboards){
	
		openCupboard(cupboards, key);
		
	if (jHaveWindow("Cupboard"))	
		makelist();
	}
	//output
	
	do {
        var swapped = false;

        for (var i = 0; i < (array2.length - 1); i++) {
            if ( array2[i] < array2[i+1] ) {
                var swap = array2[i+1];
                array2[i+1] = array2[i];
                array2[i] = swap;
				
				var swap = array1[i+1];
				array1[i+1] = array1[i];
				array1[i] = swap;

                var swapped = true;
            }
        }
    } while (swapped);
	
	for ( var key in array1){
		jPrint(array2[key] + "      " + array1[key]);
	}
}

function makelist() {
	if (jHaveWindow("Cupboard")){
		var objects = jGetWindow("Cupboard").getInventories()[0].getItems("invobjs");
		
		for (var j = 0; j < objects.length; j++){
		found = false;
			var resname = objects[j].resName();
			for (var q = 0; q < array1.length; q++){
				if (resname == array1[q]){
					array2[q]++;
					found = true;
				}
				
			}
			if (!found){ // Need to add it to the arrays
				array1.push(resname);
				array2.push(1);
			}
		}
	}
}

main();
uses functions:

Code: Select all

function selectInRect(resname, blob, title) {
	var offs = jCoord(0, 0);
	var size = jCoord(1, 1);
	var confirm = false;
	jDrawGroundRect(offs, size);
	var blist = ["West", "East", "North", "South", "Inc width", "Inc height", "Dec width", "Dec height", "Confirm", "Exit"];
	var selectWindow = jGUIWindow(jCoord(250, 250), jCoord(105, blist.length * 25 + 15), "Area");
	var label = jGUILabel(selectWindow, jCoord(5, 5), title);
	for(var i = 0; i < blist.length; i++)
		jGUIButton(selectWindow, jCoord(5, 25 + i*25),  100, blist[i]);
	selectWindow.toggleCloseButton();
	var btext = "";
	while(btext != "Exit"){
		btext = selectWindow.waitButtonClick();
		if(btext == blist[0]) offs.x--;
		if(btext == blist[1]) offs.x++;
		if(btext == blist[2]) offs.y--;
		if(btext == blist[3]) offs.y++;
		if(btext == blist[4]) size.x++;
		if(btext == blist[5]) size.y++;
		if(btext == blist[6]) if(size.x > 1) size.x--;
		if(btext == blist[7]) if(size.y > 1) size.y--;
		if(btext == blist[8]) {confirm = true; break;}
		jDrawGroundRect(offs, size);
	}
	selectWindow.destroy();
	jDrawGroundRect(offs, jCoord(0, 0));
	var startCoord = jMyCoords().add(offs.mul(11));
	var fieldSize = size;
	return jGetObjectsInRect(startCoord, fieldSize, blob, resname);
}


function openCupboard(cupboard, number){
	while(jHaveWindow("Cupboard")) {
		jAbsClick(jMyCoords(), 1, 0);
		if (jHaveWindow("Cupboard")) jSleep(500);
	}
	while(!jHaveWindow("Cupboard")) {
				jPFMoveOffset_LX(cupboard[number].position(), 1);
				waitPFEndMove();
				jSleep(500);
				jDoClick(cupboard[number].getID(), 3, 0);
				jSleep(1000);
				}
				 jSleep(100);
				jToConsole("Walked to Cupboard Number " + number);
				return number;
}
User avatar
APXEOLOG
Posts: 1300
Joined: Fri Apr 23, 2010 7:58 am
Location: Somewhere on Earth

Re: Union Client Scripts

Post by APXEOLOG »

Arcanist wrote: If you apply ctrl + d, and hover over an animal, it shows the res for animal/s.res
It seems that the jbot engine can't see the rest of the animal, even though visually the user can.
It's weird.
There problem is that some animals (like chicken and player bodies) drown as Layered object (it means thay have base resource and nubmer of the sublayers), while another drown as sprites. I didn't remember an problems with cows, maybe loftar changed their resources?
W10 Meme Plot | W9 Mantis Garden | W8 Core | W7 Ofir | W6 the City of Dis | W5 Vitterstad | W4 A.D. | W3 Mirniy
jorb wrote:All your characters will be deleted, and I will level every village any one of them were ever members of.

Return to “The Wizards' Tower”