autoIT simple Target&attack bot help

01/24/2010 19:50 clied#1
ok got something here and im stucked please.. could anyone have a tip or suggestion in this code:
Code:
#include <GUIConstantsEx.au3>

GUICreate("Forsaken's Bot", 335, 100)

GUISetState(@SW_SHOW)

$startbutton = GUICtrlCreateButton("Start", 190, 8, 60)

HotKeySet("{ESC}", "Terminate")

Func Terminate()
	Exit 0
EndFunc

func find()
	send("{TAB}")
EndFunc

func atk()
	send("{1}")
	Sleep(3000)
	send("{1}")
	sleep(3000)
EndFunc

While 1
find()
atk()
WEnd
it just wont tab at the right time.. it just keeps on pressing "1" dunno what part im wrong or eveything is wrong T_T
please help
01/24/2010 23:24 AutoItDude#2
It is sending "1" and probably "TAB" for all the time because your bot does not know if any target has been found. atk() function must be executed only if find() succed, in your case both functions are executed for all the time. you know what i mean?

Add one more function to check if desired target is selected and try like this:
Code:
; ======================================
; HOTKEYS
; ======================================
HotKeySet("{HOME}","_OnOFF")

; ======================================
; GLOBAL VARIABLES
; ======================================
Global $bRUN=0		; switch for bot

; ======================================
; MAINLOOP
; ======================================
While 1
	If $bRUN Then
		_FindTarget()
		_Attack()
	EndIf
WEnd

; ======================================
; FUNCTIONS
; ======================================
Func _FindTarget()
	Send("{TAB}")
EndFunc

Func _Attack()
	While _isTarget()
		Send(1)
		Sleep(3000)
	WEnd
EndFunc

Func _isTarget()
;~ 	check if target is selected.
;~ 	try to get monster HP Or whatever
;~ 	what makes you able to verify the target
EndFunc

; ======================================
; SWITCHES
; ======================================
Func _OnOFF()
	$bRUN=Not $bRUN
EndFunc
hope it helps.
01/25/2010 04:26 clied#3
ok here i put pixelgetcolor for the monster hp bar but it gives me error i think im doing it wrong.
some suggestion on checking if monster is selected/alive please...

Code:
HotKeySet("{ESC}", "Terminate")

Func Terminate()
	Exit 0
EndFunc

func find() 
Send("{TAB}") 
sleep(1000) 
EndFunc 

func atk()
	send("{1}")
	sleep(3000)
	send("{1}")
	sleep(3000)
EndFunc

While 1 
	sleep(5000)
	find()
	If PixelGetColor( 510,38 ) = 16226964 then
	atk()	
	EndIf
Wend
01/25/2010 06:18 AutoItDude#4
what error?

Use memory functions instead of pixel searching/checking. Search in memory for address where game writes INT/FLOAT value of target HP. If value > 0 then monster is selected.
01/25/2010 16:59 clied#5
uhm how can i search for the enemies hp value? i know how to search mine using cheat engine..
01/26/2010 03:26 AutoItDude#6
If you don't have access to any data about monsters HP from webpages, forums, etc. then try to find it like this.

1) select target, search: unknown initial value
2) hit target once, search: smaller value, repeat this stage untill you find correct value or target is killed.

if this won't work try this method:
1) make sure nothing is selected, search for: 0xFFFFFFFF
2) select monster, search: CHANGED VALUE
3) hit once, search: SMALLER VALUE, repeat.

note: in most MMO games HP value of 0xFFFFFFFF, instead of 0x00 is used to describe ZERO.

btw. what's the name of the game you work on?
01/27/2010 04:24 zhadow32#7
hey, the script can work fot the game am playing too , ive tried diff scripts and so on the only prob i have is that when i do activate the scripts nothing ever happens in the game, ive tested it in notepad(i know its not the same) and they work, even a simple send wont work, any help? and idk if the game is blocking the scripts
01/29/2010 00:23 AutoItDude#8
you won't be able to simulate mouse clicks or key strokes if there is some antihack shield watching game process. there are couple of ways how to solve it:
1) run game process suspended and inject your automated dll
2) remove anti hack shield hooks
3) completely disable anti hack shield