# Dunno do this...

## Recommended Posts

look i have a code here that i need 2 click once everytime that a color apeer : heres the code

```HotKeySet("{esc}","esc")
WinWaitActive("Tibia")
Func esc()
Exit
EndFunc
While 1
\$1=PixelGetColor(992,416)
If \$1=49152 Then
MouseClick("left",874,415,1)
Else
If \$1= 4737096 Then
Sleep(300)
EndIf
EndIf
WEnd```

##### Share on other sites

Sorry but, you already tried this?

MouseClick ( "button" [, x, y [, clicks [, speed ]]] )

##### Share on other sites

lol yes havent u seen the code? MouseClick("left",874,415,1)

the '1' there mean clicks

##### Share on other sites

lol yes havent u seen the code? MouseClick("left",874,415,1)

the '1' there mean clicks

<{POST_SNAPBACK}>

Won't get very far if you don't try to explain what errors your getting.

Try this:

```Opt("PixelCoordMode", 0); assuming your x and y coords are from an active window if not change 0 to 2
Opt("MouseCoordMode", 0); assuming your x and y coords are from an active window if not change 0 to 2

HotKeySet("{esc}","esc")
WinWaitActive("Tibia")
Func esc()
Exit
EndFunc
While WinExists("Tibia")
WinWait("Tibia")
If Not WinActive("Tibia") Then WinActivate("Tibia")
Sleep(200)
\$var = PixelGetColor(992,416)
ToolTip("Var Colour == 0x" & Hex(\$var, 6), 0, 0)
If \$var == 0x49152 Then; is your colour a hex or a dec?  I put 0x assuming that it is a hex.
MouseClick("left", 874, 415, 1, 1)
Else
If \$var == 0x4737096 Then
Sleep(300)
EndIf
EndIf
WEnd```

Edit: Please let us know what specifically your getting if this doesn't work... Good Luck!

Edited by ronsrules

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

## Create an account

Register a new account