Union Client Scripts

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

Moderator: Phades

User avatar
APXEOLOG
Posts: 1300
Joined: Fri Apr 23, 2010 7:58 am
Location: Somewhere on Earth

Re: Union Client Scripts

Post by APXEOLOG »

Bramson wrote:Working on a script where I want to pull things out of a build site..

jGetBuildValues("signname",1).charAt(0)

I can determine how much left needed to put in, but what about pulling out?

What code would make it so you can pull stuff out instantly with transferSuchAll();

Thanks!
1.
// Village Banner sign example
var values = jGetBuildValues("Village Banner", 1); // Get full string
var parts = values.split("/"); // Split it
var left = parseInt(parts[0]); // Convert string to int with native js parseInt function
var placed = parseInt(parts[1]);
var builded = parseInt(parts[2]);
2. There's no transferSuchAll for signs (i didn't implement it at least, maybe Kerrigan), you can just transfer items in the loop.
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.
mvgulik
Posts: 4101
Joined: Fri May 21, 2010 2:29 am

Re: Union Client Scripts

Post by mvgulik »

...
Last edited by mvgulik on Wed Dec 25, 2013 5:34 pm, edited 1 time in total.
robinx
Posts: 107
Joined: Sat Jul 16, 2011 2:40 pm

Re: Union Client Scripts

Post by robinx »

does anyone have for sale a bot that fills cupboards mulberry leaves?
Image
User avatar
Investor
Posts: 28
Joined: Mon Jan 09, 2012 2:18 pm

Re: Union Client Scripts

Post by Investor »

I have a question. What value represents the "jSleep ()". Is it a tics in the game or a millisecond? If this is tics in the game, how many ticks equivalent to one second?
Image
User avatar
NOOBY93
Posts: 6528
Joined: Tue Aug 09, 2011 1:12 pm

Re: Union Client Scripts

Post by NOOBY93 »

Investor wrote:I have a question. What value represents the "jSleep ()". Is it a tics in the game or a millisecond? If this is tics in the game, how many ticks equivalent to one second?
Pretty sure it's ms.
Jalpha wrote:I believe in my interpretation of things.
robinx
Posts: 107
Joined: Sat Jul 16, 2011 2:40 pm

Re: Union Client Scripts

Post by robinx »

it's possible to remove dragonfly from gfx/kritter/rat/s? bcs i'd like to collect frogs and my character try to catch dragonflies ;<
Image
User avatar
Bramson
Posts: 244
Joined: Tue Jul 02, 2013 5:48 am
Location: Hawaii

BR Works v0.1

Post by Bramson »

BR Works v0.1

I will be releases some various scripts for Union Client. My hope is if you find it useful, and improve upon it please share it with me to improve code. You can PM me any code changes that helps improve it and make it run smoother/faster/better. Thank you in advance for sending me improvements. :D

1. Rock Destroyer v1.0! - Have pesky rocks from celler you want destroyed? here you go!
note: to edit rockdestroy range, at the top under SETTINGS change rockRadius.
CODE:

Code: Select all

//#! name = BR Rock Destroyer v1.0
//#! tooltip = BR Works v0.1
//#! icon = gfx/invobjs/paxe

//Global
jToConsole("Start of Rock Destroyer v1.0.");
var inventory = checkInventory();

//Settings
var actionTimeout = 1000 * 60 * 2;   // Lag timeout
var rockRadius = 10;  

// Flags
var stopFlag = false;



function getRandomArbitary(min, max)
{
  return Math.random() * (max - min) + min;
}

function jPFMove_LX(point) {
   point = jTilify(point);
   var MyX = jMyCoords().x;
   var MyY = jMyCoords().y;
      
   jPFMove(point);
   cycles = 0;
   while (MyX != point.x || MyY != point.y)
   {
      jPrint("jPFMove_LX My =" + MyX + " " + MyY + " - " + point.x + " " + point.y);
      jSleep(1000);
      MyX = jMyCoords().x;
      MyY = jMyCoords().y;
      if(cycles == 10)
      {      
         jPrint("jPFMove_LX trying to move again");
         jOffsetClick(jCoord(getRandomArbitary(-2,2),getRandomArbitary(-2,2)),1,0);
         jSleep(500);
         jPFMove(point);
         cycles = 0
      }
      cycles++;
   }
   jPrint("jPFMove ended");
}

function jPFMoveOffset_LX(point, offset) {

   offsMoveS=jCoord(0,offset);
   offsMoveE=jCoord(offset,0);
   offsMoveW=jCoord(-offset,0);
   offsMoveN=jCoord(0,-offset);
   
   while (1) {
      if(jPFMove(point.add(offsMoveS.mul(11))) > 0) {
         jPFMove_LX(point.add(offsMoveS.mul(11)));
         return offsMoveS;
      }
      
      if(jPFMove(point.add(offsMoveE.mul(11))) > 0) {
         jPFMove_LX(point.add(offsMoveE.mul(11)));
      return offsMoveE;
      }
      
      if(jPFMove(point.add(offsMoveW.mul(11))) > 0) {
         jPFMove_LX(point.add(offsMoveW.mul(11)));
      return offsMoveW;
      }   
      
      if(jPFMove(point.add(offsMoveN.mul(11))) > 0) {
         jPFMove_LX(point.add(offsMoveN.mul(11)));
      return offsMoveN;
      }
      jPrint("jPFMoveOffset_LX can't find path");
//      break;

         jOffsetClick(jCoord(getRandomArbitary(-2,2),getRandomArbitary(-2,2)),1,0);
         jSleep(500);
      
   }
}

//function checks inventory
//and opens it, if it closed
function checkInventory() {
   if(!jHaveWindow("Inventory")) {
      jToggleInventory();
      while(!jHaveWindow("Inventory"))
         jSleep(100);
   }
   return jGetWindow("Inventory").getInventories()[0];
}

//Reset Cursor
function resetCursor() {
	if (!jIsCursor("arw")) {
		jAbsClick(jCoord(0, 0), 3, 0);
		jWaitCursor("arw", actionTimeout);
	}
}

//Drink Water
function drinkWater() {
   if (jGetStamina() > 80) return;
   inventory = checkInventory();
   var buckets = inventory.getItems("bucket-water");
   if (buckets.length > 0) {
      inventory.sortItems(buckets, "amount", false);
      var bucket = buckets[0];
      var bucket_coord = bucket.coord();
      if (bucket.isActual()) {
         bucket.take();
         jWaitDrag();
         var flasks = inventory.getItems("waterflask", "waterskin");
         if (flasks.length > 0) {
            var flask = flasks[0];
            if (flask.isActual()) {
               flask.itemact(0);
               jSleep(500);
               inventory.drop(bucket_coord);
               jWaitDrop();
            }
         }
      }
   }
   var flasks = inventory.getItems("waterflask", "waterskin");
   if (flasks.length > 0) {
      var flask = flasks[0];
      if (flask.isActual()) {
         flask.iact();
         if (jWaitPopup(actionTimeout)) {
            jSelectContextMenu("Drink");
            jWaitProgress();
         } else {
            // No water
            stopFlag = true;
         }
      }
   }
}



//Main Function

function main() { //1S
	drinkWater();
	var bumling = jGetObjects(rockRadius,0,"bumlings/02");
         while (bumling != 0) { //2S
   	jToConsole("Rocks to Turn to Runestones:" + bumling.length);
   	    for (var i = 0; i < bumling.length; i++) { //3S
   	       drinkWater();
   	       jSendDoubleAction("swrk","runestone");
   	       jWaitCursor("chi");
   	       bumling[i].doClick(1,0);
   	       while (bumling[i].isActual() == true) jSleep(200);
   	    } //3E
   	    resetCursor();
   	 	
   	       var runeStones = jGetObjects(rockRadius,0,"runestone");      //????????? ?????????
   	       jToConsole("Runestone to Destroy:" + runeStones.length);
   	       for (var i = 0; i < runeStones.length; i++) { //3S
   	          while (runeStones[i].isActual()) { 
		           jSendAction("destroy");
		           jWaitCursor("mine")
		           runeStones[i].doClick(1,0);
		           jWaitProgress(300000);
		           drinkWater();
      			}
   
   	       } //3E
   	  resetCursor(); 
   	  if (bumling = 0)
   	  	{
   	  	if (runeStones = 0)
   	  		{
   	  		jToConsole("Nothing else to break!");
   	  		jSleep(500);
   	  		jExit();
   	  		}
   	  	}
   	  } //2E
   	 } //1E
   	 
main();   	    	       
1. Cellar Digger v1.0! - Wanna dig that cellar? No problem. Just build it and turn on bot and come back in abit.
note: its a good idea to have a couple buckets of water, and I am not responsible if you starve yourself :D
CODE:

Code: Select all

//#! name = BR Cellar Digger v1.0
//#! tooltip = BR Works v0.1
//#! icon = gfx/invobjs/paxe

//Global
jToConsole("Start of BR Cellar Digger v1.0");
var inventory = checkInventory();
var cellar_door = jFindObjectByName("arch/door-cellar", 10);
var count = 0;

//Settings
var actionTimeout = 1000 * 60 * 2;   // Lag timeout
var rockRadius = 10; // Distance to check for rocks & runestones


function getRandomArbitary(min, max)
{
  return Math.random() * (max - min) + min;
}

function jPFMove_LX(point) {
   point = jTilify(point);
   var MyX = jMyCoords().x;
   var MyY = jMyCoords().y;
      
   jPFMove(point);
   cycles = 0;
   while (MyX != point.x || MyY != point.y)
   {
      jPrint("jPFMove_LX My =" + MyX + " " + MyY + " - " + point.x + " " + point.y);
      jSleep(1000);
      MyX = jMyCoords().x;
      MyY = jMyCoords().y;
      if(cycles == 10)
      {      
         jPrint("jPFMove_LX trying to move again");
         jOffsetClick(jCoord(getRandomArbitary(-2,2),getRandomArbitary(-2,2)),1,0);
         jSleep(500);
         jPFMove(point);
         cycles = 0
      }
      cycles++;
   }
   jPrint("jPFMove ended");
}

function jPFMoveOffset_LX(point, offset) {

   offsMoveS=jCoord(0,offset);
   offsMoveE=jCoord(offset,0);
   offsMoveW=jCoord(-offset,0);
   offsMoveN=jCoord(0,-offset);
   
   while (1) {
      if(jPFMove(point.add(offsMoveS.mul(11))) > 0) {
         jPFMove_LX(point.add(offsMoveS.mul(11)));
         return offsMoveS;
      }
      
      if(jPFMove(point.add(offsMoveE.mul(11))) > 0) {
         jPFMove_LX(point.add(offsMoveE.mul(11)));
      return offsMoveE;
      }
      
      if(jPFMove(point.add(offsMoveW.mul(11))) > 0) {
         jPFMove_LX(point.add(offsMoveW.mul(11)));
      return offsMoveW;
      }   
      
      if(jPFMove(point.add(offsMoveN.mul(11))) > 0) {
         jPFMove_LX(point.add(offsMoveN.mul(11)));
      return offsMoveN;
      }
      jPrint("jPFMoveOffset_LX can't find path");
//      break;

         jOffsetClick(jCoord(getRandomArbitary(-2,2),getRandomArbitary(-2,2)),1,0);
         jSleep(500);
      
   }
}

//function checks inventory
//and opens it, if it closed
function checkInventory() {
   if(!jHaveWindow("Inventory")) {
      jToggleInventory();
      while(!jHaveWindow("Inventory"))
         jSleep(100);
   }
   return jGetWindow("Inventory").getInventories()[0];
}

//Reset Cursor
function resetCursor() {
	if (!jIsCursor("arw")) {
		jAbsClick(jCoord(0, 0), 3, 0);
		jWaitCursor("arw", actionTimeout);
	}
}

//Drink Water
function drinkWater() {
   if (jGetStamina() > 80) return;
   inventory = checkInventory();
   var buckets = inventory.getItems("bucket-water");
   if (buckets.length > 0) {
      inventory.sortItems(buckets, "amount", false);
      var bucket = buckets[0];
      var bucket_coord = bucket.coord();
      if (bucket.isActual()) {
         bucket.take();
         jWaitDrag();
         var flasks = inventory.getItems("waterflask", "waterskin");
         if (flasks.length > 0) {
            var flask = flasks[0];
            if (flask.isActual()) {
               flask.itemact(0);
               jSleep(500);
               inventory.drop(bucket_coord);
               jWaitDrop();
            }
         }
      }
   }
   var flasks = inventory.getItems("waterflask", "waterskin");
   if (flasks.length > 0) {
      var flask = flasks[0];
      if (flask.isActual()) {
         flask.iact();
         if (jWaitPopup(actionTimeout)) {
            jSelectContextMenu("Drink");
            jWaitProgress(300000);
         } else {
            // No water
            stopFlag = true;
         }
      }
   }
}

//Main Function

//Get Rock
function getrock() {
	drinkWater();
	jToConsole("Getting Rock");
	jPrint("Getting Rock");
	cellar_door.doClick(3,0); //jDoClick(cellar_door, 3, 0);
	jWaitProgress(1000 * 60 * 10);
	jOffsetClick(jCoord(0, -1), 3, 0);
	jWaitMove(1000 * 60);
	}

//Make Runestone
function makerunestone() {
	drinkWater();
	var bumling = jGetObjects(rockRadius,0,"bumlings/02");
	
	jToConsole("Making Runestone");
	jPrint("Making Runestone");
	for (var i = 0; i < bumling.length; i++) {
		drinkWater();
		jSendDoubleAction("swrk","runestone");
		jWaitCursor("chi");
		bumling[i].doClick(1,0);
		while (bumling[i].isActual() == true) jSleep(200);
		}
	}
	
//Destroy Runestone
function destroyrunestone() {
	drinkWater();
	var runeStones = jGetObjects(rockRadius,0,"runestone");

	jToConsole("Destroying Runestone");
	jPrint("Destroying Runestone");
	for (var i = 0; i < runeStones.length; i++) {
		while (runeStones[i].isActual() == true) { 
			jSendAction("destroy");
		        jWaitCursor("mine")
		        runeStones[i].doClick(1,0);
		        jWaitProgress(300000);
		        drinkWater();
	      		}
		}
	}
	


function main() {
	jSleep(500);
	getrock();
	jSleep(500);
	makerunestone();
	jSleep(500);
	destroyrunestone();
	count++;
        jToConsole(count);
        jPrint(count);
	}
         

while(1) {
   main();
}
3. Well2Tube v1.0! - Need to fill your tubs? Well here we go! Ideal to use 6 buckets, it will fill em and load the tubs up to 60% water. I know someone out there can help me get this faster! Send me an update! :D
CODE:

Code: Select all

//#! name = BR Well to Tub v1.0
//#! tooltip = BR Works v0.1
//#! icon = gfx/terobjs/ttubw

var count = 0;
var count2 = 0;
var count3 = 0;
var buckets = jGetWindow("Inventory").getInventories()[0].getItems("buckete");
var bucket_start = buckets.length;
var all_tub = 0;
var RAD = 14;
var tubs = jGetObjects(RAD, jCoord(0, 0), "ttub");
var all_tubs = tubs.length;
jToConsole("Total Tubs to fill = " + tubs.length);


function getRandomArbitary(min, max)
{
  return Math.random() * (max - min) + min;
}

function jPFMove_LX(point) {
   point = jTilify(point);
   var MyX = jMyCoords().x;
   var MyY = jMyCoords().y;
      
   jPFMove(point);
   cycles = 0;
   while (MyX != point.x || MyY != point.y)
   {
      jPrint("jPFMove_LX My =" + MyX + " " + MyY + " - " + point.x + " " + point.y);
      jSleep(1000);
      MyX = jMyCoords().x;
      MyY = jMyCoords().y;
      if(cycles == 10)
      {      
         jPrint("jPFMove_LX trying to move again");
         jOffsetClick(jCoord(getRandomArbitary(-2,2),getRandomArbitary(-2,2)),1,0);
         jSleep(500);
         jPFMove(point);
         cycles = 0
      }
      cycles++;
   }
   jPrint("jPFMove ended");
}

function jPFMoveOffset_LX(point, offset) {

   offsMoveS=jCoord(0,offset);
   offsMoveE=jCoord(offset,0);
   offsMoveW=jCoord(-offset,0);
   offsMoveN=jCoord(0,-offset);
   
   while (1) {
      if(jPFMove(point.add(offsMoveS.mul(11))) > 0) {
         jPFMove_LX(point.add(offsMoveS.mul(11)));
         return offsMoveS;
      }
      
      if(jPFMove(point.add(offsMoveE.mul(11))) > 0) {
         jPFMove_LX(point.add(offsMoveE.mul(11)));
      return offsMoveE;
      }
      
      if(jPFMove(point.add(offsMoveW.mul(11))) > 0) {
         jPFMove_LX(point.add(offsMoveW.mul(11)));
      return offsMoveW;
      }   
      
      if(jPFMove(point.add(offsMoveN.mul(11))) > 0) {
         jPFMove_LX(point.add(offsMoveN.mul(11)));
      return offsMoveN;
      }
      jPrint("jPFMoveOffset_LX can't find path");
//      break;

         jOffsetClick(jCoord(getRandomArbitary(-2,2),getRandomArbitary(-2,2)),1,0);
         jSleep(500);
      
   }
}
//function checks inventory
//and opens it, if it closed
function checkInventory()
{
   if(!jHaveWindow("Inventory"))
   {
      jToggleInventory();
      while(!jHaveWindow("Inventory"))
         jSleep(100);
   }
}

//Start of Well 2 Tub

//Go to well
function go_to_well() 
	{
	inventory = checkInventory();
	var well = jFindObjectByName("well", 20); //well
	//if no wells around
	if(!well)
		{
		jToConsole("Cannot find a well. Script failed.");
		return;
   		}
   	jSleep(100);
        tile = jPFMoveOffset_LX(well.position(),-1);
        jToConsole("I'm at well");
}//main fuction end

function get_water() 
	{
	if (jGetWindow("Inventory").getInventories()[0].getItems("buckete")[0] == undefined){
		if (jGetWindow("Inventory").getInventories()[0].getItems("bucket-water")[0] == undefined){
			jToConsole("No empty buckets in inventory. Script stopped");
			jExit();
			}
      		}
	
	var buckets = jGetWindow("Inventory").getInventories()[0].getItems("buckete");
	jToConsole("Buckets to Fill =" + buckets.length);
	count2 = null;
	
	for (var k = count2; k < buckets.length; k++) {
		var bucket2 = jGetWindow("Inventory").getInventories()[0].getItems("buckete")[0];
		var bc = bucket2.coord();
      		jPrint("bc = " + bc);
      		bucket2.take();
      		jWaitDrag(5000);
      		jSleep(100);
      		var well = jFindObjectByName("well", 20); //well
      		well.interactClick(0);
      		var drag = jGetDraggingItem();
      		//waits for the filled bucket
      		while(drag.resName().indexOf("water") == -1) {
      			jSleep(100);
      			}//end while
      		jGetWindow("Inventory").getInventories()[0].drop(bc);
      		jWaitDrop(5000);
      		jSleep(100);
      		count2++;
      		}
}//main fuction end

function fill_tub() {
   jToConsole("Bucket's Filled, filling tub");
   var inventory = checkInventory();
   
   
   if (tubs == null) {
      var tubs = jGetObjects(RAD, jCoord(0, 0), "ttub");
      all_tubs = tubs.length;
   }
	//filling tubs   
      for (var i = count; i < tubs.length; i++) {
         var bucket_inventory1 = jGetWindow("Inventory").getInventories()[0].getItems("bucket-water");
         if (bucket_inventory1.length >= bucket_start) {
            tile = jPFMoveOffset_LX(tubs[i].position(),1);
            jDoClick(tubs[i].getID(), 3, 0);
            //waits for tub window
            jWaitWindow("Tanning Tub");
            jSleep(500);
            count3 = null;
        	var WaterInTub = jGetWindow("Tanning Tub").getMeterValue(1);
        	//jToConsole(WaterInTub); //For debugging purposes
        	if (WaterInTub < 60) {
        	
        	//transfer water   
      		var bucket_inventory2 = jGetWindow("Inventory").getInventories()[0].getItems("bucket-water");
        	for (var j = count3++; j < bucket_inventory2.length; j++) {
        		var bucket2 = jGetWindow("Inventory").getInventories()[0].getItems("bucket-water")[0];
        		var bc2 = bucket2.coord();
        		bucket2.take();
        		jWaitDrag(5000);
        		tubs[i].interactClick(0);
        		var drag2 = jGetDraggingItem();
        		jSleep(1000);
        		jGetWindow("Inventory").getInventories()[0].drop(bc2);
        		jWaitDrop(5000);
        		jSleep(100);
        		count3++;
        		}
        	}
            jSleep(1000);
            count++;
            jToConsole(count);
	  	if (count == all_tubs) {
	  		jToConsole("I'm done.");
	  		jExit();
	  		}  
         }
      }
}//main fuction end

function main() {
   go_to_well();
   get_water();
   fill_tub();
}
while(1) {
   main();
}
4. Get Dreams v1.0! - who likes to do this anyhow? It works best if you setup a location for a farm, and position each dream catcher on the edge of the grid. (no PF issues)
CODE:

Code: Select all

//#! name = BR Get Dreams v1.0
//#! tooltip = BR Works v0.1
//#! icon = gfx/invobjs/dream

//Global
var vers = "v1.0";
jToConsole("Start of BR Get Dreams " + vers);
jPrint("Start of BR Get Dreams " + vers);
var inventory = checkInventory();
var count = 0;
currentlyPlace = jMyCoords();


//Settings
var actionTimeout = 1000 * 60 * 2;   // Lag timeout
var waterPerc = 80; //Percent of Stamina before drinking.
var winePerc = 80;  //Percent of Travel Weariness before drinking.

function getRandomArbitary(min, max)
{
  return Math.random() * (max - min) + min;
}

function jPFMove_LX(point) {
   point = jTilify(point);
   var MyX = jMyCoords().x;
   var MyY = jMyCoords().y;
      
   jPFMove(point);
   cycles = 0;
   while (MyX != point.x || MyY != point.y)
   {
      jPrint("jPFMove_LX My =" + MyX + " " + MyY + " - " + point.x + " " + point.y);
      jSleep(1000);
      MyX = jMyCoords().x;
      MyY = jMyCoords().y;
      if(cycles == 6)
      {      
         jPrint("jPFMove_LX trying to move again");
         jOffsetClick(jCoord(getRandomArbitary(-2,2),getRandomArbitary(-2,2)),1,0);
         jSleep(500);
         jPFMove(point);
         cycles = 0
      }
      cycles++;
   }
   jPrint("jPFMove ended");
}

function jPFMoveOffset_LX(point, offset) {

   offsMoveS=jCoord(0,offset);
   offsMoveE=jCoord(offset,0);
   offsMoveW=jCoord(-offset,0);
   offsMoveN=jCoord(0,-offset);
   
   while (1) {
      if(jPFMove(point.add(offsMoveS.mul(11))) > 0) {
         jPFMove_LX(point.add(offsMoveS.mul(11)));
         return offsMoveS;
      }
      
      if(jPFMove(point.add(offsMoveE.mul(11))) > 0) {
         jPFMove_LX(point.add(offsMoveE.mul(11)));
      return offsMoveE;
      }
      
      if(jPFMove(point.add(offsMoveW.mul(11))) > 0) {
         jPFMove_LX(point.add(offsMoveW.mul(11)));
      return offsMoveW;
      }   
      
      if(jPFMove(point.add(offsMoveN.mul(11))) > 0) {
         jPFMove_LX(point.add(offsMoveN.mul(11)));
      return offsMoveN;
      }
      jPrint("jPFMoveOffset_LX can't find path");
//      break;

         jOffsetClick(jCoord(getRandomArbitary(-2,2),getRandomArbitary(-2,2)),1,0);
         jSleep(500);
      
   }
}

//function checks inventory
//and opens it, if it closed
function checkInventory() {
   if(!jHaveWindow("Inventory")) {
      jToggleInventory();
      while(!jHaveWindow("Inventory"))
         jSleep(100);
   }
   return jGetWindow("Inventory").getInventories()[0];
}

//Reset Cursor
function resetCursor() {
	if (!jIsCursor("arw")) {
		jAbsClick(jCoord(0, 0), 3, 0);
		jWaitCursor("arw", actionTimeout);
	}
}

//Drink Water
function drinkWater() {
   if (jGetStamina() > waterPerc) return;
   inventory = checkInventory();
   var buckets = inventory.getItems("bucket-water");
   if (buckets.length > 0) {
      inventory.sortItems(buckets, "amount", false);
      var bucket = buckets[0];
      var bucket_coord = bucket.coord();
      if (bucket.isActual()) {
         bucket.take();
         jWaitDrag();
         var flasks = inventory.getItems("waterflask", "waterskin");
         if (flasks.length > 0) {
            var flask = flasks[0];
            if (flask.isActual()) {
               flask.itemact(0);
               jSleep(500);
               inventory.drop(bucket_coord);
               jWaitDrop();
            }
         }
      }
   }
   var flasks = inventory.getItems("waterflask", "waterskin");
   if (flasks.length > 0) {
      var flask = flasks[0];
      if (flask.isActual()) {
         flask.iact();
         if (jWaitPopup(actionTimeout)) {
            jSelectContextMenu("Drink");
            jWaitProgress(300000);
         } else {
            // No water
            stopFlag = true;
         }
      }
   }
}

//Check Travel Weariness
function travelCount() {
   var buffs = jGetBuffs();
   for (var i = 0; i < buffs.length; i++) {
      if (buffs[i].name().indexOf("Travel Weariness") >= 0) {
         return buffs[i].meter();
      }
   }
   return 0;
}

//Drink Wine
function drinkWine() {
   if (travelCount() < winePerc) return;
   inventory = checkInventory();
   var buckets = inventory.getItems("bucket-wine");
   if (buckets.length > 0) {
      inventory.sortItems(buckets, "amount", false);
      var bucket = buckets[0];
      var bucket_coord = bucket.coord();
      if (bucket.isActual()) {
         bucket.take();
         jWaitDrag();
         var flasks = inventory.getItems("glass-winee");
         if (flasks.length > 0) {
            var flask = flasks[0];
            if (flask.isActual()) {
               flask.itemact(0);
               jSleep(500);
               inventory.drop(bucket_coord);
               jWaitDrop();
            }
         }
      }
   }
   var flasks = inventory.getItems("glass-winef");
   if (flasks.length > 0) {
      var flask = flasks[0];
      if (flask.isActual()) {
         flask.iact();
         if (jWaitPopup(actionTimeout)) {
         jSleep(500)
            jSelectContextMenu("Drink");
            jWaitProgress();
         } else {
            // No water
            stopFlag = true;
         }
      }
   }
}


//Main Function

function tohearth() {
   jSendDoubleAction("theTrav", "hearth");
   jWaitProgress(300000);
}

function tovillage() {
   drinkWine();
   jSleep(500);
   jSendDoubleAction("theTrav", "village");
   jWaitProgress(300000);
   }

/* =========================================================================== */
/* ==============================  START OF MAIN FUNCTIONS!  ================= */
/* =========================================================================== */

function getDream() {
	inventory = checkInventory();
	var dreamsign = jGetObjects(20, jCoord(0, 0), "terobjs/dreca");
	jToConsole("Number of Dream Catchers: " + dreamsign.length); //For debugging purposes
	
	for (var i = count; i < dreamsign.length; i++) {
		jPFMoveOffset_LX(dreamsign[i].position(), -1);
		jSleep(300)
		jDoClick(dreamsign[i].getID(),3,0);

			jSleep(400)
		        jSelectContextMenu("Harvest");
	
		jSleep(400);
		jDoClick(dreamsign[i].getID(),3,0);
	
			jSleep(400)
		        jSelectContextMenu("Harvest");

		jSleep(400);		
		
		count++;
	}
	
}

/* =========================================================================== */
/* ==============================   END OF MAIN FUNCTIONS!  ================== */
/* =========================================================================== */

function main() {
	getDream();
        if (jGetHungry() < 55) { 
       	   	jToConsole("I'm too hungry!");
      		jExit();
      		}
	}
         

while(1) {
   main();
}
Got something cool? Share it with me :ugeek:
"All video/images of coles abominably wearing beard will be purged from the forums." - Jorb

"We won't ever deploy our militia to fight anyone." - Robben_DuMarsch, leader of New Brodgar; diagnosis: Napoleon Syndrome
User avatar
Bramson
Posts: 244
Joined: Tue Jul 02, 2013 5:48 am
Location: Hawaii

Re: Union Client Scripts

Post by Bramson »

reserved for future scripts :ugeek:
"All video/images of coles abominably wearing beard will be purged from the forums." - Jorb

"We won't ever deploy our militia to fight anyone." - Robben_DuMarsch, leader of New Brodgar; diagnosis: Napoleon Syndrome
User avatar
Robben_DuMarsch
Posts: 2646
Joined: Wed Sep 28, 2011 2:58 am

Re: Union Client Scripts

Post by Robben_DuMarsch »

Anyone have an area plow script?
Zonia
Posts: 70
Joined: Thu Feb 10, 2011 12:15 pm

Re: Union Client Scripts

Post by Zonia »

Hi, i was trying to run the farming script posted on the first page but i get this error.
When i start the script seedbags open and the popup with the different croops pops up but then it finishes.
fehler.jpg
would be very nice if someone could help me or give me a hint.
You do not have the required permissions to view the files attached to this post.

Return to “The Wizards' Tower”