Jump to content

Stack Overflow - (Locked)


Recommended Posts

Hello Guys, iam troubling a few days with a larger script, it is working fine but after a while i get a stack overflow message. Iam new in using Autoit and iam searching like 3 days to prevent stack overflow but nothing seems to work for me. Can someone explain what iam doing wrong and what i should do to prevent it?


Thanks in advice.

 



 

HotKeySet("{NUMPAD7}", "gluecksrad")
HotKeySet("{DEL}", "stop")

While 1

    Sleep(100)

WEnd

Func stop()

    Exit
EndFunc   ;==>stop


Func gluecksrad()
    $gluecksrad = PixelGetColor(164, 55)
;~ $Random2 = Random(4000, 4100 , 1)
    If $gluecksrad = 0xE5E5E5 Then
        ToolTip("")
        Sleep(100)
        Send("{s down}")
        Sleep(10)
        Send("{s up}")
        Exit
    Else
        ToolTip("Suche Taste für Glücksrad")
        Sleep(1)
        ToolTip("")
        Sleep(1)
        Return gluecksrad()

    EndIf

EndFunc   ;==>gluecksrad

 

Link to comment
Share on other sites

Well yea i have a problem with this:

Sleep(1)
ToolTip("")
Sleep(1)
Return gluecksrad()

Mainly because of 2 things:

a sleep of 1 (milisecond), is just too low of a value, and by the same token, after you set a tooltip, you clear the tooltip after 1ms, so it's all pointless.

And then you do a return of a function, instead of a value, or variable. As i understand it, what you're doing here is calling this function inside of itself.

This is recursion, you have to call the function from outside, or let it do it's thing. Really what i would do is put all this inside the main loop, if it's to be called continuously.

If there is any incorrection in what i said, please do correct.

Alternative code:

ToolTip("Suche Taste für Glücksrad") ;set tooltip
Sleep(1000) ;wait 1 second
ToolTip("") ;clear TT
Return $gluecksrad ;return the variable with the value of the pixelsearch

Or just don't return the value, since it seems like you don't really need it.

Edited by careca
Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

I just added 1 millisec to let it faster Appear to try when i something changed if the error dissappears. Usally i use more than two functions and one functions calls to another function if a condition is reach. As i understand you right it seems dont finish the function if iam calling in that function another one?

Link to comment
Share on other sites

Something to chew on.

If the error disappears you can call the tooltip clear then. Still doesn't make sense to call, wait 1ms and clear it. It's not even going to show up, or maybe will glitch.

 

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Okay so if iam do it something like this? It should end Function and iam dont get stack overflow right? Dont ask if that function make any sense iam just to try to figure out how i can call from one Function to another one without error^^

Thank you a lot for your help!

 

HotKeySet("{NUMPAD7}", "gluecksrad1")
HotKeySet("{DEL}", "stop")

$job1=1
$job2=2
$job3=3


$dojob = gluecksrad1 ()

While 1
   Switch $dojob

       Case $job1 = gluecksrad1 ()

       Case $job2 = gluecksrad2 ()

       Case $job3 = gluecksrad3 ()

    EndSwitch


WEnd

Func stop()

    Exit
EndFunc   ;==>stop


Func gluecksrad1()
    $gluecksrad1 = PixelGetColor(164, 55)
;~ $Random2 = Random(4000, 4100 , 1)
    If $gluecksrad1 = 0xE5E5E5 Then
        ToolTip("")
        Sleep(100)
        Send("{s down}")
        Sleep(10)
        Send("{s up}")

    Else
        ToolTip("Suche Taste für Glücksrad 1")
        Sleep(1)
        ToolTip("")
     Return $job2

    EndIf

EndFunc   ;==>gluecksrad


Func gluecksrad2()
    $gluecksrad2 = PixelGetColor(164, 55)
;~ $Random2 = Random(4000, 4100 , 1)
    If $gluecksrad2 = 0xE5E5E5 Then
        ToolTip("")
        Sleep(100)
        Send("{s down}")
        Sleep(10)
        Send("{s up}")
        Exit
    Else
        ToolTip("Suche Taste für Glücksrad 2")
        Sleep(1)
        ToolTip("")
    Return $job3

    EndIf

EndFunc   ;==>gluecksrad

Func gluecksrad3()
    $gluecksrad3 = PixelGetColor(164, 55)
;~ $Random2 = Random(4000, 4100 , 1)
    If $gluecksrad3 = 0xE5E5E5 Then
        ToolTip("")
        Sleep(100)
        Send("{s down}")
        Sleep(10)
        Send("{s up}")
        Exit
    Else
        ToolTip("Suche Taste für Glücksrad 3")
        Sleep(1)
        ToolTip("")
        Sleep(1)
    Return $job1
    EndIf

EndFunc   ;==>gluecksrad

 

Link to comment
Share on other sites

  • Moderators

Welcome to the AutoIt forum.

Unfortunately you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game automation - and then you will understand why you will get no help and this thread will now be locked.

See you soon with a legitimate question I hope.

The Moderation team

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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