Simple bot + Editing Tips

02/25/2008 06:17 hooba#1
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:
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
Now lets break it down,

1. Regeneration Buff:

Code:
If PixelGetColor(1414, 235) = 0x896021 Then	;Buff Duration Icon
	Sleep 50
	Else
	Send("4")
	EndIf
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:
Code:
 = PixelSearch (94, 97, 1267, 699, 0xD9E220, 20, 4)	;Check for Yellow Mob
If Not @error Then
	MouseClick ("Left", , )
	Sleep(50)
	EndIf
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:
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 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:
Code:
Send("X")
Sleep(50)
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])
02/25/2008 06:42 hooba#2
Ah, this is AutoIt btw, sorry.
02/25/2008 07:05 leggojake#3
Check out my bot, does all this with input settings table for % Hp and color search choose.
02/25/2008 07:07 hooba#4
Will do, was just breaking it down to possibly help some others understand some things :)
02/25/2008 08:07 yaoyeng#5
this will work for any version of Cabal or only NA?
02/25/2008 09:45 mc_speed#6
This don`t work Cabal EU.Open Autoit Script Write convert exe. THis Error

[Only registered and activated users can see links. Click Here To Register...]
02/25/2008 15:01 hooba#7
This script just uses pixel searching, mouse clicks, and key presses so it should work with EU although you probably will need to change the colors. Maybe you wont have to change the colors, I have no idea.

@mc_speed: Here, download it already written as au3 script. Putting the code in the code brackets in the first post messed up part of it.
02/25/2008 17:01 Bobs16#8
This bot clicks monsters that is it. And a tip I am pretty sure pixsearch can only click monsters not send keys. and the problem with Pixel get color is that it only looks for that 1 color. Everyones pixels are different you need shades and pixelsearch does that.
02/25/2008 21:37 sinx000#9
wait does Eu used gameguard? or xtrap im confused..

nvm got my answer :D

oh ya and btw the getpixel 2.1 would only get me #000000 for everything within the cabal window
02/25/2008 22:15 takerslair#10
Idk why, but i get an Error i copied and pasted the script exactly, wont work tho.
02/25/2008 22:18 sinx000#11
take a screenshot of the error

btw im pretty sure autoit doesnt work in EU or kr cabal.. since they both used gameguard.. plus i read a ton of other forums.. stating that gameguard disable all functions of autoit scripts.. is this truE?
02/25/2008 22:21 takerslair#12
Line -1:


Error:Unable to parse line.
03/02/2008 01:59 TestingXD#13
its flawed, but usable. two thumbs up :) thnx