Jump to content

Memory reading


Recommended Posts

Well I'm trying to create an Auto-Potter for a game called Conquer. It's just a simple little tool that does hardly any harm to anyone or give me a huge advantage or anything... but it's not working -.-.... The script is so small and simple, yet it refuses to work :S... Heres what I got:

#include <misc.au3>
#include <NomadMemory.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>


HotKeySet("{F5}", "On")
HotKeySet("{ESC}", "Terminate")

Global $start = 0, $Mem_Handle, $PID = ProcessExists("Conquer.exe"), $hpmem = "0x01538CF0", $hpbox = "0x01E6B9B4"

;hpmem = The actual HP numbers
;hp box = How many pots you actually have

$Mem_Handle = _MemoryOpen($PID)

#Region ###
$Form1_1 = GUICreate("Form1", 498, 197, 194, 126)
$Input1 = GUICtrlCreateInput("", 24, 16, 209, 21)
$Label1 = GUICtrlCreateLabel("Type in the HP you wish to Heal at.", 256, 16, 171, 17)
$Combo1 = GUICtrlCreateCombo("F1", 24, 48, 89, 25)
GUICtrlSetData(-1, "F2|F3|F4|F5|F6|F7|F8|F9|F10")
$Label2 = GUICtrlCreateLabel("Select the key that will use the HEALTH pots.", 136, 48, 220, 17)
$Input2 = GUICtrlCreateInput("", 24, 120, 209, 21)
$Combo2 = GUICtrlCreateCombo("F1", 24, 160, 89, 25)
GUICtrlSetData(-1, "F2|F3|F4|F5|F6|F7|F8|F9|F10")
$Label3 = GUICtrlCreateLabel("Type in when you want a pot box to be used", 256, 120, 214, 17)
$Label4 = GUICtrlCreateLabel("(how many pots remaining)", 256, 136, 129, 17)
$Label5 = GUICtrlCreateLabel("Select the key that will use the Health BOXES.", 128, 168, 224, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    If $start Then
        Hp()
    EndIf

WEnd

Func Terminate()
    _MemoryClose($PID)
    Sleep(100)
    Exit
EndFunc

Func Hp()
        If GuiCtrlRead($Input1) >= _MemoryRead($hpmem, $Mem_Handle) Then; --If (typed in 100) is >= Health (200)
            MsgBox(0, "", "ewww")
    ;Send("{" & GUICtrlRead($Combo1) & "}")
        ElseIf GuiCtrlRead($Input2) >= _MemoryRead($hpbox, $Mem_Handle) Then
           MsgBox(0,"","Hp BOXXXXXX")
         ;Send("{" & GUICtrlRead($Combo2) & "}")
        EndIf
EndFunc
    


Func On()
    $start = NOT $start
    If $PID <> 0 And $Mem_Handle = "" Then
        $Mem_Handle = _MemoryOpen($PID)
    ElseIf $PID = 0 Then
        MsgBox(0,"Error","Please open Conquer 2.0 before starting the program.")
        $start = Not $start
    EndIf
EndFunc

My only theory on why it is going wrong is here:

GuiCtrlRead($Input1) >= _MemoryRead($hpmem, $Mem_Handle)

Because the CtrlRead of Input1 gets just a number... The MemoryRead gets a number from the memory IN THE GAME... So its comparing a plain old number typed in with a number from inside a game's memory... Idk if thats the problem or not though :S

Also for some reason, in the ElseIf it is spamming the MsgBox(HP BOXXXXX) continuously for some reason... ><

Any help would be greatly appreciated :)

Edited by UnknownWarrior
Link to comment
Share on other sites

It is very likely that the value you get from that memory location is a hex value. You are trying to compare that with a decimal number, that won't give you a match ever.

try: GuiCtrlRead($Input1) >= Dec(_MemoryRead($hpmem, $Mem_Handle))

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Link to comment
Share on other sites

Still isn't working... I have a MsgBox:

Func Hp()
    $cur_hp = _MemoryRead($hpmem, $Mem_Handle))
    MsgBox(0,"HP",$cur_hp)
        If GuiCtrlRead($Input1) >= $cur_hp Then; --If (typed in 100) is >= Health (200)
            MsgBox(0, "", "ewww")
            Send("{" & GUICtrlRead($Combo1) & "}")
        ElseIf GuiCtrlRead($Input2) >= $cur_hp Then
        MsgBox(0,"","Hp BOXXXXXX")
        Send("{" & GUICtrlRead($Combo2) & "}")
        EndIf
EndFunc

And my Health in my game is 10,000 but it keeps returning to me in the MsgBox my health is at 7686... And I re-checked CheatEngine and my value for $hpmem is still correct, I CAN read my HP value from CE.... So I have no idea what its saying my HP is at 7686 :S

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...