Jump to content

Clicking on a Coordinate from Memory


Recommended Posts

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

Opt("GUICloseOnEsc",1)

HotKeySet("{F5}", "On")
HotKeySet("{F7}", "Pause")

Dim $pointx, $pointy, $recordx, $recordy, $Paused = True, $clients=0
Global $dll = DllOpen("user32.dll"); 

Global $pointx = "0x0057F9B8" 
Global $pointy = "0x0057F9BC"   

$PID = ProcessExists("Conquer.exe")


#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
    If $start=true Then
;WinWaitActive("[Conqer2.0]")
        $clients=$clients+1 
        $Title=WinSetTitle("[ACTIVE]","",$clients) 
        Sleep(1000)

            $do = 1
            Do
                If _IsPressed(1,$dll)=1 Then
            $Mem_Handle = _MemoryOpen($PID)

                $recordx = MouseGetPos(0);_MemoryRead($pointx , $Mem_Handle, "")
                IniWrite("Coords.ini",$Title,"x"&$do,$recordx) 
                $recordy = MouseGetPos(1);_MemoryRead($pointy , $Mem_Handle, "")
                IniWrite("Coords.ini",$Title,"y"&$do,$recordy) 
                $do = $do + 1
                sleep(1000)
                endif



            Until $do = 16  
            msgbox(0,"","Done")
            IniWrite("Coords.ini","Titles","Number",$clients)
            $start=false
        EndIf



WEnd
Wend



Func On()
    If $start=true Then
        $start=False
    elseif $start=false Then
        $start=True
    EndIf
    If $start=true Then
        MsgBox(0, "Conquer", "Bring up your conquer window")
    EndIf
EndFunc

After this:

IniWrite("Coords.ini","Titles","Number",$clients)

I want it to IniRead recordx and recordy from the Ini file...

Now I'm asking... I'm stuck here... How can I have it read each individual x and y and GO to those on Conquer. I would have it search for pointy and pointx until it gets within about 20 coords either way of that 1 coordinate (x, y)... But what mathematical equation could get me this? Some thoughts:

If $pointx < or > $recordx Then
IniRead(Not sure what goes here though... *READ FIRST X IN INI FILE*)
MouseClick("left", $recordx[0], $recordx[1]
EndIf

But what thats saying is to read the ENTIRE $recordx ini file... I just want it to read the VERY FIRST X it writes down in the Do loop THEN mouse click within a 10 coordinate radius (20 coordinate diameter) circle from the first x (and then the y) coordinate.

Also, what would I do if the x, y wasn't in the screen? Which way would the bot know how to jump to get to that? If it jumps up and gets farther away then how will it know to go the other way and etc...

I understand this is all a bunch of mathematical equations (except for the IniReading of the very first X and the 15 X's following that)... But I'm not that great of a math wiz... I can work problems out that are in front of me but I cannot create my own answer without a real problem.

All the help would be much appreciated, thanks.

Edited by UnknownWarrior
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...