spec1 Posted November 20, 2007 Share Posted November 20, 2007 The memory location, is the location of the health in the game and when it gets under 51 it should press O but it just spams O can anyone tell me whats wrong and how to fix it please. CODE;#include <Process.au3> #include <GUIConstants.au3> #Include <Misc.au3> #include <_HotKey.au3> Opt("pixelcoordmode", 2) Opt("mousecoordmode", 2) Opt("GUIOnEventMode", 1) Opt("WinTitleMatchMode", 4) $title = "F.E.A.R." ;- this is the name of the window, for example, when you start a new notepad application the title of the window usually is "untitled - notepad", put the title of your game here. $Process = WinGetProcess($title, "") ; this yields the process id. every process has an id associated with it. you need it when you perform tasks dealing with that process... for the most part. global $mem_health = ("0289AB0C"); here you must fill in the address of the health which you obtained... remember to include brackets around it and that it's 8 digits long (include any preceding 0's). global $health while 1 ; this is your main loop sleep(50) ; I give it a sleep command so it doesn't rob cpu power. it's just a delay command. sleep(1000) = 1 second readhealth() ; this calls the function to read health from memory and stores that value into $health if $health < 51 then ; checks if health is below 51, if so send o ... hey, that rhymes. send("o") endif wend Func _MemoryOpen($iv_Pid, $iv_DesiredAccess = 0x1F0FFF, $if_InheritHandle = 1) If Not ProcessExists($iv_Pid) Then MsgBox(0, "value of lastaction", "error3") SetError(1) Return 0 EndIf Local $ah_Handle[2] = [DllOpen('kernel32.dll') ] ;~ Local $ah_Handle = DllOpen('kernel32.dll') -the brackets are because an array is being declared, no brackets neccessary if it was a standalone variable ;~ msgbox(0,"value of ah_Handle[2] is", $ah_Handle[1]) If @error Then MsgBox(0, "value of lastaction", "error4") SetError(2) Return 0 EndIf ;~ msgbox(0,"value of ah_Handle[0] is", $ah_Handle[0]&"inherithandle"&$if_InheritHandle&"and the iv_pid"&$iv_Pid) Local $av_OpenProcess = DllCall($ah_Handle[0], 'int', 'OpenProcess', 'int', $iv_DesiredAccess, 'int', $if_InheritHandle, 'int', $iv_Pid) ;~ Local $av_OpenProcess = DllCall('kernel32.dll', 'int', 'OpenProcess', 'int', 0x1F0FFF(all access), 'int', 1, 'int', 4084) ;~ msgbox(0,"value of $av_openprocess is", $av_OpenProcess[0]) ;1820 ;~ msgbox(0,"value of iv_pid is", $iv_Pid) ; 4084 If @error Then MsgBox(0, "value of lastaction", "error5") DllClose($ah_Handle[0]) SetError(3) Return 0 EndIf $ah_Handle[1] = $av_OpenProcess[0] ;~ msgbox(0,"value of ah_Handle is", $ah_Handle) Return $ah_Handle EndFunc ;==>_MemoryOpen Func _MemoryRead($ah_Handle, $iv_Address, $sv_Type = 'dword') If Not IsArray($ah_Handle) Then SetError(1) MsgBox(0, "value of lastaction", "error1") Return 0 EndIf Local $v_Buffer = DllStructCreate($sv_Type) If @error Then MsgBox(0, "value of lastaction", "error2") SetError(@error + 1) Return 0 EndIf ;~ DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $iv_Address, 'int', $ah_Handle[1], 'int', DllStructGetSize($v_Buffer), 'int', '', 'ptr', DllStructGetPtr($v_Buffer)) DllCall($ah_Handle[0], 'int', 'ReadProcessMemory', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer), 'int', '') ;~ msgbox(0,"value of ah_Handle[0],[1] is", $ah_Handle[0]&", "&$ah_Handle[1]);1,1788 If Not @error Then Local $v_Value = DllStructGetData($v_Buffer, 1) Return $v_Value Else SetError(6) Return 0 EndIf EndFunc ;==>_MemoryRead Func _MemoryClose($ah_Handle) If Not IsArray($ah_Handle) Then SetError(1) Return 0 EndIf DllCall($ah_Handle[0], 'int', 'CloseHandle', 'int', $ah_Handle[1]) If Not @error Then DllClose($ah_Handle[0]) Return 1 Else DllClose($ah_Handle[0]) SetError(2) Return 0 EndIf EndFunc ;==>_MemoryClose Func Readhealth() $M_open = _MemoryOpen($Process) $health = _MemoryRead($M_open, "0x" & $mem_health, 'float') _MemoryClose($M_open) EndFunc ;==>Readhealth Link to comment Share on other sites More sharing options...
weaponx Posted November 20, 2007 Share Posted November 20, 2007 Ah yes I've located the problem! ERROR on Line 159 "End user unable to complete game unassisted" See MS KnowledgeBase Article KB5318008 Link to comment Share on other sites More sharing options...
DW1 Posted November 20, 2007 Share Posted November 20, 2007 lol... boobies cheaters don't get much help here AutoIt3 Online Help Link to comment Share on other sites More sharing options...
spec1 Posted November 20, 2007 Author Share Posted November 20, 2007 Funny game bots are fine, but this is not hmm.....lol... boobiescheaters don't get much help here Link to comment Share on other sites More sharing options...
Drew Posted November 20, 2007 Share Posted November 20, 2007 What do you mean it spams it , and btw , what game is this for? I'm guess O would heal or something... Link to comment Share on other sites More sharing options...
spec1 Posted November 20, 2007 Author Share Posted November 20, 2007 from the time I run it just does O all the time has nothing to do with the health being on 51 or 100 it just does oooooooooooo all the time not sure why have tried everything.What do you mean it spams it , and btw , what game is this for? I'm guess O would heal or something... Link to comment Share on other sites More sharing options...
DW1 Posted November 20, 2007 Share Posted November 20, 2007 first thing is first, make sure that your function for getting the health value is returning the correct value. I think that it is not getting the correct value. Also make sure that if the script cannot get this value that it exits gracefully. AutoIt3 Online Help Link to comment Share on other sites More sharing options...
spec1 Posted November 21, 2007 Author Share Posted November 21, 2007 Anyone have any ideas, how to get it to work ? Link to comment Share on other sites More sharing options...
FireLord Posted November 21, 2007 Share Posted November 21, 2007 Try using msgbox to see what value it is returning for your health. [center]See the Helpfile[/center] While Alive() DrinkWine(); }[center][/center] Link to comment Share on other sites More sharing options...
therks Posted November 21, 2007 Share Posted November 21, 2007 I wonder if maybe you screwed up with the _MemoryRead() function. Second parameter is supposed to be an an integer, you're passing a string. My AutoIt Stuff | My Github 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