Code:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Version=Beta
#AutoIt3Wrapper_outfile_type=a3x
#AutoIt3Wrapper_icon=..\..\..\..\Program Files\AutoIt3\Icons\au3script_v9.ico
#AutoIt3Wrapper_outfile=..\..\Desktop\PvPBotMMO.a3x
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseX64=y
#AutoIt3Wrapper_Change2CUI=y
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
WinWaitActive("World of Warcraft")
$Button1 = HotKeySet("{F1}", "Start")
$Button2 = HotKeySet("!{F2}","Stop")
HotKeySet("{F1}", "Start")
HotKeySet("!{F2}","Stop")
TogglePause()
func Start()
HotKeySet("{F1}")
HotKeySet("{F3}", "TogglePause")
ToolTip('AntiAFK started.',0,0)
While 1
Send("{SPACE}")
Sleep(Random(120000,240000))
WEnd
EndFunc
Func TogglePause()
ToolTip('AntiAFK Stopped.',0,0)
HotKeySet("{PAUSE}")
HotKeySet("{PAUSE}", "Start")
While 1
sleep(100)
WEnd
EndFunc
func Quit()
Exit
EndFunc
#Region ### START Koda GUI section ### Form=
$PvPBotMMO = GUICreate("PvPBotMMO", 524, 447, 192, 124)
*****tFont(22, 400, 0, "Perpetua Titling MT")
*****tBkColor(0x000000)
$Button1 = GUICtrlCreateButton("Start", 8, 280, 153, 57, $WS_GROUP)
$Button2 = GUICtrlCreateButton("Stop", 8, 352, 153, 57, $WS_GROUP)
$List1 = GUICtrlCreateList("", 248, 32, 249, 380)
$PvPBotMMO = GUICtrlCreateLabel("PvPBotMMO", 8, 8, 150, 53)
GUICtrlSetFont(-1, 36, 800, 2, "Playbill")
GUICtrlSetColor(-1, 0xFF0000)
$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Lich King photo.jpg", 0, 64, 249, 209, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$PvPBot = GUICtrlCreateIcon("F:\World of Warcraft\Launcher.exe", -1, 176, 8, 48, 48, BitOR($SS_NOTIFY,$WS_GROUP))
*****tState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
$var = $Button1
If $var Then
$xTop = 30; i declare them
$yTop = 73
$xBot = 1002
$yBot = 692
$mobGreen = "0xC0BE40"; i also declare the mob color
Sleep(6000)
while 1
$coord = PixelSearch($xTop,$yTop,$xBot,$yBot,$mobGreen,5);i search for the green mobs
$n = @error
If NOT @error Then;if the mob is found
while $n = 0;while it is still in the screen
$x = Random($coord[0], $coord[0]+40, 1);we randomize coordinates so we won't miss the mob
;since mobs have different shape and sizes
$y = Random($coord[1], $coord[1]+40, 1)
MouseClick("right", $x, $y, 2, 0); i click at the randomized coordinates
$mm = PixelGetColor ( 378 , 12 ); i get the pixel color of that mob HP LIMIT
$mob = Hex($mm, 6);since the pixel i got is hex and PixelGetcolor function returns a decimal value i convert it
If $mob = "7B0000" Then; i compare the converted value i got from PixelGetColor in that point with the have i collected using AWI in the same point
ExitLoop; if it's a match (that means that the mob was selected)
;it will exit the loop and continue
EndIf
$coord = PixelSearch($xTop,$yTop,$xBot,$yBot,$mobGreen,5);we repeat the same pixel search
; the ideea is that the program will try to click the mob untill he is selected
$n = @error
wend
;in this moment we have the mob selected
If $mob = "7B0000" Then ; but we check it anyway
while $mob = "7B0000" ; so as long as the mob is selected
Send("{F4}"); we just send the skills from F4 to F1
Send("{F3}"); chaotic i know but since we use speed hack
Send("{F2}");adding waiting times will just be a waste of time
Send("{F1}")
$mm = PixelGetColor ( 378 , 12 );we once again look for the mob's HP so we can complete the while loop
$mob = Hex($mm, 6);this means that the keys will be pressed untill the mob is dead
wend
Send("{Space}"); after the mob is dead we collect the items
Sleep(200)
Send("{Space}")
Sleep(200)
Send("{Space}")
Sleep(200)
EndIf
;now remember the "IF NOT @error Then" from the start?
;what if there is no mob in the screen?
;what then?
Else;if no mob is found
Send("{Right 7}") ;rotate the camera to look in other directions
Endif
Wend
EndIf
; ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : EndIf = ' & EndIf & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console