There u go
Script Start - Add your code below here
if NOT FileExists(@ScriptDir & "\splash.jpg") Then
MsgBox(0, "No-Go", "The splash image must remain in order to use this bot.")
ProcessClose(@AutoItPID)
EndIf
$y = @DesktopHeight/2-200
$x = @DesktopWidth/2-200
SplashImageOn("", @ScriptDir & "\splash.jpg", 400, 400, $x, $y, 1)
sleep(5000)
SplashOff()
$title = AutoItWinGetTitle()
$handle = ControlGetHandle("KalOnline", "", "")
MsgBox(64, "Instructions", "Put your mouse over the area" & @CRLF & "of your health bar that when reached," & @CRLF & "the bot will auto-pot. When done, press enter.")
$hcoord = MouseGetPos()
$healthcolor = PixelGetColor($hcoord[0], $hcoord[1])
MsgBox(64, "Instructions", "Now do the same thing, except put it over the demon/monster that you want to kill, and press enter.")
$dcoord = MouseGetPos()
$demoncolor = PixelGetColor($dcoord[0], $dcoord[1])
MsgBox(64, "Instructions", "Ok, now one more time. This time, click on a demon but don't attack, just click off. Now hold your mouse" & @CRLF & " over the very left of the demon's health bar (still on the red part). When you do that, press enter.")
$dhcoord = MouseGetPos()
$demonhealth = PixelGetColor($dhcoord[0], $dhcoord[1])
$attacking = $dhcoord
$attacking[0] = $attacking[0]+110
$atk = PixelGetColor($attacking[0], $attacking[1])
If $atk <> $demonhealth Then
$isred = False
While $isred == False
$attacking[0] = $attacking[0]-5
$atk = PixelGetColor($attacking[0], $attacking[1])
if $atk == $demonhealth Then
$isred = True
EndIf
WEnd
EndIf
MsgBox(0, "OK!", "Ok, now we have the coordinates of your health bar, the demon health bar, and the color of the demons." & @CRLF & "If you want to behead monsters, set it as your active skill.")
WinSetOnTop("KalOnline", "", 0)
Dim $behead[7][7]
$winpos = WinGetPos("KalOnline")
$winx = $winpos[0]
$winy = $winpos[1] + 100
$winy2 = $winpos[1] + 200
$width = $winpos[2]-10
$height = $winpos[3] - 100
$battle = "no"
$right = $winx + $width
$bottom = $winy + $height
$behead[0][0] = "404" + $winx
$behead[0][1] = "405" + $winy - 100
$behead[1][0] = "366" + $winx
$behead[1][1] = "351" + $winy - 100
$behead[2][0] = "406" + $winx
$behead[2][1] = "351" + $winy - 100
$behead[3][0] = "446" + $winx
$behead[3][1] = "351" + $winy - 100
$behead[4][0] = "403" + $winx
$behead[4][1] = "316" + $winy - 100
$timeset = False
$dummy = 1
While $dummy == 1
$pcoords = PixelSearch($winx, $winy2, $right, $bottom, $demoncolor, 25)
If @error Then
;MsgBox(0, "Nothin'", "No demons nearby...", 1)
WinActivate($title)
$nothing = "nope"
$pcoords = PixelSearch($winx, $winy, $right, $bottom, $demoncolor, 25)
EndIf
If @error Then
;MsgBox(0, "Nothin'", "Nothing here...", 1)
WinActivate($title)
$nothing = "nope"
Else
$nothing = "yep"
EndIf
If $nothing = "yep" Then
;MsgBox(0, "Located", "Found one!", 1)
WinActivate($title)
If $pcoords[1]-$winy > 300 Then
$pcoords[1] = $pcoords[1]+5
EndIf
MouseClick("main", $pcoords[0], $pcoords[1], 1, 30)
Sleep(1000)
$tdh = PixelGetColor($dhcoord[0], $dhcoord[1])
Sleep(1000)
If $tdh = $demonhealth Then
$battle = "yes"
Else
MsgBox(0, "Oops", "Misclick...", 1)
WinActivate($title)
MouseClick("main", $behead[2][0], $behead[2][1], 1, 30)
Sleep(2000)
EndIf
EndIf
$myhealth = PixelGetColor($hcoord[0], $hcoord[1])
If $myhealth <> $healthcolor Then
ControlSend("KalOnline", "", $handle, "4")
Sleep(1000)
EndIf
If $battle == "yes" Then
If $timeset = False Then
$begint = TimerInit()
EndIf
$timeset = True
While $battle == "yes"
$tcheck = TimerDiff($begint)
If $timeset = true And $tcheck > 30000 Then
MsgBox(0, "Uh-Oh", "Assuming Misclick...", 1)
$battle = "no"
ControlSend("KalOnline", "", $handle, "{LEFT down}")
Sleep(3000)
ControlSend("KalOnline", "", $handle, "{LEFT up}")
Sleep(1000)
$timeset = False
ExitLoop
EndIf
$myhealth = PixelGetColor($hcoord[0], $hcoord[1])
If $myhealth <> $healthcolor Then
ControlSend("KalOnline", "", $handle, "4")
Sleep(1000)
EndIf
$demonh = PixelGetColor($dhcoord[0], $dhcoord[1])
If $demonh <> $demonhealth Then
MsgBox(0, "Dead", "He's dead...", 1)
$deadleft = $winx+200;
$deadright = $winx+600
$deadbottom = $winy+$height-100
$winy3 = $winy2 + 50
Dim $find_dead[5][5]
$find_dead = PixelSearch($deadleft, $winy3, $deadright, $deadbottom, $demoncolor, 10)
If NOT @error Then
$find_dead[0] = $find_dead[0] + 10
MouseClick("secondary", $find_dead[0], $find_dead[1], 1, 30)
Sleep(1000)
Else
MouseClick("secondary", $behead[0][0], $behead[0][1], 1, 30)
MouseClick("secondary", $behead[1][0], $behead[1][1], 1, 30)
MouseClick("secondary", $behead[2][0], $behead[2][1], 1, 30)
MouseClick("secondary", $behead[3][0], $behead[3][1], 1, 30)
MouseClick("secondary", $behead[4][0], $behead[4][1], 1, 30)
MouseClick("secondary", $pcoords[0], $pcoords[1], 1, 30)
EndIf
ControlSend("KalOnline", "", $handle, "{SPACE}")
Sleep(1000)
ControlSend("KalOnline", "", $handle, "{SPACE}")
Sleep(1000)
ControlSend("KalOnline", "", $handle, "{SPACE}")
Sleep(1000)
ControlSend("KalOnline", "", $handle, "{SPACE}")
Sleep(1000)
$battle = "no"
EndIf
WEnd
$timeset = False
EndIf
If $nothing = "nope" Then
ControlSend("KalOnline", "", $handle, "{LEFT down}")
Sleep(2000)
ControlSend("KalOnline", "", $handle, "{LEFT up}")
Sleep(1000)
EndIf
WEnd