jm087 Posted January 9, 2010 Share Posted January 9, 2010 I am trying to read the HP value of a game. Each time I run the AutoIT script, it returns 0 for the value. Searching on google I found the thread here: http://www.autoitscript.com/forum/index.php?showtopic=69583 and ran the script Inverted posted for calc.exe. It returned 00000000 as the address..so something's screwy with my installed AutoIT or something..To my dismay there was no real answer in that thread as to why it's doing this. I have my AV and firewalls disabled, nothing else running..absolutely no clue why it's not returning the correct values/address. I have even tried the calc.exe script on a separate desktop and laptop, both return the same 00000000 address. Is there anything needed besides NomadMemory.au3 for _MemoryOpen and _MemoryRead? Link to comment Share on other sites More sharing options...
Info Posted January 9, 2010 Share Posted January 9, 2010 (edited) Some code might help, but here's an example of a proper use of NomadMemory UDF $hpAddress = 0x12345678 $MemOpen = _MemoryOpen(ProcessExists("winmine.exe")) While 1 If _MemoryRead($hpAddress, $MemOpen) <> 100 Then _MemoryWrite($hpAddress, $MemOpen, 100) Sleep(200) WEnd Edited January 9, 2010 by Info Link to comment Share on other sites More sharing options...
jm087 Posted January 9, 2010 Author Share Posted January 9, 2010 Truly sorry, for some reason it began giving me the correct value after I restarted my computer, real odd. Link to comment Share on other sites More sharing options...
jm087 Posted January 10, 2010 Author Share Posted January 10, 2010 (edited) OK, stumped again lol. This is my very first AutoIT script so I know there's going to be a lot of un-needed dirty code etc. What I want to do: walk around randomly pressing tab until it detects a monster, I have the address for monster detection labeled as $MonsterDetect Once the bot reads the value as 1 (monster found) it starts the Attack function until $MonsterDetect value becomes 0 (monster died), and repeats. Problem: The code I wrote is not reading the values when the bot is enabled. It will run endlessly, even when I tab to a monster and $MonsterDetect becomes 1, it won't run the Attack function. I messed with the code a little bit (moved all of the _Memory* code into the script part) and it was able to attack, but it was stuck in Attack loop, pressing my attack hotkeys, instead of acknowledging $MonsterDetect = 0 and start the Run function again. Greatly appreciate those who help. expandcollapse popup#include <NomadMemory.au3> Global $ProcessID = ProcessExists("Game.exe") Global $HPPointer = 0x009838c0 Global $HPOffset1 = Dec("8") Global $HPOffset2 = Dec("4") Global $MonsterADD = 0x00983944 $Start = IniRead("bot.ini", "Main", "Start", "0") $Stop = IniRead("bot.ini", "Main", "Stop", "0") $Attack1 = IniRead("bot.ini", "Attack", "Attack1", "0") $Attack2 = IniRead("bot.ini", "Attack", "Attack2", "0") $Healing = IniRead("bot.ini", "Heal", "UseHeal", "0") $Heal = IniRead("bot.ini", "Heal", "Heal", "0") $Sit = IniRead("bot.ini", "Heal", "Sit", "0") $Loot = IniRead("bot.ini", "Attack", "Loot", "0") $Sleep = IniRead("bot.ini", "Attack", "Sleep", "0") HotKeySet("{" & $Start & "}", "Start") HotKeySet("{" & $Stop & "}", "Stop") Dim $Botting = 0 Dim $Hunt = 0 ;If $ProcessID = 0 Then ; MsgBox(16, $ProcessID, "Process not found !") ; Exit ;EndIf $MemOpen = _MemoryOpen($ProcessID) $CurrentHP = _MemoryRead($HPPointer, $MemOpen) $LVL1 = '0x' & Hex($CurrentHP + $HPOffset1) $CurrentHP = _MemoryRead($LVL1, $MemOpen) $LVL2 = '0x' & Hex($CurrentHP + $HPOffset2) $CurrentHP = _MemoryRead($LVL2, $MemOpen) $MonsterDetect = _MemoryRead($MonsterADD, $MemOpen) _MemoryClose($ProcessID) ;****** FUNCTIONS Func StartBot() $Botting = 1 EndFunc ;==>StartBot Func StopBot() $Botting = 0 If $Hunt Then Send("W") $Hunt = 0 EndIf EndFunc ;==>StopBot Func Hunt() If Not $Hunt Then $Hunt = 1 EndIf Send($Loot) Send($Loot) Send($Loot) Send("D") $Hunt = 0 Sleep(210) EndFunc ;==>Hunt Func Attack() If $Hunt Then $Hunt = 0 EndIf Do Send($Attack1) Send($Attack2) Sleep($Sleep1) Until $MonsterDetect = 0 EndFunc ;==>Attack ;****** SCRIPT $dur = 0 While $dur <= $num If $Botting = 1 Then Do If $CurrentHP < 4000 Then Send($Heal) EndIf Hunt() Send("{TAB}") Sleep(200) Until $MonsterDetect = 1 If $MonsterDetect = 1 Then Attack() EndIf EndIf WEnd Edited January 10, 2010 by jm087 Link to comment Share on other sites More sharing options...
jm087 Posted January 12, 2010 Author Share Posted January 12, 2010 bump ;[ Link to comment Share on other sites More sharing options...
jm087 Posted January 14, 2010 Author Share Posted January 14, 2010 Not a single person can help me out? Still stuck on this.. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now