Sign in to follow this  
Followers 0
UnknownWarrior

Reading Memory.

3 posts in this topic

Alright so heres my script:

#include <NomadMemory.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Include <Misc.au3>

Opt("GUICloseOnEsc",1)


HotKeySet("{F5}","Go")
HotKeySet("{F7}", "Toggle")
HotKeySet("{F11}", "_Record")
HotKeySet("{Esc}", "_Off")


Dim $recordx, $recordy, $clients,$do, $use = "[Conquer 2.0]", $Pause = True, $Mem_Handle
;~ Global $dll = DllOpen("user32.dll"); For _IsPressed Function Below

Global $PID = ProcessExists("Conquer.exe"), $pointx = "0x00593698", $pointy = "0x0059369C"

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Bot", 342, 227, 193, 125)
$Label1 = GUICtrlCreateLabel("F5 To start the bot.", 24, 24, 103, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    While $Pause = true
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            $ans = MsgBox(33,"Close","Do you really wish to close?")
            If $ans = 1 Then
                Exit
            EndIf
    EndSwitch
WEnd
$list = WinList("[Conquer 2.0]")
If $list <> "" Then
For $l = 1 To $list[0][0]
    If WinGetProcess($list[$l][1]) = $PID Then
        $use = $list[$l][1]
    EndIf
Next
EndIf
;WinWaitActive($use)
        Sleep(1000)
    $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                $ans = MsgBox(33,"Close","Do you really wish to close?")
                If $ans = 1 Then
                    Exit
                EndIf
        EndSwitch
Wend

Func Toggle()
    $Pause = Not $Pause
    If $PID = 0 Then
    Do
    $PID = ProcessExists("Conquer.exe")
        If $PID = 0 Then
            $flag = MsgBox(1,"Start Conquer", "After You have Started Conquer, Press OK.")
        EndIf
    Until $PID <> 0 Or $flag = 2
    If $flag <> 1 Then
        $Pause = Not $Pause
    EndIf
    EndIf

EndFunc

Func _Record()
    
    $Mem_Handle = _MemoryOpen($PID)
    $recordx = _MemoryRead($pointx , $Mem_Handle)
    IniWrite("Coords.ini","PID = " & $PID,"x"&$do,$recordx); Pretty Self Explainatory. Records coords in a ini file which can be read afterwards. Writes the $Title Number, Step Number with X and Data
    $recordy = _MemoryRead($pointy , $Mem_Handle)
    IniWrite("Coords.ini","PID = " & $PID,"y"&$do,$recordy)
    $do = $do + 1
    msgbox(0,"Coordinates","Current position recorded.")
    MsgBox(0,"Debug","X: " & $recordx & @CRLF & "Y: " & $recordy & @CRLF & "PID: " & $PID)
    
    _MemoryClose($PID)
EndFunc

Func _Off()
    Exit
EndFunc

Func Go()
    For $i = 1 To $do
    $readx= IniRead("Coords.ini","PID = " & $PID,"x"&$i, "No")
    $ready= IniRead("Coords.ini","PID = " & $PID,"y"&$i, "No")
    $Curx = _MemoryRead($pointx,$Mem_Handle)
    $Cury = _MemoryRead($pointy,$Mem_Handle)
    Do
    If $Curx < $readx And $Cury < $ready Then
        MsgBox(0, "Woot", "Works!")
        Sleep(1000)
    ElseIf $Curx > $readx And $Cury > $ready Then
        
    EndIf
        Until $Curx >= $readx And $Cury >= $ready Or $Curx <= $readx And $Cury <= $ready
    Next
EndFunc

This is not working though:

Func Go()
    For $i = 1 To $do
    $readx= IniRead("Coords.ini","PID = " & $PID,"x"&$i, "")
    $ready= IniRead("Coords.ini","PID = " & $PID,"y"&$i, "")
    $Curx = _MemoryRead($pointx,$Mem_Handle)
    $Cury = _MemoryRead($pointy,$Mem_Handle)
    Do
    If $Curx < $readx And $Cury < $ready Then
        MsgBox(0, "Woot", "Works!")
        Sleep(1000)
    ElseIf $Curx > $readx And $Cury > $ready Then
        
    EndIf
        Until $Curx >= $readx And $Cury >= $ready Or $Curx <= $readx And $Cury <= $ready
    Next
EndFunc

From what I get out of that it reads the X in the ini file (and which number of X) and it should read the coordinate I'm at ($Curx) and then pop up that message box. Do I need to do more with the Ini read to get the actual numbers that X represents?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Why doesn't anyone ever help me.... I've posted like 2 threads with my entire code, and EXACTLY what I need help on... Yet the 17 views, no one bothers to even leave a reply... :mellow:

Func Go()
    For $i = 1 To $do
    $readx= IniRead("Coords.ini","PID = " & $PID,"x"&$i, "No")
    $ready= IniRead("Coords.ini","PID = " & $PID,"y"&$i, "No")
    $evalx= Eval($readx & "=")
    $evaly= Eval($ready & "=")
    $Curx = _MemoryRead($pointx,$Mem_Handle)
    $Cury = _MemoryRead($pointy,$Mem_Handle)
    Do
    If $Curx < $evalx Then

I tried putting in an Eval but that doesn't seem to be working either... I just need to know how to read the numbers to the right of the '=' in the ini file.... The X and Y's in the inifile go like so:

x=800

y=553

x1=803

y1=546

x2=808

y2=548

x3=814

y3=555

I want it to read the x=800 y=553 then go on down the line like so.... Thanks :S

Edited by UnknownWarrior

Share this post


Link to post
Share on other sites

Define var $do initiate value.

Your Code:

_Record() First => IniWrite as Key = 'x'

_Record() Second => IniWrite as Key = 'x1'

_Go() First => IniRead as Key = 'x1'

_Go() Second => Not avail by $do == 2

If you wat to know IniRead() retrived value, try 'default value' at IniRead()

Ex: IniRead( section , key, value(if key could not find) )

Share this post


Link to post
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
Sign in to follow this  
Followers 0