H&H Groovy bot

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

Moderator: Phades

User avatar
SamaR
Posts: 65
Joined: Thu Sep 23, 2010 6:18 pm

Re: H&H Groovy bot

Post by SamaR »

haha! you are walking in forrest and see someone that is chopping trees,chat to him,no response,you think"it's a bot!" and then kill him :D hahaha
User avatar
ElGato
Posts: 1945
Joined: Tue Nov 10, 2009 2:10 am

Re: H&H Groovy bot

Post by ElGato »

SamaR wrote:haha! you are walking in forrest and see someone that is chopping trees,chat to him,no response,you think"it's a bot!" and then kill him :D hahaha
Did this quite a few times in W2 with apple tree botters and clay botters..
burgingham wrote:We are all Gato, and Gato is Delamore of course. Goons blablabla...
Caradon wrote:Gato, the anti-ghandi
Sabinati wrote:yeah we're gonna kill you gato!!!
PanAeon
Posts: 10
Joined: Tue May 24, 2011 7:31 am

Re: H&H Groovy bot

Post by PanAeon »

novaalpha wrote:Could use better documentation. "Import scripts to IDE and figure out API" ... really? :?
Have no time for documentation (((( sorry. You can always see examples, I think there are enough to understand how scripts work, and then you can open ark_bot.java and actually see the available API.
I'm thinking of refactoring everything, and provide normal API with normal method names and so on but I'm busy at work and just don't have time to rewrite everything from scratch.
PanAeon
Posts: 10
Joined: Tue May 24, 2011 7:31 am

Re: H&H Groovy bot

Post by PanAeon »

SamaR wrote:haha! you are walking in forrest and see someone that is chopping trees,chat to him,no response,you think"it's a bot!" and then kill him :D hahaha
My ultimate goal is the bot which can answer back and ... fight back :D :D :D :D
User avatar
DatOneGuy
Posts: 5553
Joined: Sun Apr 18, 2010 7:50 am
Location: I'm in Miami, trick.

Re: H&H Groovy bot

Post by DatOneGuy »

PanAeon wrote:
SamaR wrote:haha! you are walking in forrest and see someone that is chopping trees,chat to him,no response,you think"it's a bot!" and then kill him :D hahaha
My ultimate goal is the bot which can answer back and ... fight back :D :D :D :D
The problem I usually see with the answering back is having a nice database of sentences and responses v.v Easier to just take some basics like 'hi' as 'hi', and then ignore them or something :V
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .Hi. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
User avatar
MagicManICT
Posts: 18435
Joined: Tue Aug 17, 2010 1:47 am

Re: H&H Groovy bot

Post by MagicManICT »

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.
Opinions expressed in this statement are the authors alone and in no way reflect on the game development values of the actual developers.
BruThoL
Posts: 392
Joined: Tue Feb 15, 2011 11:01 pm

Re: H&H Groovy bot

Post by BruThoL »

he could juste use chinese charset and say some random sentences
User avatar
MagicManICT
Posts: 18435
Joined: Tue Aug 17, 2010 1:47 am

Re: H&H Groovy bot

Post by MagicManICT »

BruThoL wrote:he could juste use chinese charset and say some random sentences
Might just work as long as the other guy doesn't know Chinese.
Opinions expressed in this statement are the authors alone and in no way reflect on the game development values of the actual developers.
User avatar
Potjeh
Posts: 11825
Joined: Fri May 29, 2009 4:03 pm

Re: H&H Groovy bot

Post by Potjeh »

Would it be possible to hook it up to SmarterChild :lol:
Image Bottleneck
BruThoL
Posts: 392
Joined: Tue Feb 15, 2011 11:01 pm

Re: H&H Groovy bot

Post by BruThoL »

Here is a log bot revisited version:
Still not perfect, but it's more usable than this topic one.

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 barrel in which i can find wine")
			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 log carriable around, 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.SelectFlowerMenuOpt(act);
		thread.sleep(200);
		while(ark_bot.mapview.player_moving){thread.sleep(10)}
		waitForHourglass();
		ark_bot.SlenPrint("I'll " + act + ' you!!');

		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(){
		while(!ark_bot.HourGlass){thread.sleep(100)}
		while(ark_bot.HourGlass) {thread.sleep(100)}
	}
	
	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();
Last edited by BruThoL on Sun Jul 17, 2011 3:28 am, edited 2 times in total.

Return to “The Wizards' Tower”