Sign in to follow this  
Followers 0
z999

my first gamebot!

1 post in this topic

#1 ·  Posted (edited)

I made my first game bot for tontie 1980.

the code

Dim $hammerPlace=3
Dim $tontiePlace
Dim $XY[6][3];array to store the X&Y values that the tonties should be in

;defining the X&Y values that the tonties should be in from left to right. ([1]=X and [2]=Y)
$XY[1][1]=550
$XY[1][2]=494

$XY[2][1]=590
$XY[2][2]=494

$XY[3][1]=630
$XY[3][2]=494

$XY[4][1]=670
$XY[4][2]=494

$XY[5][1]=710
$XY[5][2]=494

HotKeySet ("t","start")
HotKeySet ("s","stop")

While 1
    $stop=False
    Sleep (10)
WEnd



Func start()
    while $stop=False
        $tontiePlace=6;see the if function later
        For $i=1 To 5;check where is the tontie
            $color=PixelGetColor ($XY[$i][1],$XY[$i][2])
            If $color=000000 Then $tontiePlace=$i;set the tontie place
        Next
        If $tontiePlace<>6 Then Call ("setHammer")
    WEnd
EndFunc

Func setHammer()
    $move=$tontiePlace-$hammerPlace;very simple. will be positive if the tontie is to the right and if it's negative it's to the right
    Select
        Case $move>0
            For $i=1 to $move
                Send ("{RIGHT}")
            Next
        Case $move<0
            For $i=-1 to $move Step -1
                Send ("{LEFT}")
            Next
    EndSelect
    $hammerPlace=$hammerPlace+$move
    Sleep (50)
EndFunc

Func stop()
    $stop=True
    $hammerPlace=3
EndFunc

b.t.w. when you reach 1000 it goes back to the beginning.

where did the autoit code tag? (in the forum)

Edited by z999

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