btw, one question, why do u need to output current mouse cusor X,Y?
since u know my ELSE bot doesnt even move the mouse cursor a bit....
ok, i will try to put some comments on the script i edit, check this thread back few mins later
since u know my ELSE bot doesnt even move the mouse cursor a bit....
ok, i will try to put some comments on the script i edit, check this thread back few mins later
Code:
#notrayicon
sleep 500
[COLOR="Blue"];this is for the controlclick later[/COLOR]
WinGet,iddd, ID,[Conquer2.0]
[COLOR="Blue"];make sure CO window is on-top[/COLOR]
WinActivate, [Con
[COLOR="Blue"];get the PID[/COLOR]
Process, Exist,Conquer.exe
pid = %ErrorLevel%[COLOR="Blue"]
;dont have a single clue what the following does [/COLOR]
ExtInt(ByRef pSource, pOffset = 0, pIsSigned = false, pSize = 4)
{
Loop %pSize%
result += *(&pSource + pOffset + A_Index-1) << 8*(A_Index-1)
if (!pIsSigned OR pSize > 4 OR result < 0x80000000)
return result
return -(0xFFFFFFFF - result + 1)
}[COLOR="Blue"]
;Create 4 Byte (Int) Structure for Char Xcoordo Base Address[/COLOR]
VarSetCapacity(Xcoordo,4,0)[COLOR="Blue"]
;Create 4 Byte (Int) Structure for Char Ycoordo Base Address[/COLOR]
VarSetCapacity(Ycoordo,4,0)[COLOR="Blue"]
;Open the Process for Handling[/COLOR]
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
[COLOR="Blue"];Get the raw 4 Bytes for Xcoordo in Variable[/COLOR]
DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",0x4E1028,"Str",Xcoordo,"UInt",4,"UInt *",0)
[COLOR="Blue"];Get the raw 4 Bytes for Ycoordo in Variable[/COLOR]
DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",0x4E102C,"Str",Ycoordo,"UInt",4,"UInt *",0)
[COLOR="Blue"];output those values into OrgX[/COLOR]
OrgX:=( "" . ExtInt(Xcoordo))
[COLOR="Blue"];output those values into OrgY[/COLOR]
OrgY:=( "" . ExtInt(Ycoordo))
[COLOR="Blue"];that is to make sure StartingXY is not error[/COLOR]
if OrgX = 0
{
reload
return
}
[COLOR="Blue"];set the boundaries according to the startingXY[/COLOR]
lowerboundX := orgX - 20
lowerboundY := orgY - 20
UpperboundX := orgX + 20
UpperboundY := orgY + 20
[COLOR="Blue"];Start the real looping to output currentXY [/COLOR]
Loop
{[COLOR="Blue"]
;exactly like the above, just that it is saving to CurrentX and CurrentY[/COLOR]
VarSetCapacity(Xcoord,4,0)
VarSetCapacity(Ycoord,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",0x4E1028,"Str",Xcoord,"UInt",4,"UInt *",0)
DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",0x4E102C,"Str",Ycoord,"UInt",4,"UInt *",0)
currentX:=( "" . ExtInt(Xcoord))
currentY:=( "" . ExtInt(Ycoord))
[COLOR="Blue"];display StartingXY and CurrentXY[/COLOR]
ToolTip, Starting: x%OrgX% y%OrgY%`nCurrent: x%currentX% y%currentY%,1,-30
[COLOR="Blue"];thats the compare function which i think its quite easy to understand
;so lets skip[/COLOR]
if currentX >= %UpperboundX%
{
ControlClick, x250 y230,ahk_id %iddd%,,Left
sleep 500
ControlClick, x130 y100,ahk_id %iddd%,,Left
sleep 500
ControlClick, x250 y230,ahk_id %iddd%,,Left
sleep 500
ControlClick, x130 y100,ahk_id %iddd%,,Left
sleep 500
}
else if currentX <= %lowerboundX%
{
ControlClick, x700 y521,ahk_id %iddd%,,Left
sleep 500
ControlClick, x900 y591,ahk_id %iddd%,,Left
sleep 500
ControlClick, x700 y521,ahk_id %iddd%,,Left
sleep 500
ControlClick, x900 y591,ahk_id %iddd%,,Left
sleep 500
}
else if currentY >= %UpperboundY%
{
ControlClick, x895 y100,ahk_id %iddd%,,Left
sleep 500
ControlClick, x774 y230,ahk_id %iddd%,,Left
sleep 500
ControlClick, x895 y100,ahk_id %iddd%,,Left
sleep 500
ControlClick, x774 y230,ahk_id %iddd%,,Left
sleep 500
}
else if currentY <= %lowerboundY%
{
ControlClick, x324 y521,ahk_id %iddd%,,Left
sleep 500
ControlClick, x124 y591,ahk_id %iddd%,,Left
sleep 500
ControlClick, x324 y521,ahk_id %iddd%,,Left
sleep 500
ControlClick, x124 y591,ahk_id %iddd%,,Left
sleep 500
}
sleep 1000
[COLOR="Blue"][COLOR="Blue"]
;this is to check if my ELSE get reloaded, this script will exit[/COLOR][/COLOR]
IfWinActive, ELSE
{
exitapp
}
}