NomadMemory.au3:
Code:
$ProcessId = ProcessExists("Gw2.exe")
$hProcess = _MemoryOpen($ProcessId)
$val = _MemoryRead($address, $hProcess, 'dword')
_MemoryWrite($address, $hProcess, $val + 1000, 'dword')
_MemoryClose($hProcess)
I wouldn't use the pointer functions. Rather write your own ReadPtrChain
For finding patterns you can use this function.
I'm not the author of this function, thus the credits go to "Luzifer42" !
Code:
Func FindPattern($ah_Handle, $pattern, $after = False, $iv_addrStart = 0x00400000, $iv_addrEnd = 0X00FFFFFF, $step = 51200)
If Not IsArray($ah_Handle) Then
SetError(1)
Return -1
EndIf
$pattern = StringRegExpReplace($pattern, "[^0123456789ABCDEFabcdef.]", "")
If StringLen($pattern) = 0 Then
SetError(2)
Return -2
EndIf
For $addr = $iv_addrStart To $iv_addrEnd Step $step - (StringLen($pattern) / 2)
StringRegExp(_MemoryRead($addr, $ah_Handle, "byte[" & $step & "]"), $pattern, 1, 2)
If Not @error Then
If $after Then
Return StringFormat("0x%.8X", $addr + ((@extended - 2) / 2))
Else
Return StringFormat("0x%.8X", $addr + ((@extended - StringLen($pattern) - 2) / 2))
EndIf
EndIf
Next
Return -3
EndFunc ;==>FindPattern
Heres another thing. Guildwars is devided into classes, obviously. When reading/writing to for example the speed address, you are right now reading the entire pointer chain.
Instead, you should just read it once (ChContext->Character->Agent->World->EntityInWorld->Speed)
and save the Character from it. The next time when attempting to write to the speed address, you want to check whether the Character has changed. If so, just read the entire ptr chain again.
I noticed that you are reading your "Base" + 44h. Your base obviously holds a ptr to your current character, because 44h is for Agent and Agent+1Ch is World.
So, just check whether the value of your Base has changed.
AutoIT is slow as fuck and i really recommend doing that.
Just my 2 cents