Need help Func

03/18/2009 17:11 sweetlady#1
Hi all, I have a little issue with the bot I'm doin using the tt6 move to engine. I'm trying the make it scan in front of my charc on the minimap to check if enemies are present.
So here's the func:
Code:
;scan if enemy is in front of us
Func ScanEnemy1()
	 PixelSearch(86, 460, 173, 516, $MonsterColor_Red, 10)
    If @error then 
        Sleep( 100 )
        PixelSearch(86, 460, 173, 516, $MonsterColor_Red, 10)
        if @error then return False
    EndIf
    return True
EndFunc
And here's how I've used it in my script:
Code:
;go to Lissah
	PrepMoveTo()
	
	MoveTo(1, 17619, -17449)
	MoveTo(1, 15697, -15812)
 	MoveTo(1, 13328, -14471)
 	MoveTo(1, 11022, -12727)
	MoveTo(1, 10985, -12696)
	RndSleep(200)
	
	;check enemy in path
	StopMoveTo()
	RndSleep(500)
	InitDest(4140, -11602)
	If ScanEnemy1() Then
		Sleep(100)
	EndIf
	If Not ScanEnemy1() Then
		ContinueLoop
	;resume
	PrepMoveTo()
	MoveTo(1, 9504, -12488)
	MoveTo(1, 7695, -10883)
	MoveTo(1, 4239, -11442)
	MoveTo(1, 4140, -11602)
	EndIf
Still it doesnt seem to be working as my charc moves to the next waypoint while there is or isnt any enemies in front. So I was wondering if anyone could help me out.

Thx
03/23/2009 19:02 T1CM4D#2
I am really sorry, i have tried to replicate your problem because i was looking to add a similar bit of code to something i am working on but i am very new to autoit so i could not get it working :(

Have you found a fix for the problem?
03/24/2009 06:49 buFFy!#3
Quote:
Originally Posted by sweetlady View Post
Hi all, I have a little issue with the bot I'm doin using the tt6 move to engine. I'm trying the make it scan in front of my charc on the minimap to check if enemies are present.
So here's the func:
Code:
;scan if enemy is in front of us
Func ScanEnemy1()
	 PixelSearch(86, 460, 173, 516, $MonsterColor_Red, 10)
    If @error then 
        Sleep( 100 )
        PixelSearch(86, 460, 173, 516, $MonsterColor_Red, 10)
        if @error then return False
    EndIf
    return True
EndFunc
And here's how I've used it in my script:
Code:
;go to Lissah
	PrepMoveTo()
	
	MoveTo(1, 17619, -17449)
	MoveTo(1, 15697, -15812)
 	MoveTo(1, 13328, -14471)
 	MoveTo(1, 11022, -12727)
	MoveTo(1, 10985, -12696)
	RndSleep(200)
	
	;check enemy in path
	StopMoveTo()
	RndSleep(500)
	InitDest(4140, -11602)
	If ScanEnemy1() Then
		Sleep(100)
	EndIf
	If Not ScanEnemy1() Then
		ContinueLoop
	;resume
	PrepMoveTo()
	MoveTo(1, 9504, -12488)
	MoveTo(1, 7695, -10883)
	MoveTo(1, 4239, -11442)
	MoveTo(1, 4140, -11602)
	EndIf
Still it doesnt seem to be working as my charc moves to the next waypoint while there is or isnt any enemies in front. So I was wondering if anyone could help me out.

Thx
There's an static Memory Address, you could use Cheat Engine to find it.
Returns 1 or 0.
04/02/2009 06:27 sweetlady#4
Quote:
Originally Posted by eF_Hacks View Post
There's an static Memory Address, you could use Cheat Engine to find it.
Returns 1 or 0.
I'm not really used to cheat Engine, might get to it someday but I preffer putting my efforts in autoit right now.

Thx

Oh, I've resolved my problem.

I was wondering If you could show me how you'd do it with memoryreading. I uses the tt6 engine. Plus I wanted to make one monitoring hp and energy. I have updated my memoryadresses in the update.ini but my character simply turns around. What have I done wrong?
04/02/2009 14:53 Rosemarie Lein#5
Quote:
Originally Posted by sweetlady View Post
I'm not really used to cheat Engine, might get to it someday but I preffer putting my efforts in autoit right now.

Thx

Oh, I've resolved my problem.

I was wondering If you could show me how you'd do it with memoryreading. I uses the tt6 engine. Plus I wanted to make one monitoring hp and energy. I have updated my memoryadresses in the update.ini but my character simply turns around. What have I done wrong?
You need an actual update.ini and the newest version of the tt6.au3.
There are 3(?) static addresses for checking if you look to your enemy:
0x00A23B79
0x00A23C50
0x00A24DF9
04/02/2009 17:57 sweetlady#6
I'll try to see what I can do. But right now my tt6 doesnt seem to be working. All it does is turn in circles instead of moveto.
04/02/2009 20:48 sweetlady#7
Nvm that I found my answer. But I have a question tho. With the adresses you gave me, yes I add them in my update.ini. That I can do, but how do I know wich one is to check if theres an enemy in the path of my character.

Thx
04/04/2009 14:28 sweetlady#8
UP
04/05/2009 16:15 sweetlady#9
I was also wondering how you use the
Code:
P_HEALTH				= 0xd28a70
;_M_HP					= 0x130
;_M_E					= 0x11c
;_M_MAX_HP				= 0x134
;_M_MAX_E
I have tested it a bit and both M_HP/M_E and M_MAX_HP/M_MAX_E codes returns 0. The thing is I dont know how to set it for a specific energy amout.

EX: Wait till the energy rise to 15 then cast...

This is what I have tried:
Code:
Const $HPMIN = 			IniRead("update.ini","SECTION D","_M_HP","Not found") ;HP at Minimum
Const $HPMAX = 			IniRead("update.ini","SECTION D","_M_MAX_HP","Not found") ;HP at Maximum
Const $ENMIN = 			IniRead("update.ini","SECTION D","_M_E","Not found") ;Energy at min
Const $ENMAX = 			IniRead("update.ini","SECTION D","_M_MAX_E","Not found") ;Energy at max

$Emin = _memoryread($ENMIN,$hprocess,'float') = 0
$Emax = _memoryread($ENMAX,$hprocess,'float') = 0
	If $Emin < $Emax Then
	MsgBox(0,"Energy Status", "Energy is Not FULL",10)
	WinSetOnTop("Energy Status","",1)
	EndIf
04/07/2009 12:31 buFFy!#10
Quote:
Originally Posted by sweetlady View Post
I was also wondering how you use the
Code:
P_HEALTH				= 0xd28a70
;_M_HP					= 0x130
;_M_E					= 0x11c
;_M_MAX_HP				= 0x134
;_M_MAX_E
I have tested it a bit and both M_HP/M_E and M_MAX_HP/M_MAX_E codes returns 0. The thing is I dont know how to set it for a specific energy amout.

EX: Wait till the energy rise to 15 then cast...

This is what I have tried:
Code:
Const $HPMIN = 			IniRead("update.ini","SECTION D","_M_HP","Not found") ;HP at Minimum
Const $HPMAX = 			IniRead("update.ini","SECTION D","_M_MAX_HP","Not found") ;HP at Maximum
Const $ENMIN = 			IniRead("update.ini","SECTION D","_M_E","Not found") ;Energy at min
Const $ENMAX = 			IniRead("update.ini","SECTION D","_M_MAX_E","Not found") ;Energy at max

$Emin = _memoryread($ENMIN,$hprocess,'float') = 0
$Emax = _memoryread($ENMAX,$hprocess,'float') = 0
	If $Emin < $Emax Then
	MsgBox(0,"Energy Status", "Energy is Not FULL",10)
	WinSetOnTop("Energy Status","",1)
	EndIf

There are Offsets...

So,
Code:
$PHEALTH = 0xd28ab8
$P_CURR_ENERGY = 0xd28ab8 + 0x11c
$P_CURR_HEALTH = 0xd28ab8 + 0x130
$P_MAX_ENERGY  = 0xd28ab8 + 0x120
$P_MAX_HEALTH  = 0xd28ab8 + 0x134
Of course yours Returns 0 because

P_HEALTH = 0xd28ab8
;_M_HP = 0x130
;_M_E = 0x11c
;_M_MAX_HP = 0x134
;_M_MAX_E = 0x120

Those are declaring an Comment.
<> That means u cant read them Out.
04/07/2009 14:00 Jacob_G#11
This code should help you:

HTML Code:
#include<NomadMemory.au3>

Global Const $process_id = WinGetProcess("Guild Wars")
Global $hp_en_base = 0xd28ab8 

Func _hp()
	
	$handle = _MemoryOpen($process_id)
	
	Dim $offset_health[2] = [0x0, 0x130]
	Dim $offset_health_max[2] = [0x0, 0x134]

	$ret_hp_max = _MemoryPointerRead($hp_en_base, $handle,$offset_health_max)
	$ret_hp = _MemoryPointerRead($hp_en_base, $Handle, $offset_health, 'float')
	_MemoryClose($handle)

	$health_atm = $ret_hp_max[1] * $ret_hp[1]
	$health_atm = Round($health_atm)

	If $health_atm Then
		Return $health_atm
	Else
		Return "dead"
	EndIf

EndFunc

Func _en()

	$handle = _MemoryOpen($process_id)
	
	Dim $offset_energy[2] = [0x0, 0x11c]
	Dim $offset_energy_max[2] = [0x0, 0x120]

	$ret_energy_max = _MemoryPointerRead($hp_en_base, $handle,$offset_energy_max)
	$ret_energy = _MemoryPointerRead($hp_en_base, $handle, $offset_energy, 'float')
	_MemoryClose($handle)

	$energy_atm = $ret_energy_max[1] * $ret_energy[1]
	$energy_atm = Round($energy_atm)

	If $energy_atm Then
		Return $energy_atm
	Else
		Return "no energy"
	EndIf

EndFunc



MsgBox(0,"Health & Energy","hp: " &_hp()& " | en: " &_en() ) ;
04/11/2009 00:51 sweetlady#12
Thanks a lot eF Hacks and Xninja. I havent had time to check it out yet, but you pointed me to the right direction thx. Xninja, I'll try out the script you gave me tonight see how it goes. I'll use it with credits.

Thx a lot again :)
04/11/2009 17:43 sweetlady#13
Ok, maybe I dont have the right NomadMemory because I'm missing this func
Code:
_MemoryPointerRead
Nvm, found the updated version