# my first gamebot!

## Recommended Posts

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

## Create an account

Register a new account

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...