Offset and adress read Problem. FOR HP Autopot short code...

05/02/2014 04:03 wiz88#1
#Include <NomadMemory.au3>


WinActivate ("xxx Online ")
Do
$PID = _MemoryOpen(WinGetProcess("xxx Online") )

$Adresse = 0x0143C888
Dim $Offset[2] = [0, 0x3b8]
While 1
$Process = _MemoryOpen(ProcessExists("client.exe"))
If Not @error Then
$HP = _MemoryPointerRead($Adresse, $Process, $Offset)
If Not @error Then ToolTip($HP[1], 0, 0)
_MemoryClose($Process)
if $HP < 5000 Then
Send("9")
sleep (5000)
EndIf
Sleep(400)
EndIf
Sleep(100)
WEnd

Until GuiGetMsg()

im new start autoit where i can fault? my char hp error read..i search forum but very code not read char hp...i need offset and adress read after hp pot used...Thanks
05/04/2014 18:34 fear-x#2
try $HP[2] instead of $HP[1]


or try convert your value into 4 bytes
05/05/2014 17:16 KDeluxe#3
"$HP[2]" will produce an error. The return value is an array with two elements. The first element contains the address and the second one contains the value. If you try to access the third element, the range is exceeded and an error occurs.

[Only registered and activated users can see links. Click Here To Register...]
05/15/2014 00:13 Mr.Netwolf#4
well i can see one problem
or at least i had my problems with that
Quote:
Dim $Offset[2] = [0, 0x3b8]
try changing these lines
Code:
Dim $Offset[2] 
$Offset[0] = 0
$offset[1] = 0x3b8
or try my script
Offset[0] would be 1 in your case.
and Offset[1] obviously 0x3b8
$HP = _memoryread(finaladdress(blbablabla), $process)
If Not @error Then ToolTip($HP, 0, 0)
you only need $vtype for debugs in case your value is a float or Hex.

btw inttofloat() is not my own work. but it works like a charm to turn integer into float

theres some debugs in the function to show you the results of pointer conversion and ofc the value of the read. you just need to remove the ;

Code:
#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.10.2
 Author:         myName

 Script Function:
	Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <NomadMemory.au3>

func finaladress($pointer, $offset, $vtype, $ProcessID)
dim $value
dim $i
dim $read
if IsArray($offset) Then
$value = _MemoryOpen($ProcessID)
	for $i = 1 to  $offset[0]
$pointer = _MemoryRead($pointer, $value) + $offset[$i]
Next
_MemoryClose($value)
EndIf
$value = _MemoryOpen($ProcessID)
$read = _MemoryRead($pointer, $value)
if $vtype = "float" Then
$read = IntToFlt($read)
ElseIf $vtype = "hex" Then
$read = Hex($read)
EndIf
_MemoryClose($value)
;MsgBox(16,"test",hex($pointer))
;MsgBox(16,"test",$read)
Return $pointer
EndFunc
;credits to some random on the net... lol
Func IntToFlt($iVal)
Local $result
$fs = DllStructCreate("float")
$is = DllStructCreate("int64",DllStructGetPtr($fs))

DllStructSetData($is,1,$iVal)

$result =  DllStructGetData($fs,1)
$fs = 0
$is = 0
return $result

endfunc
05/15/2014 08:47 alpines#5
Quote:
Originally Posted by Mr.Netwolf View Post
try changing these lines
Code:
Dim $Offset[2] 
$Offset[0] = 0
$offset[1] = 0x3b8
Using that instead of
Code:
Dim $Offset[2] = [0, 0x3B8]
would bring no change. Actually the 2nd version is better.