Jump to content

"ControlClick" and Loop functions


Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...