Jump to content

Recommended Posts

Posted (edited)

Hi all,

I'm working on a WoQ2 Bot. The Bot runs well but I got some trouble with the mouseclick() function. The click doesnt work allways. Seems like the programm doesnt click arround 2 times of 10 trys...

The problem is that i want to write moving functions in the next time but if the mouseclick doesnt work the moving functions will not work with 100 % guarantee. Is there any solutions to get a 100 % working click ?

I hope someone can help me ;)

Here is a example file how i tested the mouseclick...

; search and click on npc
$coord = searchForColor(50, 50, 700, 400, 13507642)
if IsArray($coord) Then
    MouseMove($coord[0], $coord[1], 0)
    Sleep(100)
    MouseClick("left"); <<<< this doesnt work alltime :(
EndIf

;===================================================================================================
== 
; This function will search for a color and gives a array back
;===================================================================================================
== 
Func searchForColor($XStart, $YStart, $XEnd, $YEnd, $SearchColor)

;-------------------------------------------------------------------------------------------------
; Parameters for this function:
; - $XStart         -> Coord for left
; - $YStart         -> Coord for top
; - $XEnd           -> Coord for right
; - $YEnd           -> Coord for bottom
; - $SearchColor    -> find this clor
;-------------------------------------------------------------------------------------------------
    
    $Coord = PixelSearch( $XStart, $YStart, $XEnd, $YEnd, $SearchColor, 25)
    If Not @error Then
        LogEvent(9, "searchForColor -> Color: " & $SearchColor & " found! X and Y are:", $Coord[0] & "," & $Coord[1]); for debug
    Else
        LogEvent(9, "searchForColor -> Color: " & $SearchColor & " not found!"); for debug  
        $Coord = @error
    EndIf       
    
    Return $Coord
        
EndFunc
Edited by CosmosTunes
Posted

MouseClick("left"); <<<< this doesnt work alltime ;)

how do you know it does not work?

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Posted

because i used this test script many times in the game. he allways find the npc where he should click. the script move the mouse over him. but it doesnt click allways on it ;)

arround 8 of 10 trys...

Posted

But if the problem is the click, how do you know that the mouse is in the right position?

You have now this:

MouseMove($coord[0], $coord[1], 0)
Sleep(100)
MouseClick("left")

You could drop these lines for: MouseClick("Left", $coord[0], $coor[1])

Perhaps that the mousemove isn't that fast to be in $coord[0] and $coord[1] in 0,1 sec...

Neo

[center][font="Arial"]--- The Neo and Only --- [/font][font="Arial"]--Projects---[/font]Image to Text converterText to ASCII converter[/center]

Posted

I had this problem a few months ago (my first experience with AutoIt) and discovered the same thing. The solution I found was MouseClick("primary") worked all the time.

Posted

I had this problem a few months ago (my first experience with AutoIt) and discovered the same thing. The solution I found was MouseClick("primary") worked all the time.

i know that the mouse position is not my problem because the mouse courser is on the right position. maybe you got write that the mouse speed is not enough.

i will try MouseClick("primary", $coord[0], $coor[1]) tonight.

I hope this problem fix it. thx for the reply.

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
×
×
  • Create New...