malu05 Posted September 26, 2006 Share Posted September 26, 2006 I made a little running bot for games, its run forward(X), turnsleft {if it have turned a specific ammount of times it will start move right enstead turnsright} and loops X=how long it runs forward And it works fine... but every now and then autoit closes down my app and tells me; [i] >"X:\xx\autoit3.exe" /ErrorStdOut "X:\xx\Keen4runner.au3" X:\xx\Keen4runner.au3 (351) : ==> Recursion level has been exceeded - AutoIt will quit to prevent stack overflow.: sleep(100) >Exit code: 0 Time: 74.294[/i] I just dont know why this happens, it happens as i said every now and then and not on a specific time or when a variable reaches a number etc. expandcollapse popupFunc Keen4runner() ;;Check the shift button;; Send("{SHIFTUP}") $wlk1 = GUICtrlRead($walkforward) $wlk2 = GUICtrlRead($walkright) $wlk3 = GUICtrlRead($walkleft) $debug = GUICtrlRead($debugcheck) $loot = GUICtrlRead($lootcheck) ;;Walk forward;; Send("{w down}") ;Presses (W) for walk/run forward ;;After Right and Left process is over, set all variables to 0;; if $wright = $wlk3 Then $walkselect = 0 $wleft = 0 $wright = 0 $walk = 0 Keen4runner() endif ;;After Left process is finished start right process;; if $wleft = $wlk2 Then $walkselect = 1 endif ;;RIght and Left process;; if $walk = $wlk1 Then ; ;;left process;; if $walkselect = 1 Then Send("{w up}") Send("{d down}") sleep(300) Send("{d up}") sleep(100) $walk = 0 ;$wleft = 0 $wright = $wright + 1 Keen4runner() Endif ;;right process;; if $walkselect = 0 then Send("{w up}") Send("{a down}") sleep(300) Send("{a up}") sleep(100) $walk = 0 $wleft = $wleft + 1 Keen4runner() EndIf ;;move forward process;; EndIf if $walkselect = 0 then sleep(100) ;This cause the error $walk = $walk + 1 endif if $walkselect = 1 Then sleep(100) ;This cause the error too $walk = $walk + 1 ;$wleft = $wleft + 1 endif Keen4runner() EndIf Keen4runner() EndFunc ;==>Keen4runner Can anyone help me? [center][u]WoW Machinima Tool[/u] (Tool for Machinima Artists) [/center] Link to comment Share on other sites More sharing options...
cppman Posted September 26, 2006 Share Posted September 26, 2006 (edited) That is because you are calling Keen4runner() within itself too many times. Try another approach.. If you give me the full code, i'll see what i can do with it Edited September 26, 2006 by CHRIS95219 Miva OS Project Link to comment Share on other sites More sharing options...
malu05 Posted September 26, 2006 Author Share Posted September 26, 2006 (edited) That is because you are calling Keen4runner() within itself too many times. Try another approach.. If you give me the full code, i'll see what i can do with it thx for the fast reply! Hehe, im going to release the code here soon, but i have to keep it for myself untill then; But, i tried to fi it after what you said. But the fix doesnt seem to work... here it is; expandcollapse popup(dim $cmdtabel = 0).... func Cmdtable() Switch $cmdtabel Case 0 Keen4runner() Case 1 Checkrotation() Case 2 Attack() Case 3 Itemget() EndSwitch Endfunc Func Keen4runner() ;;Check the shift button;; Send("{SHIFTUP}") $wlk1 = GUICtrlRead($walkforward) $wlk2 = GUICtrlRead($walkright) $wlk3 = GUICtrlRead($walkleft) $debug = GUICtrlRead($debugcheck) $loot = GUICtrlRead($lootcheck) ;;Walk forward;; Send("{w down}") ;Presses (W) for walk/run forward ;;After Right and Left process is over, set all variables to 0;; if $wright = $wlk3 Then $walkselect = 0 $wleft = 0 $wright = 0 $walk = 0 Cmdtable() endif ;;After Left process is finished start right process;; if $wleft = $wlk2 Then $walkselect = 1 endif ;;RIght and Left process;; if $walk = $wlk1 Then ; ;;left process;; if $walkselect = 1 Then Send("{w up}") Send("{d down}") sleep(300) Send("{d up}") sleep(100) $walk = 0 ;$wleft = 0 $wright = $wright + 1 Cmdtable() Endif ;;right process;; if $walkselect = 0 then Send("{w up}") Send("{a down}") sleep(300) Send("{a up}") sleep(100) $walk = 0 $wleft = $wleft + 1 Cmdtable() EndIf ;;move forward process;; EndIf if $walkselect = 0 then sleep(100) ;This cause the error $walk = $walk + 1 endif if $walkselect = 1 Then sleep(100) ;This cause the error too $walk = $walk + 1 ;$wleft = $wleft + 1 endif Cmdtable() EndIf Cmdtable() EndFunc ;==>Keen4runner Even tho i removed the loop from the Keen4runner function it still causes the overflow error Edited September 26, 2006 by malu05 [center][u]WoW Machinima Tool[/u] (Tool for Machinima Artists) [/center] Link to comment Share on other sites More sharing options...
Helge Posted September 26, 2006 Share Posted September 26, 2006 Making another function call the same function again gives the same problems as making the function run itself. Let's say that everytime you call a function from another function you dig yourself deeper into the earth...if you don't stop this cycle you will end up digging yourself straight into the lap of the beast downstairs. If you make sure that you go back to the surface once in a while you simply avoid digging yourself too deep, without losing the functionality of your script. Instead of doing this : Func walk() If "checksomething" Then walk() Else ; something else EndIf EndFuncoÝ÷ Û*.r¥uÚ,¢g)à)¶¬jëh×6While 1 Sleep(10) If walk() = 0 Then walk() Else ;something else EndIf WEnd Func walk() If "checksomething" Then Return 1 Else Return 0 EndIf EndFunc Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now