ratacat Posted February 12, 2005 Share Posted February 12, 2005 (edited) here is a bot for World of Warcraft, I've spent weeks working on it, sorry for the slopiness. Alright it has taken me days to discover where this problem is...At the beginning, after you execute script a yes/no msgbox comes up asking if you want to use yokkalbot.ini you'll want to put a yokkalbot.ini file in the same dir as script with these contents. [Critical] mobHPx=217 mobHPy=55 mobHEX="00A500" silvx=217 silvy=55 silvHEX="00A500" MoBwindowX=294 MoBwindowY=39 MoBwindowHEX="7D7C7D" comboX=347 comboY=44 comboHEX="B22829" hpbarLx=73 hpbarLy=55 hpbarLHEX="008A00" hpbarRx=159 hpbarRy=55 hpbarRHEX="00D000" Alright now there is one more file the program uses....it isn't necesary for this, but not having it might cause some errors. Make a file called HPcolors.txt and cp/paste this into it expandcollapse popup006C00 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 now we got that out of the way...I will post final script, uncut. When you run the script, if you select YES...you get one debug msgbox that cycles through, displaying some var's cords. If you select NO it goes into that for next loop...please observe using that previous msgbox that the vars going into the script are the same whether you get them from the hardcode or the ini file. THe particular function I am referring to is the check_health() function, it should be at the VERY bottom of the script. If you hit YES, it seems to skip that for....next loop altogether even though the variables are the exact same. I know there is a lot more code here then necesary, but I thought I'd better make sure its not something in the upper body thats causes this as a byproduct. I will be very impressed(and immensely happy) if anyone can drudge through all my bad coding habbits, much less understand it enough to explain what might be happening. expandcollapse popup; 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=1 $NumofThrowStacks=1 $getloot=1 $getskins=0 $loopsize=1700 $loopstep=200 $travel=0 $heal=1 $HP_go_defensive=45;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. $SinisterStrikekey=1 $evasionkey=7 $eviskey=2 $throwkey=5 $stealthkey=9 ;WinWaitActive("World of Warcraft") ;-------------------------Ini Preloader------------------------------- global $MoBwindowX, $MoBwindowY, $MoBwindowHEX global $comboX, $comboY, $comboHEX global $hpbarLx, $hpbarLy, $hpbarLHEX global $hpbarRx, $hpbarRy, $hpbarRHEX dim $useinternal 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" ;The position and color of a LIT UP 3rd combo point $combo3X=347 $combo3Y=44 $combo3HEX="B22829" ;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") $Combo3X=IniRead("yokkalbot.ini","Critical","combox","0") $Combo3Y=IniRead("yokkalbot.ini","Critical","comboy","0") $Combo3HEX=IniRead("yokkalbot.ini","Critical","comboHEX","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 ;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) ;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() ;loot and skin corpse if $getloot = 1 AND $i < 14 then LootCorpse() if $getskins = 1 AND $i < 14 then SkinCorpse() EndIf ;Write to log ;filewrite("yokkal_log.txt", "Mob Kills: " & $mobcount & @CRLF & "Defensive Actions :" & $defensivecount) sleep(300) ;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("{d down}") sleep(120) send("{d up}") $i = $i + 1 Send("{TAB}") ; 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 Throw() sleep(2000);wait for target to get to you ;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 = $evasionkey ;If you have less than 2 combo points ;then sinister strike, otherwise eviscerate if (hex(PixelGetColor($Combo3X,$Combo3Y),6)=$Combo3HEX) then $HotKey = $eviskey else $HotKey = $SinisterStrikekey endif ;If the Out of range! message displays, try throwing again. PixelSearch(297, 110, 505, 120, 16718362, 10, 4) if not @error then Throw() endif ;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) $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 Throw();Function to handle ranged pulling sleep(100 + Random(200));make sure you've stopped moving Send($throwkey) 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") endfunc Edited February 12, 2005 by xeonz16 Link to comment Share on other sites More sharing options...
zcoacoaz Posted February 14, 2005 Share Posted February 14, 2005 i will not help you cheat in games especially mmorpg's [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to comment Share on other sites More sharing options...
Blue_Drache Posted February 14, 2005 Share Posted February 14, 2005 i will not help you cheat in games especially mmorpg's<{POST_SNAPBACK}>@Xeno <rant>Not to be mean or anything, but was that post necessary? I realize that my post is as equally required as yours was, but if you weren't going to help then ignore the thread. Sheesh.</rant> Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
zcoacoaz Posted February 14, 2005 Share Posted February 14, 2005 sry i just dont like people using bots, thats what ruined d2 (and hacking) [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to comment Share on other sites More sharing options...
killaz219 Posted February 14, 2005 Share Posted February 14, 2005 sry i just dont like people using bots, thats what ruined d2 (and hacking)<{POST_SNAPBACK}>I agree with you on that, but Autoit is a language made for windows automation... Isn't a bot a automation just like autoinstallers? Both of them have their purpouses. Both of them have their users. Both of them take time out of the writers life. Link to comment Share on other sites More sharing options...
zeroZshadow Posted February 14, 2005 Share Posted February 14, 2005 i think i found atleast one bug you forgot the endif at the very end, just before endfunc. *If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip... Link to comment Share on other sites More sharing options...
Developers Jos Posted February 14, 2005 Developers Share Posted February 14, 2005 i think i found atleast one bug you forgot the endif at the very end, just before endfunc. <{POST_SNAPBACK}>nah.... .this is really a one line If statement ......if FileExists("HPcolors.txt") then fileclose("HPcolors.txt") SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
zeroZshadow Posted February 14, 2005 Share Posted February 14, 2005 but every if statement needs an endif...or not?? my script had that same probelm, because i just forgot one lille endif it skipped stuff *If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip... Link to comment Share on other sites More sharing options...
Developers Jos Posted February 14, 2005 Developers Share Posted February 14, 2005 but every if statement needs an endif...or not??my script had that same probelm, because i just forgot one lille endif it skipped stuff<{POST_SNAPBACK}>mmmhh... what was the statement about noob again ..... SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
zeroZshadow Posted February 14, 2005 Share Posted February 14, 2005 check the noob statement again, i apoligised!! (stupid english, dutch allot beter) *If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip... Link to comment Share on other sites More sharing options...
Developers Jos Posted February 14, 2005 Developers Share Posted February 14, 2005 check the noob statement again, i apoligised!! (stupid english, dutch allot beter)<{POST_SNAPBACK}>tuurlijk SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
zcoacoaz Posted February 15, 2005 Share Posted February 15, 2005 I agree with you on that, but Autoit is a language made for windows automation... Isn't a bot a automation just like autoinstallers? Both of them have their purpouses. Both of them have their users. Both of them take time out of the writers life.<{POST_SNAPBACK}>i guess so, there even used to be a forum for bots [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now