Register for your free account! | Forgot your password?

You last visited: Today at 07:54

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

 

Autoit help please

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2004
Posts: 30
Received Thanks: 0
This is basically the old yokkalbot, with some changes ive made to try with my lvl 27 hunter. Basically, I want it to work like this:
1) find mob
2) hit "macro" which is a simple ingame macro that tells pet to attack and casts hunter's mark
3) waits a few sec to let pet get aggro, and then hits serpent sting key which also initiates autoshoot
4) I tried to set the defensive actions to use mend pet twice in a row, but I need help using the pets health bar instead of mine

I was also thinking maybe make a loop that would alternate between hitting autoattack and autoshot keys after serpent sting. That way I could still attack in melee if I go aggro.

There is also something wrong with the end function for check hp.
Here it is:
Code:
;            yokkalbot2.1
;
;
;  Creation and Design by ---> Yokkal <---
;
;          For compilation by AutoIt3
;      [http://www.hiddensoft.com/autoit3/index.php]
;Editing, documentation, and additional content by
;
;DarkOmNi
;Dakr
;Haiku
;xeonz16


;scroll down to bot options settings, for configuration control

;--------------------------------------VERSION 2.2--------------------------------------
;fixed lots of small bugs, added in general code improvements, new splash window that updates
;bot stats in realtime. Hope this works better then the last. The most recent version of
;yokkalbot can be obtained at warcraft.smashingplates.com

;------------------VERSION 2.1 is here-------------------------------------
;Several Big Changes. First off added support to use yokkalbot.ini to set your local variables
;rather then changing them all in script. Also added the ability to turn travel off...so
;yokkalbot doesn't run in crazy circles unless thats your thing.

;----------------Bot OPTIONS-----------------------------------------------
;Simply to make it harder for you to be detected or optimize performance.
;These are non-essential and you can leave them as default if you wish.
;Figure_Eight=1 not very stable yet...over a period of time you will 'migrate'
;Figure_Eight=0 to travel in smaller circle, that sticks in one area
;getloot=1 stops after each kill to loot corpse...misses some now and then
;  but most is better then none.
;getskins=1 skins corpse and collects skin after loot...you must enable getloot
;  in order for getskins to work properly.
;Loopsize is the number of milliseconds the bot waits before 'turning' one click while
;  it is running in circles. Hence smaller loopsize reduces affect of 'migration' but
;  larger loopsize allows bot to cover more area. Suggest: 900 -> 3000
;Loopstep is the number of milliseconds that the 'turn' key is depressed. Aka the measurement
;  of one loopsize 'click'. Longer Loopstep, smaller loop Suggest: 50 -> 400
;if you are having really bad spiraling migration, you should experiment with these two settings
;$dir="C:\unzipped\yokkalbot"
$waitFORhealth=90;percentage
$figure_eight=0
$use_stealth=0
$NumofThrowStacks=0
$getloot=1
$getskins=1
$loopsize=1700
$loopstep=200
$travel=1
$heal=1
$HP_go_defensive=40;percent that hps must hit to enable 'defensive' actions
$healthcheckSTEP=8;increment to scan health in....I don't recomend you change this too much.
;5-15 is a good range...the higher it is, the less stress on your comp, but the higher it is
;set the less accurate your health scanner is. a number 5 means it only updates every fifth % point.
;$logdirectory="C:\Logs"
;un comment above line and add in your own directory to change where logs go
;leave commented out if you want the log to go into the same directory as
;the script(.au3) or exe


;----------------WoW Hotkeys------------------------------------------------
;These are simply what number you would normally hit on your keyboard to
;fire off the given skill. All the skills need to be on the same skillbar.
;if you set evasionkey to a slot that holds healing potions, you get a similar result.
$macrokey=1
$serpentstingkey=6
$mendpetkey=9


;WinWaitActive("World of Warcraft")
;-------------------------Ini Preloader-------------------------------
global $MoBwindowX, $MoBwindowY, $MoBwindowHEX
global $hpbarLx, $hpbarLy, $hpbarLHEX
global $hpbarRx, $hpbarRy, $hpbarRHEX

dim $useinternal
dim $answer
if FileExists("yokkalbot.ini") then
$answer = MsgBox(4, "Yokkalbot", "Import custom run variables from yokkalbot.ini?")
endif

if $answer = 7 then
;\---------------Essential Control Variables--------------
;You must configure the below variables to fit your machine, otherwise the bot
;simply will not work. The preset options are in 800x600 Windowed and
;maximized. If you don't want to mess with these variables then toggle windowed
;mode under Video Options in WoW, AND hit the maximize square next to the 'X' on the top corner
;of the window to secure it's size. Reset your WoW gamma to zero if you have changed it
;and set your desktop screen resolution to 800x600.

;mob @ 20%hp just get x,y cord and HEX color of mob's health bar when its about 20%
;$MobAt20hpX=217
;$MobAt20hpY=55
;$MobAt20hpHEX="00A500"

;Silver part somewhere on the mob portrait
$MoBwindowX=294
$MoBwindowY=39
$MoBwindowHEX="7D7C7D"

;HP bar far Left side...middle
$hpbarLx=73
$hpbarLy=55
$hpbarLHEX="008A00"

;HP bar far right side...middle
$hpbarRx=159
$hpbarRy=55
$hpbarRHEX="00D000"

else
  
$MobAt20hpX=IniRead("yokkalbot.ini","Critical","mobHPx","0")
$MobAt20hpY=IniRead("yokkalbot.ini","Critical","mobHPx","0")
$MobAt20hpHEX=IniRead("yokkalbot.ini","Critical","mobHPHEX","0")
  
$MoBwindowX=IniRead("yokkalbot.ini","Critical","silvx","0")
$MoBwindowY=IniRead("yokkalbot.ini","Critical","silvy","0")
$MoBwindowHEX=IniRead("yokkalbot.ini","Critical","silvHEX","0")

$hpbarLx = IniRead("yokkalbot.ini","Critical","hpbarLx","0")
$hpbarLy = IniRead("yokkalbot.ini","Critical","hpbarLy","0")
$hpbarLHEX = IniRead("yokkalbot.ini","Critical","hpbarLHEX","0")
  
$hpbarRx = IniRead("yokkalbot.ini","Critical","hpbarRx","0")
$hpbarRy = IniRead("yokkalbot.ini","Critical","hpbarRy","0")
$hpbarRHEX = IniRead("yokkalbot.ini","Critical","hpbarRHEX","0")
  
  msgbox(0, "yokkalbot 2.2", "Local Variables Imported from " & @crlf & "  > yokkalbot.ini <")
endif
;msgbox(0, "Left", $hpbarLx & ", " & $hpbarLy & @CRLF & $hpbarLHEX)
;msgbox(0, "Right", $hpbarRx & ", " & $hpbarRy & @CRLF & $hpbarRHEX)



;------------Mainloop Control Variables-----------------------------------------------
;leave these alone
Dim $Botting=0
Dim $Walking=0
Dim $Attacking=0
Dim $debugmode=1
Dim $mobcount=0
dim $i, $looted=0
dim $botmode = "Waiting..."

;----------------Setting AutoIt3 Internal Hotkeys--------------------------------------
;at the moment 'F8', 'F10', 'ESC', and 'PAUSE' are preset hotkeys, hitting these keys at any
;time during the script will take it to a pre-designated function. Feel free to add your
;own once you get the hang of it.
;
;for now just remember to hit 'esc' if anything goes badly wrong, the whole script will term
;
;Hotkeyset("{A}", "B")
;A = key to press on your keyboard
;B = Function that Key starts up
;Remeber you actually need to declare a function for this to work

global $splash_message
$EmergencyTerminate="ESC"
$Startbot="F5"
$Stopbot="F6"

dim $mobcount, $startmin = @min, $starthour = @hour, $mins_running, $logdirectory, $HPAT
global $hp_percent
$defensivecount = 0

;-----------------------------------NO VARIABLES below THIS LINE---------------------

HotkeySet("{F8}","Debug")
HotkeySet("{F9}","check_health")
HotkeySet("{F10}","debugmode")
HotkeySet("{" & $startbot & "}","StartBot")
HotkeySet("{" & $stopbot & "}","StopBot")
HotKeySet("{" & $EmergencyTerminate & "}", "Terminate")


$splash_message = "Waiting for Logon..." & @CRLF & "ESC - Terminate" & @CRLF & "F5 - Start Bot"
update_splash()
;----------------------- Main Control Loop ---------------------------------------
;if fileexists("yokkal_log.txt") then
;filedelete("yokkal_log.txt")
;endif
;$file = fileopen("yokkal_log.txt", 2)
While 1; endless loop
;msgbox(0, "Main", "Mainloop")
$splash_message = "Waiting..." & @crlf & "F5 - Start Bot"
  update_splash()
  sleep(1000);saves cycles when script is on, but you haven't hit f5
  If $Botting=1 Then
  
  &#59;Wait til your health is full, unless something hits you
    While $hp_percent <= $waitFORhealth
      $splash_message = "Healing..." & @crlf & "Kills: " & $mobcount & @CRLF & "Corpses Looted: " & $looted & "ESC - Terminate"
      update_splash()
        sleep(350)
     &#59;if mob is selected then it restarts Attack loop
        If (hex(PixelGetColor($MoBwindowX,$MoBwindowY),6)=$MoBwindowHEX) then
         AttackTarget()
        EndIf
    WEnd
  if $travel = 1 then
  FindTarget()
  endif
   scan()
  if (hex(PixelGetColor($MoBwindowX,$MoBwindowY),6)=$MoBwindowHEX) then AttackTarget()
 &#59;loot and skin corpse
  if $getloot = 1 AND $i < 14 then LootCorpse()
  if $getskins = 1 AND $i < 14 then SkinCorpse()
  EndIf
 &#59;Write to log
 &#59;filewrite("yokkal_log.txt", "Mob Kills: " & $mobcount & @CRLF & "Defensive Actions :" & $defensivecount)
  sleep(300)
 &#59;fileclose($file)
  sleep(500)  
WEnd

;----------------------------------Declare All Functions Below----------------------------------------------

;skincordx and skincordy are set in the lootcorpse() function depending where it found the corpse
;as of now it just checks three different cords, but more would be easily added.
Func SkinCorpse()
  $splash_message = "Skinning..." & @crlf & "Kills: " & $mobcount & @CRLF & "Corpses Looted: " & $looted & "ESC - Terminate"
  update_splash()
  mouseclick("right", $skincordx, $skincordy)
  sleep(5000)
  mouseclick("right", 32, 164)
  mouseclick("left", 135, 113)
sleep(500)
Endfunc

Func LootCorpse()
  $mobcount = $mobcount + 1
  $splash_message = "Looting..." & @crlf & "Kills: " & $mobcount & @CRLF & "Corpses Looted: " & $looted & "ESC - Terminate"
  mouseclick("right", 403, 433)
  $skincordx = 403
  $skincordy = 433
  sleep(700)
  if pixelgetcolor(31, 105) = 0 then $looted = $looted + 1
If NOT pixelgetcolor(31, 105) = 0 then
  Mouseclick("right", 405, 361)
  $skincordx = 405
  $skindcordy = 361
  sleep(700)
  if pixelgetcolor(31, 105) = 0 then $looted = $looted + 1
endif
If NOT pixelgetcolor(31, 105) = 0 then
  Mouseclick("right", 304, 407)
  $skincordx = 304
  $skindcordy = 407
  sleep(700)
  if pixelgetcolor(31, 105) = 0 then $looted = $looted + 1
endif
sleep(500)
mouseclick("right", 32, 164)
sleep(100)
mouseclick("right", 32, 203)
sleep(100)
if pixelgetcolor(31, 105) = 0 then mouseclick("left", 135, 113)
sleep(100)
endfunc


Func FindTarget();Runs around til it finds a target
$splash_message = "Waiting about 5 seconds..." & @crlf & "Kills: " & $mobcount & @CRLF & "Corpses Looted: " & $looted & "ESC - Terminate"
update_splash()
sleep(5000)
$splash_message = "Scanning for enemies..." & @crlf & "Kills: " & $mobcount & @CRLF & "Corpses Looted: " & $looted & "ESC - Terminate"
update_splash()
Scan()
$splash_message = "Moving..." & @crlf & "Kills: " & $mobcount & @CRLF & "Corpses Looted: " & $looted & "ESC - Terminate"
update_splash()
Sleep(100)
If NOT (hex(PixelGetColor($MoBwindowX,$MoBwindowY),6)=$MoBwindowHEX) then
  While NOT (hex(PixelGetColor($MoBwindowX,$MoBwindowY),6)=$MoBwindowHEX)
      If $figure_eight = 1 then
        $z = $z + 1
        if $z < 14 then
          send("{w down}")
          send("{d up}")
          Send("{a down}")
        endif
        if $z >= 14 then
          send("{w down}")
          Send("{a up}")
          send("{d down}")
        endif
        if $z = 28 then $z = 0
      endif
      
      if $figure_eight = 0 then
      send("{w down}")
      send("{d down}")
      endif
      
     sleep($loopstep);I removed a random function here...if you randomize the circle you will migrate
     Send("{a up}")
     send("{d up}")
     sleep($loopsize)
     Send("{TAB}")
  WEnd
send("{w up}")        
EndIf
EndFunc



Func Scan();Spins a circle in place looking for a target
$splash_message = "Scanning..." & @crlf & "Kills: " & $mobcount & @CRLF & "Corpses Looted: " & $looted & "ESC - Terminate"
update_splash()
$i = 0
sleep(500)
if $use_stealth = 1 then send($stealthkey)
While NOT (hex(PixelGetColor($MoBwindowX,$MoBwindowY),6)=$MoBwindowHEX) AND $i < 14
  send("{RIGHT down}")
    sleep(120)
    send("{RIGHT up}")
    $i = $i + 1
    Send("{TAB}")&#59; find a Mob
    sleep(100)
Wend
EndFunc



Func AttackTarget();Attacks the target
Dim $HotKey = 2
$splash_message = "FIGHTING..." & @crlf & "Kills: " & $mobcount & @CRLF & "Corpses Looted: " & $looted & @CRLF & "ESC - Terminate"
update_splash()
;pull
Pull()
sleep(2000);wait for pet to go and get aggro

;While the mob is still selected(game unselects it if it dies)
While (hex(PixelGetColor($MoBwindowX,$MoBwindowY),6)=$MoBwindowHEX)
  check_health()
;auto defense system
  $defhotkey = $mendpetkey
 &#59;Sperent sting and start autoattack
	Send($serpentstingkey)
  
 &#59;If the Out of range! message displays, try throwing again.
  PixelSearch(297, 110, 505, 120, 16718362, 10, 4)
  if not @error then
  Send("{UP down}")
  Sleep(800)
  Send("{UP up}")
  endif
   
 &#59;Do the Attack
    $splash_message = "FIGHTING..." & @crlf & "Kills: " & $mobcount & @CRLF & "Corpses Looted: " & $looted & "ESC - Terminate"
  update_splash()
      if $hp_percent <= $HP_go_defensive then
  	Send($defhotkey)
	Sleep(5000)
	Send($defhotkey)
  $defensivecount = $defensivecount + 1
  endif
  Send($HotKey)
  Sleep(1200)
WEnd
EndFunc

func update_splash ()
check_health()
$endmin = @min
$endhour = @hour

if $endmin >= $startmin then
$mins_running = $endmin - $startmin
else
$mins_running = (60 - $startmin) +$endmin
endif

if $endhour >= $starthour then
$hours_running = $endhour - $starthour
else
$hours_running = (24 - $starthour) + $endhour
endif


SplashTextOn( "yb", "Apr. Hp%: " & $hp_percent & @CRLF & "Use Defense: " & $defensivecount & @CRLF & @CRLF & $splash_message & @CRLF & "Hours: " & $hours_running & @CRLF & "Mins: " & $mins_running , 120 , 160 ,695 ,299 , 17, "", 8)
EndFunc

Func Pull();Function to handle ranged pulling
sleep(100 + Random(200));make sure you've stopped moving
Send($macrokey)
sleep(100)
EndFunc



Func StartBot()
WinActivate("World of Warcraft")
$Botting=1
EndFunc

Func StopBot()
$Botting=0
$mobcount=0
If $walking Then
send("{UP}")
$walking=0
EndIf
EndFunc

Func TogglePause()
  $Paused = NOT $Paused
  While $Paused
    sleep(1000)
    ToolTip('Script is "Paused"',0,0)
  WEnd
  ToolTip("")
EndFunc

Func Terminate()
  $endmin = @min
  $endhour = @hour
  traytip("yokkalbot2.1", "yokkalbot is TERMINATING..." & @crlf & "Kills: " & $mobcount & @CRLF & "Corpses Looted: " & $looted, 500)
;mouseclick("left", 588, 532, 1, 0)
;mouseclick("left", 620, 479, 1, 0)
  send("{a up}")
  send("{d up}")
  send("{w up}")
  sleep(2200)
  Exit 0
EndFunc


Func Debug()
$pos = MouseGetPos()
$coords = ("X: " & $pos[0] & " Y: " & $pos[1] & " Hex: " & hex(PixelGetColor($pos[0],$pos[1]),6))
FileWriteLine("Debugcords.txt",$coords)
EndFunc

Func Debugmode()
$debugmode=1
Endfunc

func check_health()
;msgbox(0, "check", "get to healthloop?")
fileopen("HPcolors.txt", 0)
$distancebar = $hpbarRx - $hpbarLx
$HBAR_RX = $hpbarRx
sleep(100)
  msgbox(0, "precheckhealth", $hpbarLx & " to " & $HBAR_RX)
  for $step = $hpbarLx to $HBAR_RX step $healthcheckSTEP
  msgbox(0, "checkhealth for next", "this loop firing?")
  $gotcolor = hex(pixelgetcolor($step, $hpbarLy), 6)
    for $stepcolor = 1 to $distancebar
    $filecolor = filereadline("HPcolors.txt", $stepcolor)
    if $gotcolor = $filecolor then
    $HPAT = $step
    endif
    next
  next
  $hp_pixel_dist = $HPAT - $hpbarLx
  $hp_percent = int(number((($hp_pixel_dist / $distancebar) + .07)*100))
if FileExists("HPcolors.txt") then fileclose("HPcolors.txt")
endif
endfunc
You also need to make a HPcolors.txt file
Code:
006C00
009700
009D00
009D00
00A400
00A500
00A500
00A500
00A500
00A500
00AE00
00AE00
00AE00
00AE00
00AE00
00AF00
00B600
00B600
00B700
00BC00
00BC00
00BE00
00C100
00C100
00C200
00C400
00C400
00C700
00C900
00C900
00CB00
00CC00
00CC00
00D000
00D100
00D100
00D100
00D100
00D100
00D100
00D100
00D100
00D100
00D100
And finally the yokkalbot.ini file
Code:
[Critical]
mobHPx=217
mobHPy=55
mobHEX="00A500"

silvx=217
silvy=55
silvHEX="00A500"

MoBwindowX=294
MoBwindowY=39
MoBwindowHEX="7D7C7D"

hpbarLx=73
hpbarLy=55
hpbarLHEX="008A00"

hpbarRx=159
hpbarRy=55
hpbarRHEX="00D000"
I think I removed most of the combo points for rogues crap. I left in something about stealth but set the value to 0 so it won't matter.

I'm sort of a noob to programming, so open to all suggestions.
Thanks



NWO is offline  
Reply



« Previous Thread | Next Thread »



All times are GMT +1. The time now is 07:54.


Powered by vBulletin®
Copyright ©2000 - 2016, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy
Copyright ©2016 elitepvpers All Rights Reserved.