[AutoIt] AutoScatter for lazy archers.

09/02/2009 17:42 clintonselke#1
Hi All,

I was getting lazy in Labby... Labby is just so boring its not funny.

So i wrote something simple, an AutoIt script that will scatter in the direction of greater mob density.

Heres the main loop.

PHP Code:
While 1
    
If NumMobs($hProcess) > 5 Then
        Dim $px
$py
        Dim $mx
$my
        $dx 
0
        $dy 
0
        GetMobXY
($hProcess$HeroBase$px$py)
        
$num NumMobs($hProcess)
        For 
$i 0 to $num-1
            GetMobXY
($hProcessGetMob($hProcess$i), $mx$my)
            
$dx2 $mx $px
            $dy2 
$my $py
            $mag 
$dx2 $dx2 $dy2 $dy2 1.0
            $dx2 
$dx2 $mag
            $dy2 
$dy2 $mag
            $dx 
$dx $dx2
            $dy 
$dy $dy2
        Next
        $mag 
Sqrt($dx $dx $dy $dy)
        If 
$mag <> 0 Then
            $tmp 
5.0 $mag
            $dx 
$dx $tmp
            $dy 
$dy $tmp
        
Else
            
$dx 1
            $dy 
0
        
EndIf
        
$x Floor($px $dx)
        
$y Floor($py $dy)
        
SkillXY($hProcess$SCATTER_ID$x$y)
    EndIf
    
Sleep(800)
WEnd 
As ya can see, it takes vectors pointing to the mobs from yourself. Then it scales these vectors inversely proportional to their own length (nearer mobs are more important than distant ones), then it adds all these vectors together, and scales it to unit length 5 for the direction to scatter in.

Hopefully this algorithm will hit most mobs, but not yet perfect. I can see some bad directions sometimes during gameplay.

Enjoy :D

Note: Only scatters if more than 5 mobs are around, to save on ur arrows.

Steps:
Step 1 - Run Conquer.
Step 2 - Run the AutoIt program (as administrator if using vista or windows 7)

HotKeys:
Alt+X - Closes the bot.
09/03/2009 13:15 daxik#2
may I ask how did you get to the mob list ?
09/04/2009 15:26 clintonselke#3
Quote:
Originally Posted by daxik View Post
may I ask how did you get to the mob list ?
Memory functions found in olly.

The function for the number mobs was reversed, but i was too lazy for the function for getting a mob by its index so i just called its memory function instead.