Register for your free account! | Forgot your password?

Go Back   elitepvpers > Other Online Games > Browsergames
You last visited: Today at 12:42

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Wartune] E's AutoIt Scripts Daru Farmbot

Discussion on [Wartune] E's AutoIt Scripts Daru Farmbot within the Browsergames forum part of the Other Online Games category.

Reply
 
Old 06/10/2013, 13:44   #61
 
elite*gold: 0
Join Date: May 2012
Posts: 5
Received Thanks: 0
i have give it a try, the farm bot can only stealing but no plant revive oder take the weed. maybe it need another images for it. the worldmap farming do nothing. i will give a try and edit it
Schaikur is offline  
Old 06/10/2013, 23:04   #62
 
elite*gold: 0
Join Date: Jun 2008
Posts: 60
Received Thanks: 18
worldmap does if farmbot does, you need to make changes...read through the forums you will find the answers your looking for. You will need to change the coords that your x and y look at and searchicon. Also you may need to edit the attack image(most people have to). To see if it works find a chest start the bot. It will lock on (may take a few trys depending on what brightness the chest is at) if it goes to attack and wont click the attack button then yes you will need to change the attack image( I put a attack image in an earlier forum that does work for me).
VVayinsane is offline  
Old 06/11/2013, 08:43   #63
 
Ewvyx's Avatar
 
elite*gold: 0
Join Date: May 2013
Posts: 22
Received Thanks: 45
Sorry folks. I will try to get back to this soon but something huge came up last week and it has been a chore dealing with that and other projects. Thanks VVayinsane for helping people out in my absence. I should be more responsive this week and I will be working on it when I get some free time.
Ewvyx is offline  
Thanks
1 User
Old 06/11/2013, 12:50   #64
 
elite*gold: 0
Join Date: May 2012
Posts: 5
Received Thanks: 0
kk thx VVayinsane
still i need sometime to understand the source code before i dédit it for demonslayer.
I will give you guys a call if im am seccesful
Schaikur is offline  
Old 06/11/2013, 17:16   #65
 
elite*gold: 0
Join Date: Jun 2013
Posts: 12
Received Thanks: 0
First wanted to say thanks for a great script.

Let me say this. I am in Fetid Swamp currently. taking my own images of monsters. The script runs and finds managog, It clicks someone else on the screen (doesnt hit managog) and then stops on attack part of script. Im trying to figure how to get my mouse to find and click the managog once the script recognizes the image I took.
KilleN^ is offline  
Old 06/11/2013, 21:31   #66
 
elite*gold: 0
Join Date: Feb 2012
Posts: 39
Received Thanks: 9
Thanks for all the great work you guys are doing with this, i don't really know what i'm doing with autoit but have followed the instructions on fixes for mouse position etc. but i'm having no joy, I tried the script in murken forest with the new images of managogs but keep getting an error come up, something about line 40. The only thing i can think is that my resolution is too low for this to work in its current form, here's hoping you guys can work out one for 1366x768
richardrah is offline  
Old 06/11/2013, 22:30   #67
 
elite*gold: 0
Join Date: Jun 2008
Posts: 60
Received Thanks: 18
KilleN^ - Your haven false positive. You need to cut a new image of the mob and see if that will work without any false positives. Its takes time but your be able to get it working without any false hits but you will get them. Just cut a new image of a different part. On one mob it took me about 5 trys until i was able to find a working image.

Richardrah - screen size isnt the issue for that. Please can you post your script on here. Please make sure to use wrap code around the script [Code]your script goes here[./Code]
Just make sure to remove the .
VVayinsane is offline  
Old 06/11/2013, 23:13   #68
 
elite*gold: 0
Join Date: Feb 2012
Posts: 39
Received Thanks: 9
Code:
;===========================================================================================================
;@Author Ewvyx  I wrote this so please don't slap your name on it.

;This script searches through the wilds of Erandel and fights Managogs for Daru Pearls
;It is designed for a 1920x1080 display
;Works best if you start in the top left most corner of the wilds map (less wait time for your character to move to the first found managog)
#RequireAdmin
#include <ImageSearch.au3>

;===========================================================================================================
;Global Variables (DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING)

;X Coords Input on 1920x1080 :  1518x198
;Y Coords Input on 1920x1080 :  1553x198

$Version = "1.1.0a"
Global $Paused
Global $gX = 0
Global $gY = 0
Global $c1X = 0
Global $c1Y = 0
Global $c2X = 0
Global $c2Y = 0
Global $success = False ;boolean for various checks
Global $managogFound = False ;flag for when a managog is found by _ImageSearch
Global $tolFail = 0 ;tolerance failures for _ImageSearch
Global $troopRecruitY = 0 ;Y coordinate of specified troop portrait in recruit troops window
Global $searchCoordsFound = False
$bmpLocation = @ScriptDir & "\Pics"
$managogsDir = "Managogs"
$buttonsDir = "Buttons"

;===========================================================================================================
;User Defined Variables

Global $mapX = 15 ;change this to the x coordinate of the map that your character is in. map starts at 15, goes to 585
Global $mapY = 8 ;change this to the x coordinate of the map that your character is in. map starts at 8, goes to 591
$collectTreasure = True ;set to True if you want to attack treasure caches as well, False if do not
$troops = "warlock" ;set this to the troops you are using i.e. "templar" or "warlock"
$defaultCheckRate = .1 ;smaller the number, the faster the image checks are.  increase if managogs aren't being found.

;===========================================================================================================
;HotKeys

HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("q","RunScript")
HotKeySet("x","ChangeCoords")

;===========================================================================================================
;~Functions

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

Func CheckFor($directory,$img,$tolerance=50,$startX=0,$startY=0,$endX=@DesktopWidth,$endY=@DesktopHeight,$seconds=$defaultCheckRate)
	$c = 0
	MouseMove(0,(@DesktopHeight/2),0)
	$string = $bmpLocation & "\" & $directory & "\" & $img & ".bmp"
	If $img = "city" Then
		$updateString = "Wilds View"
	Else
		$updateString = $img
	EndIf
	ToolTip("Checking for " & $updateString,0,0)
	$tolerance = 50
	If $directory = $managogsDir Then
		$tolerance = 100		
	EndIf
	If $img = "treasure" Then
		$tolerance = 35
	ElseIf $img = "attackingsword" Then
		$tolerance = 70
	EndIf
	If $tolFail > 0 Then
		$tolerance += $tolFail
	EndIf
	Do
		$c += 1
		Sleep(100)
		If $c > ($seconds * 10) Then
			Return False
		EndIf
	Until _ImageSearchArea($string,1,$startX,$startY,$endX,$endY,$gX,$gY,$tolerance)
	;Until _ImageSearchArea($string,1,216,180,1723,1002,$gX,$gY,$tolerance)
	Sleep(500)
	Return True
EndFunc

Func ClickImage($directory,$img,$tolerance=50,$startX=0,$startY=0,$endX=@DesktopWidth,$endY=@DesktopHeight,$seconds=$defaultCheckRate)
	If CheckFor($directory,$img,$tolerance,$startX,$startY,$endX,$endY,$seconds) Then
		MouseClick("left",$gX,$gY,1,0)
		Return True
	Else
		Return False
	EndIf
EndFunc	

Func HoverOverImage($directory,$img,$tolerance=50,$startX=0,$startY=0,$endX=@DesktopWidth,$endY=@DesktopHeight,$seconds=$defaultCheckRate)
	If CheckFor($directory,$img,$startX,$startY,$endX,$endY,$seconds,$tolerance) Then
		MouseMove($gX,$gY,0)
		Sleep(2000)
		Return True
	Else
		Return False
	EndIf
EndFunc

Func ClickOffsetOfImage($direction,$offset,$directory,$img,$clicks=1,$tolerance=50,$startX=0,$startY=0,$endX=@DesktopWidth,$endY=@DesktopHeight,$seconds=$defaultCheckRate)
	If CheckFor($directory,$img,$startX,$startY,$endX,$endY,$seconds,$tolerance) Then
		If $direction = "right" Then
			$gX += $offset
		ElseIf $direction = "left" Then
			$gX -= $offset
		ElseIf $direction = "up" Then
			$gY -= $offset
		ElseIf $direction = "down" Then
			$gY += $offset
		EndIf
		MouseClick("left",$gX,$gY,$clicks,0)
		Return True
	Else
		Return False
	EndIf
EndFunc

Func ChangeCoords()
	;Changes map coordinates square by square.  Moves left to right then moves down one square and goes left to right again.
	$wait = 2000 ;sleep (milliseconds) at the end of this function
	If $mapX < 585 Then
		$mapX += 30
	Else
		$wait = 2000
		$mapX = 15
		If $mapY < 591 Then			
			$mapY += 17
		EndIf
	EndIf
	MouseClick("left",1181,21,2,0)
	Send($mapX)
	MouseClick("left",1208,20,2,0)
	Send($mapY)
	MouseCLick("left",1242,19,2,0)
	Sleep($wait)
EndFunc

Func FindXCoordsFor($directory,$img)
	If CheckFor($directory,$img) Then
		Return $gX
	Else
		Return 0
	EndIf
EndFunc		

Func FindYCoordsFor($directory,$img)
	If CheckFor($directory,$img) Then
		Return $gY
	Else
		Return 0
	EndIf
EndFunc	

Func SearchForAttackSword()
	;Searches for the sword icon.  Used to make sure SearchForManagogs() actually found something.
	If CheckFor($managogsDir,"attackingsword") Or CheckFor($managogsDir,"attackingsword2") Or CheckFor($managogsDir,"attackingsword3") Then
		Return True
	Else
		Return False
	EndIf
EndFunc
	
Func SearchForManagogs()
	;Iterates through each managog bitmap until it finds one.  Returns false if it doesn't.
	If ClickImage($managogsDir,"bear(black)") Or ClickImage($managogsDir,"bear(black)2") Then
		Return True
	ElseIf ClickImage($managogsDir,"bear(brown)") Then
		Return True
	ElseIf ClickImage($managogsDir,"goblin3") Or ClickImage($managogsDir,"goblin2") Or ClickImage($managogsDir,"goblin") Then
		Return True
	ElseIf ClickImage($managogsDir,"goblin(purple)") Then
		Return True
	ElseIf ClickImage($managogsDir,"griffon") Then
		Return True
	ElseIf ClickImage($managogsDir,"paladin") Or ClickImage($managogsDir,"paladin2") Then
		Return True
	ElseIf ClickImage($managogsDir,"tauren(club)") Or ClickImage($managogsDir,"tauren(club)2") Then
		Return True
	ElseIf ClickImage($managogsDir,"tauren(shield)") Then
		Return True
	ElseIf $collectTreasure Then
		If ClickImage($managogsDir,"treasure") Then
			Return True
		EndIf
	Else
		Return False
	EndIf
EndFunc

Func WaitForAttack()
	;Waits for your character to get to the managog. If the attack button does not appear after 1 min, it will search for and click on the managog again.
	If ClickImage($buttonsDir,"attack",0,0,@DesktopWidth,@DesktopHeight,1,50) Then
		$success = True
		Sleep(2000)
	Else
		$success = False
	EndIf
EndFunc

Func CheckAFKMode()
	;Ensures AFK mode is on for faster farming.
	ClickImage($buttonsDir,"afkmode")
EndFunc

Func CheckWildsView()
	;Returns True if the city button is in view, false if not.
	If CheckFor($buttonsDir,"city") Then
		Return True
	Else
		Return False
	EndIf
EndFunc

Func CheckLowTroops()
	;Ensures troop count doesn't drop too low.
	If ClickImage($buttonsDir,"recruittroops") Then
		Return True
	Else
		Return False
	EndIf
EndFunc

Func RecruitTroops()
	;Recruits more troops
	$troopPortrait = ""
	If $troops = "templar" Then
		$troopPortrait = "templarportrait"
	ElseIf $troops = "warlock" Then
		$troopPortrait = "warlockportrait"
	EndIf
	Do
		ClickImage($buttonsDir,"scrollarrow(down)")
	Until CheckFor($buttonsDir,$troopPortrait)
	$troopRecruitY = $gY
	ClickImage($buttonsDir,"recruit",0,$troopRecruitY,@DesktopWidth,@DesktopHeight,0.5,50)
	ClickImage($buttonsDir,"ok")
	ClickImage($buttonsDir,"x")
EndFunc		

Func RunScript()
	;Main script activated by hotkey
	While 1
		If CheckWildsView() Then
			Do
				If ClickImage($buttonsDir,"attack") Then
					Sleep(500)
				ElseIf CheckLowTroops() Then
					RecruitTroops()
				ElseIf SearchForAttackSword() Then
					Do
						WaitForAttack()
					Until SearchForAttackSword() = False Or ClickImage($buttonsDir,"attack") = True
				ElseIf $managogFound = False And SearchForManagogs() Then
					ToolTip("Managog found!",0,0)
					Sleep(1000)
					$managogFound = True
					Do
						WaitForAttack()
					Until SearchForAttackSword() = False Or ClickImage($buttonsDir,"attack") = True
				ElseIf $managogFound = True And $success = False Then
					$managogFound = False
					ChangeCoords()
				ElseIf $managogFound = False Then
					ChangeCoords()
				EndIf
			Until $success = True
			If $success = True Then
				$managogFound = False
				CheckAFKMode()
			EndIf
		Else
			$success = False
			$managogFound = False
			CheckAFKMode()
		EndIf	
	WEnd
EndFunc		

;===========================================================================================================
;Main

While 1
	ToolTip("Press 'q' to begin...",0,0)
	Sleep(100)
WEnd
This is what I have

This is the error I get when I try to run script.

Line 40

if $result[0]="0" then return 0
if $result^ERROR

Error: Subscript used with non-Array variable

Have no idea what's going on
richardrah is offline  
Old 06/12/2013, 00:04   #69
 
elite*gold: 0
Join Date: Jun 2008
Posts: 60
Received Thanks: 18
try this.

Code:
	
Until _ImageSearchArea($string,1,$startX,$startY,$endX,$endY,$gX,$gY,$tolerance)
;Until _ImageSearchArea($string,1,216,180,1723,1002,$gX,$gY,$tolerance)
To

Code:
	
;Until _ImageSearchArea($string,1,$startX,$startY,$endX,$endY,$gX,$gY,$tolerance)
Until _ImageSearchArea($string,1,216,180,1723,1002,$gX,$gY,$tolerance)
VVayinsane is offline  
Old 06/12/2013, 00:15   #70
 
elite*gold: 0
Join Date: Feb 2012
Posts: 39
Received Thanks: 9
Still getting the Line 40 error
richardrah is offline  
Old 06/12/2013, 00:29   #71
 
elite*gold: 0
Join Date: Jun 2008
Posts: 60
Received Thanks: 18
Im not getting that error on my screen at all.. script works well for me. The error code isnt coming from the darudaru, its coming from Imagesearch script.
VVayinsane is offline  
Old 06/12/2013, 00:32   #72
 
elite*gold: 0
Join Date: Jun 2013
Posts: 12
Received Thanks: 0
Thank you Wayinsane. Im going to give that a try right now, taking images of every monster in swamps. If I get working images I will share.
KilleN^ is offline  
Old 06/12/2013, 00:33   #73
 
elite*gold: 0
Join Date: Jun 2008
Posts: 60
Received Thanks: 18
Try and re extract the script. Run darudaru without maken any changes and see if the error pops backup. If not then change the x and y coords like before and run the script again.

error subscript means that a folder or subfolder cannot be found

Did you put the system32 in the right place?

From looking into the script and seeing what it looks for before it goes to the error is the system32 folder. I think that is your issue.
VVayinsane is offline  
Thanks
1 User
Old 06/12/2013, 01:00   #74
 
elite*gold: 0
Join Date: Feb 2012
Posts: 39
Received Thanks: 9
I've hit a treasure chest lol had to copy system32 over to syswow and ran it at x86, it went through all managogs and found a treasure chest then it stayed at finding searchicon, should I use mouse position and fine tune them like you showed us?
richardrah is offline  
Old 06/12/2013, 01:45   #75
 
elite*gold: 0
Join Date: Jun 2008
Posts: 60
Received Thanks: 18
mouse postion is only for changing map area. You may have to if you want it to change location. Try and see if it will change map location. Make sure no mobs or chest is in the area. See if it will cycle through. If it wont change go a head and make the changes like before. Just the x, y, and searchicon. When it found the chest did the sword come up?

At least we got your first error figured out.
VVayinsane is offline  
Reply

Tags
aeria, autoit, script, wartune


Similar Threads Similar Threads
S4 Farmbot mit autoit
08/09/2011 - AutoIt - 6 Replies
also ich bin anfänger und versuche gerade einen farmbot zu machen ! und das problem ist das der bot nicht in im client von s4 klicken oder schreiben kann . Muss ich da was spezielles dafür machen? help pls !
AutoIT scripts
11/21/2009 - AutoIt - 22 Replies
Hi, also ich hatte mal vor nach PHP noch ne andere scriptsprache zu lernen und bin dann bei AutoIT gelandet^^ Ich hab mich mal nen bisschen eingelesen wollte allerdings nich nur die theorie machen, sondern auch an der praxis lernen. ;) Von daher wollt ich fragen ob ihr eure .au3 scripts hochladen könnt, damit ich und die anderen dies interessiert von euch noch einiges lernen können :P Freu mich über eure Hilfe MfG .nAno



All times are GMT +1. The time now is 12:42.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.