Union Client Scripts

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

Moderator: Phades

Re: Union Client Scripts

Postby Arcanist » Thu Jul 18, 2013 3:56 pm

You must have jbotapi.japi in your scripts folder.
User avatar
Arcanist
 
Posts: 2664
Joined: Mon Mar 19, 2012 2:01 pm

Re: Union Client Scripts

Postby Arcanist » Thu Jul 18, 2013 4:06 pm

Code: Select all
function waitPFMove(){
   jWaitStartMove(300);
   jSleep(100);
   while (true) {
      jWaitEndMove(10000);
      jSleep(200);
      if (!jIsMoving()) {
         return;
      }
   }
}
function getNearestBasket() {
   var basket = jGetObjects(5000, jCoord(0, 0), ["wbasket"]);
      var min_len = 100500; var objid = 0;
   for (var i = 0; i < basket.length; i++) {
      if (basket[i].position().dist(jMyCoords()) < min_len) {
         var objid = basket[i];
         var min_len = basket[i].position().dist(jMyCoords()); }
   }
   return objid; }

function moveToBasket() {
   var basket2 = getNearestBasket();
   jPFMove (basket2);
   jSleep(500);
   waitPFMove(2000);
   return; }

moveToBasket()


What am I doing wrong? When I run it, the script starts, then finishes, no movement, no errors.
User avatar
Arcanist
 
Posts: 2664
Joined: Mon Mar 19, 2012 2:01 pm

Re: Union Client Scripts

Postby seba95 » Thu Jul 18, 2013 7:41 pm

Arcanist wrote:You must have jbotapi.japi in your scripts folder.


i got http://scr.hu/3ui/0jxcz
seba95
 
Posts: 15
Joined: Sat Feb 11, 2012 2:06 pm

Re: Union Client Scripts

Postby gogis » Thu Jul 18, 2013 8:25 pm

Redone drinkWater for my better liking.
I hated this stupid behavior - always fill waterskin with bucket then drink ad nauseam, with bucket hopping every second. I made in in a more humane way, I think (atleast how I do it)

Algorithm - it drinks from container till it's less than 0.5, then hop bucket over it. Script stops at 90 stamina or everything empty. Plays sound when no water bucket available.
There is a bug also - when you manually empty skin - it's state it's previous currentAmount(), so I added check for innerQuality() > 0
Played with it for couple of hours, didn't noticed any bugs/odd behaviour. But it's not extensively tested.

todo
- refill from very close well
- find a way not to drop bucket on occasion

edit: removed debug info
Code: Select all
//#! tooltip = Drink
//#! name = Drink and refill
//#! uniq = dfccd2e6-1cd5-495d-8947-9f0d6d4059az
include("jBotAPI");
function main() {
   var inventory = checkInventory();
   var flasks = inventory.getItems("waterflask", "waterskin");
   var buckets = inventory.getItems("bucket-water");
   
   do {
      //var well = jFindObjectByName("well", 10); //well
      
      if (flasks.length > 0) {
         var flask = flasks[0];
         if (flask.isActual() && flask.innerQuality() > 0) {
            flask.iact();
            if (jWaitPopup(actionTimeout)) {
               jSelectContextMenu("Drink");
               jWaitProgress();
            }
         }
      }
      
      if (flask.innerQuality() < 0 || flask.currentAmount() < 0.5) {
         if (buckets.length > 0) {
            inventory.sortItems(buckets, "amount", false);
            var bucket = buckets[0];
            var bucket_coord = bucket.coord();
            if (bucket.isActual()) {
               bucket.take();
               jWaitDrag();
               flask.itemact(0);
               jSleep(500);
               inventory.drop(bucket_coord);
               jWaitDrop();
            }
         } else {
            jPlayBeep(500);
            jToConsole('No water in buckets');
         }
      }
      
   } while (jGetStamina() < 90 && flask.innerQuality() > 0)
}
main();
gogis
 
Posts: 45
Joined: Tue Jun 25, 2013 9:46 pm

Re: Union Client Scripts

Postby robinx » Tue Jul 23, 2013 9:44 am

can someone tell me how work pathfinder? and how i can add it to my script?
Image
robinx
 
Posts: 106
Joined: Sat Jul 16, 2011 2:40 pm

Re: Union Client Scripts

Postby gogis » Tue Jul 23, 2013 10:26 pm

robinx wrote:can someone tell me how work pathfinder? and how i can add it to my script?


jPFmove(coords), where coords is JSGob.position(). You can reverse engineer everything from existing scripts (like farmer), or read thru
http://unionclient.ru/doc/jbot/union/jsbot/JSHaven.html. While commentary is in russian, functions names is self talking.
gogis
 
Posts: 45
Joined: Tue Jun 25, 2013 9:46 pm

Re: Union Client Scripts

Postby robinx » Thu Jul 25, 2013 4:06 pm

it's possible to select tile by left mouse button in script?
if it's ,which commande do it?
Image
robinx
 
Posts: 106
Joined: Sat Jul 16, 2011 2:40 pm

Re: Union Client Scripts

Postby quinsta » Sat Jul 27, 2013 8:21 pm

I wonder if someone made a script that makes it possible to put curios in study? the client fucks up the character sheet if you use jToggleSheet, so I am really curious if anyone had some ideas?

In return my current foraging script:
http://pastebin.com/HwVwavEP

Edit:
Never mind, found out by myself and added it to the script, also updated the pastebin to match
quinsta
 
Posts: 4
Joined: Thu Jan 20, 2011 10:05 pm

Re: Union Client Scripts

Postby roboboy33 » Tue Jul 30, 2013 1:41 am

When I click "Run Scripts" in union client nothing pops up or happens, it just goes back to the original menu. Is there something else I'm supposed to do?
what the fuck say
roboboy33
 
Posts: 94
Joined: Sun Jul 03, 2011 2:41 am

Re: Union Client Scripts

Postby seba95 » Tue Jul 30, 2013 1:47 pm

cananyfix the Farmer scritps i dont want that me farmer eat carrots and beetroot bcouse i want upgrade psyche and Dex :(
seba95
 
Posts: 15
Joined: Sat Feb 11, 2012 2:06 pm

PreviousNext

Return to The Wizards' Tower

Who is online

Users browsing this forum: Claude [Bot] and 1 guest