Jump to content

any idea how can i make goto? call function doesnt to seem work

Recommended Posts

I just wanted to return back to the main function if pixelgetcolor did not matched  similiar to goto, but it gaves me error whenever there's no pixelgetcolor matched 

any suggestions?

Func main()
    Local $RandomNumber = Random(1,3,1)
   If $RandomNumber == 1 Then
   Local $click1= PixelGetColor ( 458 , 163 )
   If $click1 = (0x55556b) then
   MouseClick("primary",458,163, 10 , 0)
    call ("main")


    If $RandomNumber == 2 Then
   Local $click2= PixelGetColor ( 668 , 349 )
   If $click2 = (0x55556b) then
   MouseClick("primary",668,349, 10, 0)

    call ("main")


   If $RandomNumber == 3 Then
   Local $click3= PixelGetColor ( 520 , 449 )
   If $click3 = (0x55556b) then
   MouseClick("primary",520,449, 10, 0)

    call ("main")




Link to comment
Share on other sites

Func main()
    While (True)
        Switch Random(1, 3, 1)
            Case 1
                Local $click1 = PixelGetColor(458, 163)
                If $click1 = (0x55556b) Then
                    MouseClick("primary", 458, 163, 10, 0)
            Case 2
                Local $click2 = PixelGetColor(668, 349)
                If $click2 = (0x55556b) Then
                    MouseClick("primary", 668, 349, 10, 0)
            Case 3
                Local $click3 = PixelGetColor(520, 449)
                If $click3 = (0x55556b) Then
                    MouseClick("primary", 520, 449, 10, 0)
EndFunc   ;==>main


Link to comment
Share on other sites

Look at the Return command, and think about setting a value (variable) that is then checked.

P.S. That means creating a function with your code, and running/calling that, instead of that same code within your main function ... outsourcing that part of the process, so to speak.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.


What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)


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

  • Create New...