Jump to content
Sign in to follow this  
o0johntam0o

"ControlClick" and Loop functions

Recommended Posts

o0johntam0o

I tried to use "ControlClick" in this code:

For $j=1 to $Sky_SoTang
        For $i=1 to $Sky_Times
            $Sky_Tmp=$Sky_xGold
            While ($Sky_Tmp<=$Sky_xGold+600)
                ControlClick("KVTM","",$Sky_ClassID, "Left", 1, $Sky_Tmp,$Sky_yGold+5)
                ControlClick("KVTM","",$Sky_ClassID, "Left", 1, $Sky_Tmp,$Sky_yGold-5)
                ;MouseClick("left",$Sky_Tmp,$Sky_yGold+5,1,0)
                ;MouseClick("left",$Sky_Tmp,$Sky_yGold-5,1,0)
                $Sky_Tmp+=10
                If $Sky_KTra=False Then
                    ToolTip("Đã ngừng nhặt gold",0,0,"Thông Báo")
                    $Sky_KTra=True
                    ExitLoop(3)
                EndIf
            WEnd
        Next
        If ($j<>$Sky_SoTang) Then 
            TangDuoi_Sky()
            Sleep(500)
        EndIf
    Next

But the "ControlClick" executed without any "Loop" (Including While...WEnd)

I tried replace it by "MouseClick" and it's ok

How can i slove this.

Edited by o0johntam0o

Share this post


Link to post
Share on other sites
MrMitchell

I tried to use "ControlClick" in this code:

For $j=1 to $Sky_SoTang
        For $i=1 to $Sky_Times
            $Sky_Tmp=$Sky_xGold
            While ($Sky_Tmp<=$Sky_xGold+600)
                ControlClick("KVTM","",$Sky_ClassID, "Left", 1, $Sky_Tmp,$Sky_yGold+5)
                ControlClick("KVTM","",$Sky_ClassID, "Left", 1, $Sky_Tmp,$Sky_yGold-5)
                ;MouseClick("left",$Sky_Tmp,$Sky_yGold+5,1,0)
                ;MouseClick("left",$Sky_Tmp,$Sky_yGold-5,1,0)
                $Sky_Tmp+=10
                If $Sky_KTra=False Then
                    ToolTip("Đã ngừng nhặt gold",0,0,"Thông Báo")
                    $Sky_KTra=True
                    ExitLoop(3)
                EndIf
            WEnd
        Next
        If ($j<>$Sky_SoTang) Then 
            TangDuoi_Sky()
            Sleep(500)
        EndIf
    Next

But the "ControlClick" executed without any "Loop" (Including While...WEnd)

I tried replace it by "MouseClick" and it's ok

How can i slove this.

You can make the following changes:

For $j=1 to $Sky_SoTang
        For $i=1 to $Sky_Times
            $Sky_Tmp=$Sky_xGold
            While ($Sky_Tmp<=$Sky_xGold+600)
                ;ControlClick("KVTM","",$Sky_ClassID, "Left", 1, $Sky_Tmp,$Sky_yGold+5)
                ;ControlClick("KVTM","",$Sky_ClassID, "Left", 1, $Sky_Tmp,$Sky_yGold-5)
                MouseClick("left",$Sky_Tmp,$Sky_yGold+5,1,0)
                MouseClick("left",$Sky_Tmp,$Sky_yGold-5,1,0)
                $Sky_Tmp+=10
                If $Sky_KTra=False Then
                    ToolTip("Đã ngừng nhặt gold",0,0,"Thông Báo")
                    $Sky_KTra=True
                    ExitLoop(3)
                EndIf
            WEnd
        Next
        If ($j<>$Sky_SoTang) Then 
            TangDuoi_Sky()
            Sleep(500)
        EndIf
    Next

More information can be found here

Share this post


Link to post
Share on other sites
o0johntam0o

T'm so sorry about this trouble, but i just want to know how can i use "ControlClick" in Loop functions

Thanks for any replies

Share this post


Link to post
Share on other sites
o0johntam0o

Oh I've just realized that i was wrong that "ControlClick" didn't work in Loops

'Cause i didn't use "ControlClick" in another functions which i just used "MouseClick" ( TangDuoi_Sky() ). It must be replaced all by "ControlClick"

Thanks.

Edited by o0johntam0o

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  

×