Jump to content

Help with error please


Recommended Posts

  • Developers

Take a good look at your loops, you have an infinite loop somewhere.

Not really a loop, but a Func calling itself either directly or indirectly...

There are several posts with an explanation ...just search for them...

:P

Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

yeah there is a func that calls itself but it stops calling itself when it finds the colour is gone

it goes like this

Func _func ()

Sleep (1000)

Pixelsearch (xxxxxxxx)

If Not @error then

Mouseclick (xxxxxx)

_func ()

EndIf

If @error Then

_check ()

EndIf

EndFunc

Link to comment
Share on other sites

  • Developers

so instead of it calling itself should i make it call another function that clicks then calls the _func () again?

Nope... will give the same error..

If you want the code to repeat constantly you create a Loop with While...Wend.

While 1
    _Func()
WEnd
Func _func()
    Sleep(1000)
    PixelSearch(xxxxxxxx)
    If Not @error Then MouseClick(xxxxxx)
EndFunc   ;==>_func
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

so instead of it calling itself should i make it call another function that clicks then calls the _func () again?

If I understood that sentence correctly and if you worded as you meant to, then I have to say

that I think that would just make it even messier. Anyway, it's kind of hard to work without knowing

what _check() does but if you haven't done anything crazy there as well then this might work:

Func _func ()
    While 1
        Sleep (1000)
        Pixelsearch (xxxxxxxx)

        If Not @error Then
            Mouseclick (xxxxxx)
        Else
            ExitLoop
        EndIf
    WEnd

    _check ()
EndFunc
Link to comment
Share on other sites

ok, i got another error, more funcs calling themselves.

Func _radar ()

PixelSearch (894,655,989,739,16726065)

If Not @error Then

_radar1 ()

EndIf

If @error Then

Send ("{q down}")

Sleep (2000)

Send ("{q up}")

_radar ()

EndIf

EndFunc

\edit you can see that if it can't find the colour it holds q for a bit until it comes into view, so i have no idea how to make this not call itself

Edited by FifteenFifty
Link to comment
Share on other sites

thx, that should work, once again you have saved my life :P

/edit but how do i get it to call _radar1 ()?

you think this would work (i just wrote it)

Func _radar ()

While 1

PixelSearch (894,655,989,739,16726065)

If @error Then

Send ("{q down}")

Sleep (2000)

Send ("{q up}")

EndIf

Else

ExitLoop

WEnd

_radar1 ()

EndFunc

Edited by FifteenFifty
Link to comment
Share on other sites

I just noticed after I posted it that the function has no way to escape and that the script

is trapped inside that function. I only changed your script so you would have to add an

Return or ExitLoop somewhere..

Link to comment
Share on other sites

Is this what you meant to code ?

Func _radar()
    While 1
        PixelSearch(894, 655, 989, 739, 16726065)
        If @error Then
            Send("{q down}")
            Sleep(2000)
            Send("{q up}")
        Else
            ExitLoop
        EndIf
    WEnd
    _radar1 ()
EndFunc

But still, you don't get the point. You are calling a function inside the very same function.

The _radar() has NO way of escaping. Start reading from the top of the function and try

to follow the path a script would follow...tell me when you're finished :P

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