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.
W10Meme Plot | W9Mantis Garden | W8Core | W7Ofir | W6the City of Dis | W5Vitterstad | W4A.D. | W3Mirniy
jorb wrote:All your characters will be deleted, and I will level every village any one of them were ever members of.
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?
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.
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.
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:
//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 CODE:
//#! 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
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! CODE:
//#! 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 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
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:
//#! 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 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
"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
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.