
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 himhahaha
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!!!
novaalpha wrote:Could use better documentation. "Import scripts to IDE and figure out API" ... really?
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 himhahaha
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 himhahaha
My ultimate goal is the bot which can answer back and ... fight back![]()
![]()
![]()
BruThoL wrote:he could juste use chinese charset and say some random sentences
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();
Users browsing this forum: Claude [Bot] and 2 guests