Jump to content

Recommended Posts

Posted

In the following code i am using one function Start() to call on all other functions to keep my scripting simple. I have run into a dead in though. In the "Enter()" step of the function, it is of random timing that these pixels ( an on screen button ) will appear on the screen, therefore i need this step to continue to loop until it finds the button and then clicks it. The script is currently doing just this, however i need a way to advance the script ON mouse click so that AFTER the function has been looping, and has detected and clicked the button, then and only then will it move on to the "Attack()" step. I have tried many things to work this one out, including options other posters have responded with. Nothing has worked so i am reposting with hopes of a solution provided my more in depth explanation of what it is i am trying to accomplish. As you will see the "Attack()" Function is not created yet, as i am trying to find away to advance the script before i continue in writing the script. Thanks for all of your help and hope that someone can easily find a solution to my dead end.

====================================================================================================

HotKeySet("{F9}", "Start")
HotKeySet("{F10}", "Stop")
AutoItSetOption("WinTitleMatchMode", 4)
Global $handle = WinGetHandle("classname=GxWindowClassD3d")
   WinSetState($handle, "", @SW_SHOW)
   WinSetState($handle, "", @SW_SHOWMAXIMIZED)
While 1
    Sleep(1000)
WEnd

;===========================================
    Func start()
      While 1       
        Global $show = 0
        Global $target = 0x6a0706
        MouseClick("Right", 652, 421, 1, 0)
        Sleep(5000)
        Join()
        Sleep(5000)
        Enter()
        Sleep(5000)
        Attack()
        If $show > 0 then ExitLoop
      WEnd
    EndFunc
    
;========================================== 
      Func Join()
        $Coords = PixelSearch(180, 510, 328, 550, $target, 10)
        If isArray($Coords) then
        MouseClick("Left",$Coords[0], $Coords[1],1,1)
        EndIf
    EndFunc
    
;==========================================

    Func Enter()
        While 1
        $Coords = PixelSearch(472, 192, 640, 222, $target, 10)
        If isArray($Coords) then
        MouseClick("Left",$Coords[0], $Coords[1],1,1)
        EndIf
        WEnd
    EndFunc
    
;========================================== 

        Func Attack()
    
;========================================== 

         Func stop()
        Global $show = 1
        WinSetState("World of Warcraft", "", @SW_SHOW)
        WinSetState("World of Warcraft", "", @SW_MAXIMIZE)
        WinActivate($handle, "")
    EndFunc

...will never learn all there is to know about autoit, no worries...i came to the forums :)

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...