[AutoIt] Making Simple Bots

01/13/2008 08:43 -=ToMiK=-#1
Hi, all you people out there who ever wanted to make bots, read this and you will be a step closer to making your own professional ones. Please read and please leave a thanx. Don't be lazy to read through, this will help. Garenteee you!

Stuff you Need:
1. AutoIt v3 (Get it here: [Only registered and activated users can see links. Click Here To Register...])

Tutorial: MouseClick

Perform a mouse click operation.
MouseClick ( "button", x, y, clicks, speed)

Parameters
button The button to click: "left", "right", "middle", "main", "menu", "primary", "secondary".
x, y [optional] The x/y coordinates to move the mouse to. If no x and y coords are given, the current position is used (default).
clicks [optional] The number of times to click the mouse. Default is 1.
speed [optional] the speed to move the mouse in the range 1 (fastest) to 100 (slowest). A speed of 0 will move the mouse instantly. Default speed is 10.


Return Value
Success: Returns 1.
Failure: Returns 0, the button is not in the list.


Remarks
If the button is an empty string, the left button will be clicked.
If the user has swapped the left and right mouse buttons in the control panel, then the behaviour of the buttons is different. "Left" and "right" always click those buttons, whether the buttons are swapped or not. The "primary" or "main" button will be the main click, whether or not the buttons are swapped. The "secondary" or "menu" buttons will usually bring up the context menu, whether the buttons are swapped or not.


Button Normal Swapped
"" Left Left
"left" Left Left
"middle" Middle Middle
"right" Right Right
"primary" Left Right
"main" Left Right
"secondary" Right Left
"menu" Right Left


Example
; Double click at the current mouse pos
MouseClick("left")
MouseClick("left")

; Double click at 0,500
MouseClick("left", 0, 500, 2)


; SAFER VERSION of Double click at 0,500

Dim $primary
Dim $secondary
;Determine if user has swapped right and left mouse buttons
$k = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")

; It's okay to NOT check the success of the RegRead operation
If $k = 1 Then
$primary = "right"
$secondary = "left"
Else ;normal (also case if could not read registry key)
$primary = "left"
$secondary = "right"
EndIf
MouseClick($primary, 0, 500, 2)
Exit


Yo guys I do have more tutorials and if you need to know about something then pm me and i'll see what I can do. Oh and yhea, if you use the AutoIt Window Info you can find the x,y coordinates of where your pointing. But when you turn on AutoIt Window Info choose the Mouse Tab. Well thats it. If alot of people will look then maby post up some more. Oh and again please leave a thanx!:D
01/13/2008 21:39 Sillyrabbit#2
I've worked with actools (another bot making tool) but never with auto it.

my question is, do you have a source code for anything like an autopot tool that you can share with me/everyone?

i think it will be beneficial. It does not need to be an auto pot tool, but something that shows the different functions of auto it. like pixel detection and such
01/13/2008 22:24 -=ToMiK=-#3
ummm, i've worked with it but didn't really get it to work. But im very close, if i get it i will share it with you. But not sure if in public. sry :(
If i get access to the private section i'll post it there
01/14/2008 10:41 darkwang#4
Name I think this may be what your asking for. Its the source code from fishing bot that another person from this forum posted up. Was having trouble trying to use forums attachment tools, it kept freezing browser so I had to use rapidshare.

[Only registered and activated users can see links. Click Here To Register...]
01/14/2008 18:23 mace84#5
namek if you need I can give also a source code of an autopot. This autopot is not my work...If u want it PM me
01/14/2008 21:59 PanClon#6
Hello....I started making some AutoIt bots, but I havenīt much time becouse of school...so I decided to post here some usefull scripts (templates)


feel free to use it X)

This one is for checking the "when u die bar" :
Code:
WinActivate("2Moons")
Sleep(500)
 = PixelGetColor(549, 138) ;Get the colour of the specified pixel(purple one)
While  <> 14883057
    Sleep(10000) ; Wait 10 seconds before checking again   
     = PixelGetColor(549, 138)
Wend
; do your stuff
or


Relog after DC:
Code:
;~ HotKeySet( "{F11}" , "_Start")
;~ HotKeySet( "{F10}" , "_Stop")
Opt("TrayMenuMode", 1)
Opt("WinTitleMatchMode", 2)

 = TrayCreateItem("Exit")
Opt("TrayOnEventMode",1)
TrayItemSetOnEvent(, "_Exit")
TraySetState()
TrayTip("2Moons auto launcher", "Press F11 to start, or F10 to stop script", 5)

call("_start")

Func Adlibfunc ()
    if Not ProcessExists("dekaron.exe") Then;If game fall down/DC
        [COLOR="Red"]ShellExecute("minilauncher.exe", "", "C:Program FilesAcclaim2Moons");luncher-may be changed by user[/COLOR]                                                       
        Sleep(12000)
	WinActivate("luncher")
        MouseClick("Left", 826,668,1);START
        Sleep(90000)
       [COLOR="Red"] MouseClick("Left", 619,813,1);Trieste[/COLOR]
        Sleep(1000)
        MouseClick("Left", 640,950,1);ok
        Sleep(3000)
        WinActivate("2Moons")
	Sleep(1000)
	[COLOR="Red"]Send("");login[/COLOR]
	Sleep(3000)
	Send("{TAB}")
	Sleep(2000)
	[COLOR="Red"]Send ("");password[/COLOR]
        Sleep(2000)
        ControlSend ( "2Moons", "", "", "{ENTER}")
	MouseClick("Left", 571,962,1);logon
	Sleep(20000)
	[COLOR="Red"]MouseClick("Left", 946,153,1);Horsea 153, Oread 135-u may change y for other shards[/COLOR]
	Sleep(2000)
	MouseClick("Left", 641,904,1);connect
	Sleep(35000)
    EndIf
EndFunc

func _Exit ()
    Exit
EndFunc

func _start ()
    AdlibEnable("Adlibfunc", 10)
    TrayTip("2Moons notice:", "script has been started", 5)
EndFunc

func _stop ()
	AdlibDisable()
	TrayTip("2Moons notice:", "script has been stopped", 5)
EndFunc

While 1
    Sleep(10)
WEnd
-itīs for 1280x1024 resolution (better chech x,y by some x,y coord program :P)

Well thats all...I am BEGGINER in scripting :D (so donīt flame me PLS)
01/24/2008 16:00 sighface#7
Question.

Can i use this to simply do auto skills? I mean when im in a pt and i want to afk, i just chuck this one so it does skills for me so i dont get kicked from pt LOL
01/25/2008 07:44 skiskiacm#8
find leggojake's sorc bot it's a little old but we designed that with autoit, just use the autoit decompiler that is provided with autoit DL
01/25/2008 21:49 wtfanoob#9
What language is this code? C++?
01/27/2008 09:07 LelouchLien#10
^Blind.

Its written, autoIT. Learn to read please bro, if you don't want to read then I don't see any reason why are you here to learn? zZz..