Alright, here is my code that I've been using for a while. It includes regeneration buff, check for yellow mob, healing pots, check if mob is dead.
My settings are Gamma - 1, 1024x768, windowed mode maximized. To use my macro you may need to change all of the coords and colors.
Tool needed for editing: [Only registered and activated users can see links. Click Here To Register...]
Whole Code:
Now lets break it down,
1. Regeneration Buff:
What it does: First it checks for the color of the Buff icon under the compass. If the Icon is not there, then it casts the buff. If you want to add other buffs then just copy this code and past it right under it. Use the Getpixelcolor program to get the color and the coords and replace mine.
Check for Yellow Mob:
What it does: First it searchs your screen for any yellow color. The pixel search code is like this PixelSearch (Left,Top,Right,Bottom,color, color shade deviation,skip pixels). The next part of the code grabs the coords of the yellow color, moves the mouse there, and left clicks. Sometimes, however, clicking the yellow name of the monster does not work so you have to find how to best angle your screen for the clicking, depending on the monster. I've found that zooming out all the way and looking straight down at the ground works the best for me... And again, you may need to change the color, so load up getpixelcolor.exe and find the color of the monsters name.
Attack Sequence:
What It Does: First, I have it check if the mob is still alive. It does this by checking whether the color of the very left of monster's health bar is still red. If it is, it continues the loop of the attack sequence. If not, the macro restarts at the top. It then goes on to attack,loot, and check your hp. You may only have to change the color for the HP pot part depending on when you want it to pot. I have it use the potions as soon as your health gets lower than the numbers in the middle of your health bar. It does this by checking whether or not that point is black yet or not.
What if I want it to attack orange monsters too?: Just copy/paste the check for yellow mob code and the attack sequence code right under the first attack sequence and before the last "EndIf" and "Wend". Then change the pixel color in the "PixelSearch" command to the mobs orange colored name. Same goes for Red mobs or any other colors.
What if I want to use more attack keys?: In the attack sequence add the code:
and replace "X" with the corresponding number.
Thank You everyone on the forum, reading about your stuff has helped me learn more about AutoIt, something I've never used before.
**INFO**: It refuses to let me put $Coord in the code brackets... The "search for yellow mob" should be:
$Coord = PixelSearch (94, 97, 1267, 699, 0xD9E220, 20, 4) ;Check for Yellow Mob
If Not @error Then
MouseClick ("Left", $Coord[0], $Coord[1])
My settings are Gamma - 1, 1024x768, windowed mode maximized. To use my macro you may need to change all of the coords and colors.
Tool needed for editing: [Only registered and activated users can see links. Click Here To Register...]
Whole Code:
Code:
;Macro Start While 1 If WinActivate("CABAL") Then If Not @error Then Sleep (50) EndIf If PixelGetColor(1414, 235) = 0x896021 Then ;Buff Duration Icon Sleep 50 Else Send("4") EndIf = PixelSearch (94, 97, 1267, 699, 0xD9E220, 20, 4) ;Check for Yellow Mob If Not @error Then MouseClick ("Left", , ) Sleep(50) EndIf While PixelGetColor(570, 47) = 0xFE8502 ;Check if Mob is still alive Send("1") Sleep(50) Send("2") Sleep(50) Send("3") Sleep(50) Send("{Space}") Sleep(50) If PixelGetColor(141, 55) = 0x1D1D1D Then ;Check Health Send("6") EndIf WEnd EndIf WEnd
1. Regeneration Buff:
Code:
If PixelGetColor(1414, 235) = 0x896021 Then ;Buff Duration Icon Sleep 50 Else Send("4") EndIf
Check for Yellow Mob:
Code:
= PixelSearch (94, 97, 1267, 699, 0xD9E220, 20, 4) ;Check for Yellow Mob If Not @error Then MouseClick ("Left", , ) Sleep(50) EndIf
Attack Sequence:
Code:
While PixelGetColor(570, 47) = 0xFE8502 ;Check if Mob is still alive Send("1") Sleep(50) Send("2") Sleep(50) Send("3") Sleep(50) Send("{Space}") Sleep(50) If PixelGetColor(141, 55) = 0x1D1D1D Then ;Check Health Send("6") EndIf WEnd
What if I want it to attack orange monsters too?: Just copy/paste the check for yellow mob code and the attack sequence code right under the first attack sequence and before the last "EndIf" and "Wend". Then change the pixel color in the "PixelSearch" command to the mobs orange colored name. Same goes for Red mobs or any other colors.
What if I want to use more attack keys?: In the attack sequence add the code:
Code:
Send("X") Sleep(50)
Thank You everyone on the forum, reading about your stuff has helped me learn more about AutoIt, something I've never used before.
**INFO**: It refuses to let me put $Coord in the code brackets... The "search for yellow mob" should be:
$Coord = PixelSearch (94, 97, 1267, 699, 0xD9E220, 20, 4) ;Check for Yellow Mob
If Not @error Then
MouseClick ("Left", $Coord[0], $Coord[1])