Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > General Coding > Coding Tutorials
You last visited: Today at 08:57

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

Advertisement



Autoit Bot Tutorial 2 for Noobies

Discussion on Autoit Bot Tutorial 2 for Noobies within the Coding Tutorials forum part of the General Coding category.

Reply
 
Old   #1
 
ax5's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 1,050
Received Thanks: 472
Autoit Bot Tutorial 2 for Noobies

Ok, so im back with a new noob tutorial to make a bot in Autoit for allot of online games. Remember to visit my website.

If you haven't read my first post to to it

Ok like always you need this 2 programs.

Ok, now you will need to download the R32.zip file on this post. So now make a new project with ScTE, and ad all the text from 32.txt on the top of the new project. This code makes you work with Search on your screen for images. Her's the code also.


Quote:
#Region ### START ImageSearch ###
Func _ImageSearch($findImage,$resultPosition,ByRef $x, ByRef $y,$tolerance)
return _ImageSearchArea($findImage,$resultPosition,0,0,@D esktopWidth,@DesktopHeight,$x,$y,$tolerance)
EndFunc

Func _ImageSearchArea($findImage,$resultPosition,$x1,$y 1,$right,$bottom,ByRef $x, ByRef $y, $tolerance)

if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
$result = DllCall("ImageSearchDLL.dll","str","ImageSearch"," int",$x1,"int",$y1,"int",$right,"int",$bottom,"str ",$findImage)


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


$array = StringSplit($result[0],"|")

$x=Int(Number($array[2]))
$y=Int(Number($array[3]))
if $resultPosition=1 then
$x=$x + Int(Number($array[4])/2)
$y=$y + Int(Number($array[5])/2)
endif
return 1
EndFunc


Func _WaitForImageSearch($findImage,$waitSecs,$resultPo sition,ByRef $x, ByRef $y,$tolerance)
$waitSecs = $waitSecs * 1000
$startTime=TimerInit()
While TimerDiff($startTime) < $waitSecs
sleep(100)
$result=_ImageSearch($findImage,$resultPosition,$x , $y,$tolerance)
if $result > 0 Then
return 1
EndIf
WEnd
return 0
EndFunc


Func _WaitForImagesSearch($findImage,$waitSecs,$resultP osition,ByRef $x, ByRef $y,$tolerance)
$waitSecs = $waitSecs * 1000
$startTime=TimerInit()
While TimerDiff($startTime) < $waitSecs
for $i = 1 to $findImage[0]
sleep(100)
$result=_ImageSearch($findImage[$i],$resultPosition,$x, $y,$tolerance)
if $result > 0 Then
return $i
EndIf
Next
WEnd
return 0
EndFunc
#EndRegion ### START ImageSearch ###
Ok make a new folder on your desktop and add a new folder in it call it img and add the ImageSearchDLL.dll in the folder (not in the img folder.)


Ok so make a picture of somthing you want the bot is going to click on if is there. so this is my image, also add it to the img folder.


ok now to the coding part. This is a code to make the program read and see where the image is on your desktop, X Y angels.
Quote:
$x1=0
$y1=0
Then we will add a hot key to terminate the bot. This will terminate the bot when u press F1.
HotKeySet("{F1}", "Terminate")

Now we will need to open and close a loop.
Quote:
While 1

WEnd
Ok now in the loop we will need to add the code that fiends the image and clicks on it
Quote:
$result = _ImageSearch("img/2.bmp",1,$x1,$y1,1)
Here you will make a variable that makes the program know to what to search on. Also adding the posiion on X,Y angels.

Then we will need to make a IF sate that will make the movement and click or what ever.
Quote:
if $result=1 Then
MouseMove($x1,$y1,3)
MouseClick("left",$x1,$y1,1,3)
MouseClick("left",$x1,$y1,1,3)
EndIf
So now the script for that image will move and click on it "LEFT CLICK WITH THE MOUSE."

now out side of the loop we will need to finish the terminate kotkey script so add this code. This will me called when you press the F1 button

Quote:
Func Terminate()
Exit 0
EndFunc
ALERT, THE IMAGE MOST BE .BMP FORMAT.

FULL CODE HERE
Quote:
#Region ### START ImageSearch ###
Func _ImageSearch($findImage,$resultPosition,ByRef $x, ByRef $y,$tolerance)
return _ImageSearchArea($findImage,$resultPosition,0,0,@D esktopWidth,@DesktopHeight,$x,$y,$tolerance)
EndFunc

Func _ImageSearchArea($findImage,$resultPosition,$x1,$y 1,$right,$bottom,ByRef $x, ByRef $y, $tolerance)

if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
$result = DllCall("ImageSearchDLL.dll","str","ImageSearch"," int",$x1,"int",$y1,"int",$right,"int",$bottom,"str ",$findImage)


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


$array = StringSplit($result[0],"|")

$x=Int(Number($array[2]))
$y=Int(Number($array[3]))
if $resultPosition=1 then
$x=$x + Int(Number($array[4])/2)
$y=$y + Int(Number($array[5])/2)
endif
return 1
EndFunc


Func _WaitForImageSearch($findImage,$waitSecs,$resultPo sition,ByRef $x, ByRef $y,$tolerance)
$waitSecs = $waitSecs * 1000
$startTime=TimerInit()
While TimerDiff($startTime) < $waitSecs
sleep(100)
$result=_ImageSearch($findImage,$resultPosition,$x , $y,$tolerance)
if $result > 0 Then
return 1
EndIf
WEnd
return 0
EndFunc


Func _WaitForImagesSearch($findImage,$waitSecs,$resultP osition,ByRef $x, ByRef $y,$tolerance)
$waitSecs = $waitSecs * 1000
$startTime=TimerInit()
While TimerDiff($startTime) < $waitSecs
for $i = 1 to $findImage[0]
sleep(100)
$result=_ImageSearch($findImage[$i],$resultPosition,$x, $y,$tolerance)
if $result > 0 Then
return $i
EndIf
Next
WEnd
return 0
EndFunc
#EndRegion ### START ImageSearch ###

$x1=0
$y1=0

HotKeySet("{F1}", "Terminate")

While 1

$result = _ImageSearch("img/2.bmp",1,$x1,$y1,1)

if $result=1 Then
MouseMove($x1,$y1,3)
MouseClick("left",$x1,$y1,1,3)
EndIf


WEnd

Func Terminate()
Exit 0
EndFunc
Have fun. Remember to press thanks and visit my site.
Attached Files
File Type: zip R32.zip (41.9 KB, 182 views)
File Type: zip Hello AX5.zip (433.6 KB, 187 views)
ax5 is offline  
Thanks
1 User
Old 09/29/2010, 03:16   #2
 
elite*gold: 0
Join Date: Feb 2010
Posts: 88
Received Thanks: 2
sir why does my grandfaper bot automitically ends after 1minute
fierce134 is offline  
Old 09/29/2010, 04:07   #3
 
Al1as's Avatar
 
elite*gold: 1
Join Date: Apr 2010
Posts: 85
Received Thanks: 16
I always wondered how to get it to click something without coordinates...thanks!

EDIT: Code doesn't work.

if $result[0]="0" then return 0
if $result^ ERROR
Al1as is offline  
Old 10/05/2010, 21:25   #4
 
ax5's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 1,050
Received Thanks: 472
Quote:
Originally Posted by Al1as View Post
I always wondered how to get it to click something without coordinates...thanks!

EDIT: Code doesn't work.

if $result[0]="0" then return 0
if $result^ ERROR
MouseClick("left")

Quote:
Originally Posted by fierce134 View Post
sir why does my grandfaper bot automitically ends after 1minute
try using a Loop that never ends
ax5 is offline  
Reply


Similar Threads Similar Threads
[AutoIt] TCP Tutorial
09/08/2014 - Coding Tutorials - 54 Replies
Hi Leute! Da ich TCP selber für ein interessantes Thema halte, hab ich mal ein Tutorial darüber geschrieben. Have Fun! ;) Inhalt: -] Voraussetzungen -] Was ist TCP? -] Client erstellen -] Server erstellen
Autoit Bot Tutorial 1 for Noobies
09/23/2010 - Coding Tutorials - 8 Replies
Wheal today i am bord so i will make a easy autoit bot tutorial. Easy bot program 2010 You Will need this programs: AutoIt v3.3.4.0 SciTE4AutoIT3
[AutoIt] Tutorial
06/01/2010 - AutoIt - 2 Replies
Heute zeige ich euch mal viele befehle Befehl 1 - MsgBox: - was macht dieder befehl ??? er eröfnet eine nachrichtenfenster -der befehl: MsgBox (0, "", "") -Erklärung 0 = es geht 0 -6 die zahl macht die buttons hier aufgezählt:



All times are GMT +1. The time now is 08:58.


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.