I just made this Autoit bot. I see a lot of people using very primitive macros to spam "1". These are really obvious and will probably get you reported fast. This bot checks for mobs, then attacks and casts skills with random sleep times. It also has functionality to log out after a set amount of time, and then log back in. This should be a solid framework to develop further autoit bots.
I made the bot to run events, but it can definitely have more uses. You could easily program it yourself to run certain circuits if you like...
Instructions:
1. Open SciTE script editor
2. Make a new .au3 file and paste in the script
3. Set the resolution to your screen
4. Change the skills, if necessary (DO NOT remove any numbers here. If you don't want to cast a specific skill, list a different skill twice.)
5. Compile the script
6. Close SciTE and open the script "as administrator".
7. Open Guild Wars, change it to "FULLSCREEN WINDOWED" or it will not work!!!
8. Press "=" on your keyboard to start script. "x" stops script.
9. DO: +Rep, contribute, help other users in the thread, share good spots you found, give thanks, et cetera.
DO NOT PM me asking where to use it!!
Changelog:
1.0.6 Added a check to make sure the mob is in range before attacking.
1.0.5 Fixed a problem people were having where the bot would find a target but not attack, added instructions.
1.0.4 Fixed bugs with pixelsearch, logout, fixed a bug where script won't stop attacking.
1.0.3 Changed pixelsearch--hopefully it works now for you!
1.0.2 Cleaned up functions, added x/yrat to logout/in functions
1.0.1 Added logout, fixed small bugs
Code:
;+++ AFK BOT 1.0.6 by Tomatoes99. +++
#RequireAdmin
Global $Paused, $Go = False, $c = 0, $r = 0
;=====Edit Settings here:
HotKeySet("=", "Begin") ;script toggled on/off by pressing =
HotKeySet("{PAUSE}", "TogglePause") ;script toggle pause by pressing Pause/Break key
HotKeySet("x", "Stop") ;script stopped by pressing x
$playtime = 3 ;Time to spend playing, in hours
$logouttime = 1 ;Time to spend logged out, in hours
dim $skills[7]=["2", "3", "4", "5", "6", "7", "8"] ;keys your skills are bound to (DON'T CHANGE THE NUMBER OF SKILLS UNLESS YOU KNOW WHAT YOU ARE DOING!)
$xresolution = 1920 ;Put your X screen resolution here.
$yresolution = 1080 ;Put your Y screen resolution here.
;Do not change this:
$xrat = $xresolution/1366
$yrat = $yresolution/768
While 1
If $Go Then
$c = 0
if CheckEvent() then ;If a mob is found and in range...
call("DoEvent") ;Attack and cast a random skill
ElseIf $r >= $playtime*3600000 Then ;If no mobs are found/in range, check if it is time to logout
call("Logout")
randsleep($logouttime*3600000)
call("Login")
$r = 0
else ;Otherwise, sleep for 10 seconds
sleep(10000)
$r +=10000
endif
endif
WEnd
Func CheckEvent() ; Look for a mob for 15 seconds.
do
$c +=1
$r +=1000
Randsleep(900)
send("{TAB}")
randsleep(100)
PixelSearch($xresolution/2 -178, 86, $xresolution/2 + 74, 99, 0x972115, 5)
If not @error and Checkrange() Then
return true
exitloop
endif
until $c >=15
$c = 0
EndFunc ; >CheckEvent
Func CheckRange() ; Check for the red range indicator at the bottom of the first skill box.
PixelSearch($xresolution/2 - 320, $yresolution - 22, $xresolution/2 - 270, $yresolution - 18, 0x911500, 3)
If @error Then
return true
endif
EndFunc ; >CheckRange
Func DoEvent() ;Spend 3 seconds attacking.
$r +=3000
RandSkill()
Shoot1(1.5)
EndFunc ; >DoEvent
Func Shoot1($seconds)
Do
$c += 1
send("1")
randsleep(200)
Until $c >= ($seconds * 5)
$c = 0
EndFunc ; >Shoot1
Func RandSkill()
send($skills[random(0,6,1)])
randsleep(1500)
EndFunc ; >RandSkill
Func Logout()
MouseClick("left", 18*$xrat, 18*$yrat)
sleep(200)
MouseClick("left", 666*$xrat, 427*$yrat)
sleep(200)
MouseClick("left", 693*$xrat, 429*$yrat)
EndFunc ; >Logout
Func Login()
MouseClick("left", 475*$xrat, 670*$yrat)
sleep(200)
MouseClick("left", 472*$xrat, 673*$yrat)
sleep(25000)
send("{ENTER}") ;close overflow msg
EndFunc ; >Login
func RandSleep($ms) ; Sleeps + or - 25% of amount
sleep($ms*random(.75,1.25))
endfunc ; >RandSleep
Func Begin()
$Go = Not $Go
EndFunc ; >Begin
Func TogglePause()
$Paused = Not $Paused
While $Paused
Sleep(100)
WEnd
EndFunc ; >TogglePause
Func Stop()
Exit
EndFunc ; >Stop
Scorps1 added the ability to check if you are low health, and if you are it will heal you:
Originally Posted by
scorps1
Code:
Func DoEvent() ;Spend 3 seconds attacking.
$r +=3000
RandSkill()
Shoot1(1.5)
checkhealth() ; this is where i am inserting the new function unless you have a better suggestion
EndFunc ; >DoEvent
Func checkhealth() ; check health and if below ~75% heal me
PixelSearch([x1], [y1], [x2], [y2], [red color], 15)
If @error Then
Send("6")
EndIf
EndFunc ; >checkhealth
note: i have refrained from inserting x/y coordinate conversions and colors etc. as they are easy to get through the info tool yourself.
oh, and don't forget to change the skills array for "6" to something else.