Feel free to play around with the code, it's not really nice because I never had the time to polish/finish it (and I fear I won't in the next months b/c I have many tests to pass).
Code:
#include <String.au3> #include <Mem.au3> #include <Array.au3>
Code:
Func _HexadecimalToDecimal($var)
$result = 0
$sum = 0
$power=0
Do
$currentDigit = StringRight(_MemRev($var),$power+1)
$currentDigit = StringLeft($currentDigit,1)
If $currentDigit = "A" Then
$currentDigit = 10
ElseIf $currentDigit = "B" Then
$currentDigit = 11
ElseIf $currentDigit = "C" Then
$currentDigit = 12
ElseIf $currentDigit = "D" Then
$currentDigit = 13
ElseIf $currentDigit = "E" Then
$currentDigit = 14
ElseIf $currentDigit = "F" Then
$currentDigit = 15
EndIf
$result=$currentDigit*16^$power
$power = $power + 1
$sum = $sum + $result
Until $currentDigit = "x"
Return $sum
EndFunc;==>_HexadecimalToDecimal by joshdb
At first you need to setup your waypoints (in my case it where 4). $WP is the starting waypoint "counter".Quote:
$Process = "Conquer.exe"
$Pid = ProcessExists($Process)
$h_open = _MemOpen($pid)
$ReadX = _MemRead($h_open,0x4FE53C,4)
$XCoord = _HexadecimalToDecimal($ReadX)
$ReadY = _MemRead($h_open,0x4FE540,4)
$YCoord = _HexadecimalToDecimal($ReadY)
_MemClose($h_open)
$MyCx=$XCoord
$MyCy=$YCoord
Code:
;~ Waypoints $WP=0 $WP1x=471 $WP1y=753 $WP2x=515 $WP2y=688 $WP3x=612 $WP3y=763 $WP4x=520 $WP4y=746
Currently the bot moves to Waypoint 1,2,3,4 and then back to 1. The MyCx,-20 part means he considers a waypoint as reached if he is only +-20 coordinates away from it, depending on your needs you can use 5 or less as well.
Best part is to put that into a variable you declare in the function cos now you have to change all of them << my bad.
You MUST read the x/y offsets before you start moving. Best is to put the mem reading part into the code like below.
The function is not really nice because I coded a logic for each waypoint instead of using variables. But if you just need a level bot that kills one spawn over and over it will do it's job.
But I won't be able to make anything nice in the next months so it might be helpfull for someone else.
And finally the move functions that actually make the bot move. Remove the " Send("{CTRLDOWN}"" if you want to walk/run instead of jumping.Quote:
func gotoWP ()
IF $MyCx >= $WP1x AND $MyCx-20< $WP1x AND $MyCy >= $WP1y AND $MyCy-20 < $WP1y ThenQuote:
$Process = "Conquer.exe"
$Pid = ProcessExists($Process)
$h_open = _MemOpen($pid)
$ReadX = _MemRead($h_open,0x4FE53C,4)
$XCoord = _HexadecimalToDecimal($ReadX)
$ReadY = _MemRead($h_open,0x4FE540,4)
$YCoord = _HexadecimalToDecimal($ReadY)
_MemClose($h_open)
$MyCx=$XCoord
$MyCy=$YCoord
$WP=1
Endif
IF $MyCx >= $WP2x AND $MyCx-20< $WP2x AND $MyCy >= $WP2y AND $MyCy-20 < $WP2y Then
$WP=2
Endif
IF $MyCx >= $WP3x AND $MyCx-20< $WP3x AND $MyCy >= $WP3y AND $MyCy-20 < $WP3y Then
$WP=3
Endif
IF $MyCx >= $WP4x AND $MyCx-20< $WP4x AND $MyCy >= $WP4y AND $MyCy-20 < $WP4y Then
$WP=0
Endif
Select
Case $WP=0
IF $MyCx >= $WP1x AND $MyCy >= $WP1y Then
Move1()
Endif
IF $MyCx <= $WP1x AND $MyCy <= $WP1y Then
Move4()
Endif
IF $MyCx <= $WP1x AND $MyCy >= $WP1y Then
Move2()
Endif
IF $MyCx >= $WP1x AND $MyCy <= $WP1y Then
Move3()
Endif
Case $WP=1
IF $MyCx >= $WP2x AND $MyCy >= $WP2y Then
Move1()
Endif
IF $MyCx <= $WP2x AND $MyCy <= $WP2y Then
Move4()
Endif
IF $MyCx <= $WP2x AND $MyCy >= $WP2y Then
Move2()
Endif
IF $MyCx >= $WP2x AND $MyCy <= $WP2y Then
Move3()
Endif
Case $WP=2
IF $MyCx >= $WP3x AND $MyCy >= $WP3y Then
Move1()
Endif
IF $MyCx <= $WP3x AND $MyCy <= $WP3y Then
Move4()
Endif
IF $MyCx <= $WP3x AND $MyCy >= $WP3y Then
Move2()
Endif
IF $MyCx >= $WP3x AND $MyCy <= $WP3y Then
Move3()
Endif
Case $WP=3
IF $MyCx >= $WP4x AND $MyCy >= $WP4y Then
Move1()
Endif
IF $MyCx <= $WP4x AND $MyCy <= $WP4y Then
Move4()
Endif
IF $MyCx <= $WP4x AND $MyCy >= $WP4y Then
Move2()
Endif
IF $MyCx >= $WP4x AND $MyCy <= $WP4y Then
Move3()
Endif
EndSelect
EndFunc
Code:
func Move1 ()
$xrand1=Random(341,682,1)
$yrand1=Random(20,256,1)
MouseMove($xrand1,$yrand1,0)
Send("{CTRLDOWN}")
MouseClick("Left")
Send("{CTRLUP}")
Sleep(300)
EndFunc
func Move4 ()
$xrand2=Random(314,682,1)
$yrand2=Random(512,640,1)
MouseMove($xrand2,$yrand2,0)
Send("{CTRLDOWN}")
MouseClick("Left")
Send("{CTRLUP}")
Sleep(300)
EndFunc
func Move2 ()
$xrand3=Random(512,1000,1)
$yrand3=Random(256,512)
MouseMove($xrand3,$yrand3,0)
Send("{CTRLDOWN}")
MouseClick("Left")
Send("{CTRLUP}")
Sleep(300)
EndFunc
func Move3 ()n
$xrand4=Random(20,314)
$yrand4=Random(384,640)
MouseMove($xrand4,$yrand4,0)
Send("{CTRLDOWN}")
MouseClick("Left")
Send("{CTRLUP}")
Sleep(300)
EndFunc






