Here are the main functions the bot performs:
1) Makes sure you're all healed up (or mostly healed)
2) Runs around in a circle tabbing for monsties
3) Once it finds one, he stops and throws a knife then waits a few secs for the monstie to run to him
4) Uses SS/Evis. to kick the mob's ass until it is dead
5) Equips new throwing knives when you run out (so you can do more than 200 runs at a time)
----------
So here's the code:
Code:---------- Dim $Botting=0 Dim $Walking=0 $Start=IniRead("config_rogue.ini","Whatevs","StartMe","0") $Stop=IniRead("config_rogue.ini","Whatevs","StopMe","0") $mx=IniRead("config_rogue.ini","Whatevs","MonsterPixelX","0") $my=IniRead("config_rogue.ini","Whatevs","MonsterPixelY","0") $mph=IniRead("config_rogue.ini","Whatevs","MonsterPixelHex","0") $num=IniRead("config_rogue.ini","Whatevs","NumThrowStacks","0") $mdx=IniRead("config_rogue.ini","Whatevs","MonsterDetectX","0") $mdy=IniRead("config_rogue.ini","Whatevs","MonsterDetectY","0") $mdh=IniRead("config_rogue.ini","Whatevs","MonsterDetectHex","0") $Heal=IniRead("config_rogue.ini","Heal","UseHeal","0") $hx=IniRead("config_rogue.ini","Heal","HealPixelX","0") $hy=IniRead("config_rogue.ini","Heal","HealPixelY","0") $hph=IniRead("config_rogue.ini","Heal","HealPixelHex","0") $Attack1=IniRead("config_rogue.ini","Attack","Attack1","0") $Attack2=IniRead("config_rogue.ini","Attack","Attack2","0") $AttackThrow=IniRead("config_rogue.ini","Attack","AttackThrow","0") $Sleep1=IniRead("config_rogue.ini","Attack","Sleep","0") $SleepAfterThrow=IniRead("config_rogue.ini","Attack","SleepAfterThrow","0") HotkeySet("{F8}","Debug") HotkeySet("{" & $Start & "}","StartBot") HotkeySet("{" & $Stop & "}","StopBot") HotkeySet("{F7}","Ex") ;----------------------- Main code --------------------------------------- $n = 0 While $n <= $num $i = 0 While $i<200 If $Botting=1 Then While NOT hex(PixelGetColor($hx,$hy),6)=$hph Sleep(200) WEnd Do If $Botting=1 Then Walk() Send("{TAB}") EndIf Until hex(PixelGetColor($mx,$my),6)=$mph If $Botting=1 Then Attack() EndIf Else $i=0 EndIf $i=$i+1 WEnd $n=$n+1 Equip() WEnd ;--------------------------------------------------------------------------- Func Walk() If NOT $walking Then send("{NUMLOCK toggle}") $walking=1 EndIf MouseClickDrag("right",187,387,390,317,10) send("{UP}") $walking=0 sleep(160+random(40)) EndFunc Func Attack() If $walking Then send("{UP}"); $walking=0 EndIf If hex(PixelGetColor($mx,$my),6)=$mph THEN Send($AttackThrow) Sleep($SleepAfterThrow) While hex(PixelGetColor($mx,$my),6)=$mph Send($Attack1) Sleep($Sleep1) WEnd Sleep($Sleep1) Sleep($Sleep1) Sleep($Sleep1) Sleep($Sleep1) Send($Attack2) While hex(PixelGetColor($mdx,$mdy),6)=$mdh Sleep($Sleep1) Send($Attack1) WEnd EndIf EndFunc Func Equip() Send("b") Sleep(200) Send("c") Sleep(200) If $n=1 Then MouseClick("left", 683, 445) Sleep(200) MouseClick("left", 179, 423) EndIf If $n=2 Then MouseClick("left", 716, 445) Sleep(200) MouseClick("left", 179, 423) EndIf If $n=3 Then MouseClick("left", 748, 445) Sleep(200) MouseClick("left", 179, 423) EndIf If $n=4 Then MouseClick("left", 782, 445) Sleep(200) MouseClick("left", 179, 423) EndIf Sleep(200) Send("{ESC}") Sleep(200) EndFunc Func StartBot() $Botting=1 EndFunc Func StopBot() $Botting=0 If $walking Then send("{UP}") $walking=0 EndIf EndFunc Func Ex() ProcessClose("bot_rogue.exe") EndFunc Func Debug() $pos = MouseGetPos() MsgBox(0, "Debug", "MonsterPixelHex: " & hex(PixelGetColor($mx,$my),6) & " HealPixelHex: " & hex(PixelGetColor($hx,$hy),6) & " X: " & $pos[0] & " Y: " & $pos[1] & " Hex: " & hex(PixelGetColor($pos[0],$pos[1]),6)) EndFunc
----------
And this is my config_rogue.ini :
----------
Now to the explanation. I blocked in the "main code" section, so all the other functions are called either by hotkeys or by that code. To start the bot, just load it up while in an area with monsters and press F5. F6 stops the bot. Oh and I put an emergency exit hotkey (F7) in case anything goes terrribly wrong and the bot starts eating babies or something similar.Code:[Whatevs] StartMe=F5 StopMe=F6 MonsterPixelX=229 MonsterPixelY=69 MonsterPixelHex=00AF00 MonsterDetectX=205 MonsterDetectY=69 MonsterDetectHex=007800 NumThrowStacks=1 [Heal] UseHeal=1 HealPixelX=138 HealPixelY=69 HealPixelHex=00CD00 [Attack] Attack1="1" Attack2="2" Sleep1=200 AttackThrow="7" SleepAfterThrow=2000 ----------
Also, let me point out that the HEX of the pixels, and maybe even the pixels themselves (the numerical values) will probably be different for you. You will have the find these yourself, but it should be easy because I have put in a function that will display the hex of the coordinates you put in for MonsterPixelX/Y, MonsterDetectX/Y, and HealPixelX/Y. In addition, this function will display the current corrdinates of the mouse, as well as the hex for that position. The hotkey is F8 for this.
So now I'm going to explain that the variables in the config_rogue.ini are. StartMe and StopMe are obviously the start and stop bot hotkeys. MonsterPixelX, MonsterPixelY, and MonsterPixelHex are the coordinates of the life bar of a monster at around 25% health and the hex associated with that. This is used to detect WHEN to use Eviscerate. MonsterDetectX, MonsterDetectY, and MonsterDetectHex are the coordinates and hex of the monster at the very far left side of the life bar (basically 0 life). This is used to detect WHEN the monster is dead. UseHeal is obvious. HealPixelX, HealPixelY, and HealPixelHex are the coords and hex of YOUR life at whatever health you want to heal to before you go fight another monstie. Just compile the bot like it is, run it, and press F8 over these spots and change the .ini accordingly. Oh, and as for the attack variables.... Attack1 is my SS, Attack2 is my Eviscerate, Sleep is the wait in ms between the attacks, AttackThrow is obviously the number that the knife is set on, and SleepAfterThrow gives the monster time to run up to you once you piss it off. I forgot about one variable, NumThrowStacks. This is how many throw stacks you have IN YOUR BACKPACK. With the way I have it right now, you can have up to 4 extras, starting from the TOP LEFT and filling in the row. Of course, by looking at the code you will be able to see it'll be super-easy to change it if you want.
And here's a little rundown of the bot code: First, it sleeps while your health is lower than the health you set. It's for a rogue, and since my rogue doesn't use food I didn't add it. It would take a whole LINE of code to add a feeding function if you wanted (or a stealth, which would be smart and I was too lazy to do). If you use stealth while healing, make sure to unstealth right after the While loop ends. Ok, next the bot walks then presses TAB until a monstie is found. Once it finds the guy, the attack function is called (mine worked for me, but it should be easy to change should you need to). Also, after 200 mobs have been killed, the bot calls the equip function to equip a new stack of knives to pull with. It's easy to tell what the function does if you check it out.
Ok... I'm almost done. Let me point out, though, that I know if another mob starts attacking you and you kill the other one you're on, you'll just sit there until you die because the heal process will never finish. Also, I know this bot doesn't loot. I didn't feel like writing a looting function because I am just interested in leveling. If someone wants to throw a looting function in there that would be great, just stick it after Attack() or something. Somebody can also throw a little "vanish" feature in there if your life gets too low, that way you will most likely not die in the span of a few hours. One more potential bug: If a monster is ranged, it will not run up to you (DUH!) so you would just stand there wanking yourself. Someone can also add a detection for that and have the rogue walk up if needed.
So finally, if you have never used AutoIt don't be scared. Three days ago I had never looked at AutoIt code before. It's a very easy scripting language to learn. Go here for a download of it (this will also compile the .au3 file to a .exe so you can run it): http://www.hiddensoft.com/autoit3/downloads.php
Source: PMG
NOTE: I havent tested yet