H&H Groovy bot

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

Moderator: Phades

Re: H&H Groovy bot

Postby DatOneGuy » Sat Jul 16, 2011 7:39 pm

Very cool lumberjack. Might want to put all of the actual code in [/code] tags, that way it's easy to copy and doesn't stretch.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .Hi. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
User avatar
DatOneGuy
 
Posts: 5553
Joined: Sun Apr 18, 2010 7:50 am
Location: I'm in Miami, trick.

Re: H&H Groovy bot

Postby Skorm » Sat Jul 16, 2011 7:44 pm

MagicManICT wrote:There was an interesting experiment with a program called "Eliza" back in the late 60s. If I recall right, only about 50% of the people in an experiment with this program could distinguish it for what it was.

The program simply responded to something the user typed in and restated it as a question. I forget the all the details, though. I just remember running across the program when I was in school in the 80s in a collection of programs from Byte magazine.

So, could the bot carry on an intelligent conversation? No, but it might be able to fool anyone trying to figure out if it was a bot or a live player.


instead of a nice player that would stay and chat an asshole agressive Douche that will tell you to GTFO and let him play, From Personal Exp i know it works :D
d_datica wrote:Get the damn server back up before I go back to having a life

USER WAS PUT ON PROBATION FOR THIS POST

~art By SacreDoom
User avatar
Skorm
 
Posts: 925
Joined: Wed Mar 03, 2010 6:01 am
Location: on a house, with a computer

Re: H&H Groovy bot

Postby BruThoL » Sun Jul 17, 2011 3:51 am

Here is updated lumberjack script. Cleaned it up a bit.
Also i'd recommend not to use it near edges or stones. Logs could cross them, then it's crappy.

Do you have idea for other bots?
That's not sure, but i may share the script :D

Also, does someone know how to interact with in game chat? can't find any function for that in ark_bot file :/

I'd like the bot to be able to say stuff in "village" channel, like if he's stuck, or if there is not enough wine/food, ...
And maybe to be able to understand commands like : "Jeanne, get 15 logs." or "Jeanne, make leather", ...


Code: Select all
import haven.CharWnd
import haven.RootWidget
import haven.Speedget
import haven.ark_bot
import haven.Coord
import haven.Gob
import haven.Drawable;
import util.PathFinder;
import haven.UI
import java.util.logging.Logger;
import java.util.logging.Level;
import java.util.logging.ConsoleHandler

class LamberJack {
   
   def thread
   
   Speedget speedget
   PathFinder pathFinder
   private final static Logger LOGGER = Logger.getLogger(LamberJack.class.getName());
   
   
   final static int MOUSE_LEFT_BUTTON = 1
   final static int MOUSE_RIGHT_BUTTON = 3
   
   final int wineChestId;
   final int waterBarrelId;
   final int postId;
   
   LamberJack(thread){
      this.thread = thread
      this.pathFinder = new PathFinder(thread)
      LOGGER.setLevel(Level.FINE)
   }
   
   
   void run(){
      println '.....................................................'
      
      ark_bot.ui.widgets.each { key, value ->
         if (value instanceof Speedget){
            speedget = (Speedget)value;
         }
      }
      
      this.speedget.uimsg("cur", 1);   
         
      def pauseTime = 4000;


      ark_bot.SlenPrint('----- LOG BOT -----  Revisited by BruThoL');
      thread.sleep(pauseTime);
      
      ark_bot.SlenPrint('1 - To your village, have a barrel with water, a chest with wine into bucket and food, and a palisade cornerpost for stacking woodblocks.');
      thread.sleep(pauseTime);
      
      ark_bot.SlenPrint('2 - Equip bot with axe, and have a wine glass + bottle and a flask in your inventory.');
      thread.sleep(pauseTime);
            
      ark_bot.SlenPrint('3 - Build your Hearth Fire near a [safe] trees spot. (outside your village)');
      thread.sleep(pauseTime);
      
      ark_bot.SlenPrint('4 - ...');
      thread.sleep(pauseTime);
      
      ark_bot.SlenPrint('5 - Profit. ;)');
      thread.sleep(pauseTime);
      

      
      while(this.wineChestId == 0){
         this.wineChestId = ark_bot.input_get_object("Select the chest in which i can find wine bucket")
         println 'winebarrel id : ' + this.wineChestId;
         if(this.wineChestId==0){
            ark_bot.SlenPrint('It seems you missclicked...');
            thread.sleep(pauseTime);
         
         }
      }
      
      
      while(this.waterBarrelId == 0){
         this.waterBarrelId = ark_bot.input_get_object("select the barrel/well for water")
         println 'waterbarrel id : ' + this.waterBarrelId;
         if(this.waterBarrelId==0){
            ark_bot.SlenPrint('It seems you missclicked...');
            thread.sleep(pauseTime);
         
         }
      }
      
            
      while(this.postId == 0){
         this.postId = ark_bot.input_get_object("select the signpost for stacking the wood blocks")
         println 'signpost id : ' + this.waterBarrelId;
         if(this.postId==0){
            ark_bot.SlenPrint('It seems you missclicked...');
            thread.sleep(pauseTime);
         
         }
      }
      
      
      
      
      def i=0;

      while(i<20){
         i = i+1;
         
         this.checkTravelWeariness();
         this.fillWine();
         this.fillStamina();
         //this.fillFood();
         this.teleportToHearthFire();
         this.getALog();
         this.checkTravelWeariness();
         this.teleportToVillage();
         this.stackLog();
         
      }
      
      println '.....................................................'
   }
   
   void checkTravelWeariness(){
      ark_bot.reset_buff_iterator()
      while(ark_bot.next_buff()){
         if (ark_bot.is_buff_name("Weariness"))
            if(ark_bot.buff_meter() > 50){
               this.drinkWine();
            }
      }
   }
   
   void drinkWine(){
      ark_bot.reset_inventory();
      this.openInventory();
      ark_bot.set_inventory("Inventory");
      println '-------inventory-------'
      while(ark_bot.next_item()){
         String itemResName = ark_bot.GetCurrentItem().GetResName();
         println itemResName;
         if (itemResName.endsWith('glass-winef')){
            //flask = new Coord(ark_bot.item_coord_x(), ark_bot.item_coord_y());
            
            ark_bot.item_click("iact", 0);
            thread.sleep(500);
            this.waitForContextMenu();
            ark_bot.SelectFlowerMenuOpt("Drink");
            this.waitForHourglass();
            thread.sleep(200);
            this.fillGlassWithBottle();
            
         }
      }
   
   }
   
   void fillGlassWithBottle(){
      def bottle = null;
      ark_bot.reset_inventory();
      this.openInventory();
      ark_bot.set_inventory("Inventory");
      println '-------inventory-------'
      while(ark_bot.next_item()){
         String itemResName = ark_bot.GetCurrentItem().GetResName();
         println itemResName;
         if (itemResName.endsWith('bottle-winef')){
            bottle = new Coord(ark_bot.item_coord_x(), ark_bot.item_coord_y());
            
            thread.sleep(500);
            ark_bot.item_click("take", 0);
            thread.sleep(500);
            
         }
      }
      
      if (bottle){
      
         ark_bot.reset_inventory();
         this.openInventory();
         ark_bot.set_inventory("Inventory");
         println '-------inventory-------'
         while(ark_bot.next_item()){
            String itemResName = ark_bot.GetCurrentItem().GetResName();
            println itemResName;
            if (itemResName.endsWith('glass-winee')){
               ark_bot.item_click("itemact", 0);
            }
         }      
         ark_bot.item_drop(bottle);
      }
   
   
   }
   
   void fillWine(){
   
      def wineBucket = null;
   
      ark_bot.SlenPrint('Filling wine.');
      pathFinder.travelTo(this.wineChestId);
      
      ark_bot.DoClick(this.wineChestId, MOUSE_LEFT_BUTTON, 0);
      thread.sleep(400);
      this.openInventory();
      thread.sleep(400);
      ark_bot.DoClick(this.wineChestId, MOUSE_RIGHT_BUTTON, 0);
      thread.sleep(400);
      
      ark_bot.reset_inventory();
      
      ark_bot.set_inventory("Chest");
      thread.sleep(400);
      
      println '-------chest-------'
      while(ark_bot.next_item()){
         String itemResName = ark_bot.GetCurrentItem().GetResName();
         println itemResName;
         if (itemResName.endsWith('bucket-wine')){
            wineBucket =  new Coord(ark_bot.item_coord_x(), ark_bot.item_coord_y());
            ark_bot.item_click("take", 0);
            thread.sleep(500);
         }
      }
      
      
      ark_bot.reset_inventory();
      ark_bot.set_inventory("Inventory");
      
      println '-------inventory-------'
      while(ark_bot.next_item()){
         
         String itemResName = ark_bot.GetCurrentItem().GetResName();
         println itemResName;
         
         if (itemResName.endsWith('bottle-winee')){
            ark_bot.item_click("itemact", 0);
            thread.sleep(400);
         }
         if (itemResName.endsWith('glass-winee')){
            ark_bot.item_click("itemact", 0);
            thread.sleep(400)
         }
      }
      ark_bot.set_inventory("Chest");
      ark_bot.item_drop(wineBucket);
      thread.sleep(2000)
   
   }
   
   
   
   
   void fillStamina(){
   
      def flask = null;
            
      while(ark_bot.Stamina < 70){
      
         pathFinder.travelTo(this.waterBarrelId);
         ark_bot.reset_inventory();
         this.openInventory();
         ark_bot.set_inventory("Inventory");
         println '-------inventory-------'
         while(ark_bot.next_item()){
            String itemResName = ark_bot.GetCurrentItem().GetResName();
            println itemResName;
            if (itemResName.endsWith('waterflask')){
               flask = new Coord(ark_bot.item_coord_x(), ark_bot.item_coord_y());
               
               ark_bot.item_click("iact", 0);
               thread.sleep(500);
               this.waitForContextMenu();
               ark_bot.SelectFlowerMenuOpt("Drink");
               this.waitForHourglass();
               thread.sleep(200);
               
               ark_bot.item_click("take", 0);
               thread.sleep(500);
               
               ark_bot.DoClick(this.waterBarrelId, MOUSE_LEFT_BUTTON, 0);
               thread.sleep(1000);
               ark_bot.item_drop(flask);
               
            }
         }
         
      }
   
   }
   
   void fillFood(){
      //todo. problem with select in flower menu.
      println 'hungry : ' + ark_bot.Hungry;
   
      if(ark_bot.Hungry < 50 && 1==0){
      
         pathFinder.travelTo(this.wineChestId);
         
         ark_bot.DoClick(this.wineChestId, MOUSE_LEFT_BUTTON, 0);
         thread.sleep(400);
         ark_bot.DoClick(this.wineChestId, MOUSE_RIGHT_BUTTON, 0);
         thread.sleep(400);
         
         ark_bot.reset_inventory();
         
         ark_bot.set_inventory("Chest");
         thread.sleep(400);
         
         println '-------chest-------'
         while(ark_bot.next_item()){
            String itemResName = ark_bot.GetCurrentItem().GetResName();
            println itemResName;
            
            if(ark_bot.Hungry < 50){
               ark_bot.item_click("iact",0);
               this.wait_for_context_menu();
               ark_bot.SelectFlowerMenuOpt("Eat");
               sleep(300);
            }
         }
      
      }
      
   }
   
      
   void getALog(){
   
      int logID = ark_bot.find_object_by_name("trees/log", 200);
      if (logID){
         ark_bot.SlenPrint('Wow! Logggg! <3');
         pathFinder.travelTo(logID);
         ark_bot.SendAction("carry");
         this.waitChiCursor();
         ark_bot.DoClick(logID, MOUSE_LEFT_BUTTON, 0);
         while(ark_bot.mapview.player_moving){thread.sleep(10)}
         if(ark_bot.cursor_name == "chi"){ //log uncarriable, maybe on edge, or on another tree. Recommend loging far of edges.
            this.cutATree();this.getALog();
            println "no carriable log around (is it crossing a tree? or edge?), cutting another tree...";
         }
      }else{
         this.cutATree();
         this.getALog();
      }
   }
   
   void cutATree(){
      int treeId = ark_bot.find_object_by_type("tree", 50);
      pathFinder.travelTo(treeId);
      actTree(treeId, "Chop");
      processStump();
   
   }
   
   void actTree(treeId, act){
   
      ark_bot.DoClick(treeId, MOUSE_RIGHT_BUTTON, 0)
      waitForContextMenu();
      ark_bot.SlenPrint("I'll " + act + ' you!!');      
      ark_bot.SelectFlowerMenuOpt(act);
      thread.sleep(200);
      while(ark_bot.mapview.player_moving){thread.sleep(10)}
      waitForHourglass();
      thread.sleep(500)
      
   }
   
   
   void stackLog(){
   
      //ark_bot.DoClick(ark_bot.MyCoord(), MOUSE_RIGHT_BUTTON, 0);
      
      stockPileLogs(); //à reprendre
      
   }
   
   
   void processStump(){
      int stumpID = ark_bot.find_object_by_name("stump", 10);
      if (stumpID){
         //pathFinder.travelTo(stumpID);
         actTree(stumpID, "Remove");
      }
      thread.sleep(2000)
   }
   
   /*
   * Need to be rebuilt for player to choose the place he wants the log stack.
   */
   
   void stockPileLogs(){
      ark_bot.SlenPrint("Stockpiling logs");
      def claimID =  ark_bot.find_object_by_name("vclaim", 100);
      if (claimID){
            def claim = ark_bot.glob.oc.getgob(claimID);
            Coord claimC = ark_bot.mapview.tilify(claim.getc());
            Coord offset = claimC.add(new Coord(99, 99));
            pathFinder.travelToMapLocation(offset);
            ark_bot.DoClick(ark_bot.MyCoord(), MOUSE_RIGHT_BUTTON, 0); // drop log
            thread.sleep(300);
      } else {
      
         ark_bot.exit_command();
      }

      this.speedget.uimsg("cur", 1);

      ark_bot.SlenPrint('Stacking woodblocks...');
      pathFinder.travelTo(this.postId);
      thread.sleep(200)
      ark_bot.DoClick(this.postId, MOUSE_RIGHT_BUTTON, 0)
      while(ark_bot.mapview.player_moving){thread.sleep(10)}
      thread.sleep(500);
      
      ark_bot.set_inventory("Inventory")
      while(ark_bot.next_item()){
         String itemResName = ark_bot.GetCurrentItem().GetResName()
         if (itemResName.endsWith('wood')){
            ark_bot.item_click("transfer", 0)
            thread.sleep(200)
         }
      }
      
      thread.sleep(500);
   }
   
   
   
   
   
   
   
   /*
   *
   *
   * ************ useful funcs ***********
   *
   */
   
   void openInventory(){
      if(!ark_bot.isInventoryOpen()){
         ark_bot.OpenInventory();
         thread.sleep(500)
         openInventory();
      }
   }
   
   void waitForContextMenu(){
      while(!ark_bot.isFlowerMenuReady()) {thread.sleep(100)}
   }
   
   void waitForHourglass(){
      LOGGER.fine ' ' * 10 + '|| waitForHourglass started ['
      while(!ark_bot.HourGlass){thread.sleep(100)}
      while(ark_bot.HourGlass) {thread.sleep(100)}
      LOGGER.fine ' ' * 10 + '|| waitForHourglass finished ]'
   }
   
   void teleportToVillage(){
      ark_bot.SendAction("theTrav", "village");
      thread.sleep(500);
   }
   
   void teleportToHearthFire(){
      ark_bot.SendAction("theTrav", "hearth");
      thread.sleep(500);
   }
   
   void waitChiCursor(){
      while(!(ark_bot.cursor_name == "chi")) thread.sleep(100);
   }
}
   
new LamberJack(thread=currentThread).run();
BruThoL
 
Posts: 392
Joined: Tue Feb 15, 2011 11:01 pm

Re: H&H Groovy bot

Postby DatOneGuy » Sun Jul 17, 2011 4:18 am

Suggestion (how I got around it for lumberjack), save current coords, check if they match destination coords, if they don't, check near you for stump or rock, then break it if it's near (requires character to need Stoneworking).
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .Hi. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
User avatar
DatOneGuy
 
Posts: 5553
Joined: Sun Apr 18, 2010 7:50 am
Location: I'm in Miami, trick.

Re: H&H Groovy bot

Postby BruThoL » Sun Jul 17, 2011 4:36 am

Good idea!

Though I was meaning, ideas for other types of bot.
I think i'll make one for farming.
In particular flax, and make linen clothes (though there is already some code done for that)
BruThoL
 
Posts: 392
Joined: Tue Feb 15, 2011 11:01 pm

Re: H&H Groovy bot

Postby DatOneGuy » Sun Jul 17, 2011 4:46 am

BruThoL wrote:Good idea!

Though I was meaning, ideas for other types of bot.
I think i'll make one for farming.
In particular flax, and make linen clothes (though there is already some code done for that)

I'm working on a farming bot myself atm, running into some problems that are annoying.

A farming bot is very good especially flax. I was working on a flax bot earlier but the biggest issue was to make it streamlined to do it all on several bots, but every bot be the same. My plan was to have 25 tile wide fields, a loom on one side, a banner sign on the other. :V
Still think it could work, just need to get all the work going, food will probably be an issue depending on size of field.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .Hi. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
User avatar
DatOneGuy
 
Posts: 5553
Joined: Sun Apr 18, 2010 7:50 am
Location: I'm in Miami, trick.

Re: H&H Groovy bot

Postby BruThoL » Sun Jul 17, 2011 5:33 am

DatOneGuy wrote:I'm working on a farming bot myself atm, running into some problems that are annoying.

A farming bot is very good especially flax. I was working on a flax bot earlier but the biggest issue was to make it streamlined to do it all on several bots, but every bot be the same. My plan was to have 25 tile wide fields, a loom on one side, a banner sign on the other. :V
Still think it could work, just need to get all the work going, food will probably be an issue depending on size of field.


wow man, sound like linen huge industry xD
I'm currently working on it.

I think it'll require the field to be delimited by layed stone and it'll auto-detect the area to harvest.

Edit : if I manage to get that ¤*!@~# mapview.gobatpos returning something else than null! :roll:
BruThoL
 
Posts: 392
Joined: Tue Feb 15, 2011 11:01 pm

Re: H&H Groovy bot

Postby Butko » Sun Jul 17, 2011 12:42 pm

What I would only use that bot would be botting hunger. Anyone has new groovy script for that?
plow field until stamina drop too low, drink from flask, fill flask from bucket or barrel and continue on same spot.

Possible?
Butko
 
Posts: 542
Joined: Tue Sep 07, 2010 10:05 am

Re: H&H Groovy bot

Postby BruThoL » Sun Jul 17, 2011 12:55 pm

Butko wrote:What I would only use that bot would be botting hunger. Anyone has new groovy script for that?
plow field until stamina drop too low, drink from flask, fill flask from bucket or barrel and continue on same spot.

Possible?


Of course it is.

Butko wrote:I blame new bot users for lag on server, sending too much requests in too short time as with normal playing wouldn't be case.


But are you serious or just kidding us? :D
BruThoL
 
Posts: 392
Joined: Tue Feb 15, 2011 11:01 pm

Re: H&H Groovy bot

Postby Butko » Sun Jul 17, 2011 1:06 pm

BruThoL wrote:
Butko wrote:What I would only use that bot would be botting hunger. Anyone has new groovy script for that?
plow field until stamina drop too low, drink from flask, fill flask from bucket or barrel and continue on same spot.

Possible?


Of course it is.

Butko wrote:I blame new bot users for lag on server, sending too much requests in too short time as with normal playing wouldn't be case.


But are you serious or just kidding us? :D

Nope serious. I won't bot production or anything. Only hunger because I have too much food that I can't eat all. And I would bot only on main to level up FEPS. On alts there is no purpose.
Butko
 
Posts: 542
Joined: Tue Sep 07, 2010 10:05 am

PreviousNext

Return to The Wizards' Tower

Who is online

Users browsing this forum: Claude [Bot], Google [Bot] and 0 guests