Tomm Posted March 22, 2017 Share Posted March 22, 2017 (edited) Hello I am new on autoit and I was writing a bot but seems that I have a problem with my loop that counts cycles. Can you take a look and sugest anything? This is only part of the script. expandcollapse popupFunc Main() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Start Start() Case $Stop Stop() Return Start() EndSwitch WEnd EndFunc Func Start() Global $var2 = GUICtrlRead ($Input1) Local $Input1 = "" Sleep(20) Sleep(Random(1,200)) Return Patikra0() EndFunc Func Patikra0() Local $var1 = GUICtrlRead ($Input1) Local $Input1 = "" If $var1 = 0 and $var2 = 0 Then $Loop0 = 0 ElseIf $var1 <> 0 or $var2 <> 0 Then $Loop0 +=1 ;~ I need this $Loop0 to add +1 and not stack overflow my funck. This variable needs to count. EndIf GUICtrlSetData ($gap0, $Loop0) Return Patikra1() EndFunc Func Patikra1() Local $var1 = GUICtrlRead ($Input1) Local $Input1 = "" If $var1 = 1 and $var2 = 1 Then $Loop1 = 0 ;~ ElseIf $var1 <> 1 or $var2 <> 1 Then $Loop1 += 1 I need this $Loop1 to add +1 and not stack overflow my funck. This variable needs to count. EndIf GUICtrlSetData ($gap1, $Loop1) Return Start() EndFunc Func Stop() Exit 0 EndFunc Edited March 22, 2017 by Melba23 Added code tags Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 22, 2017 Moderators Share Posted March 22, 2017 Tomm, Welcome to the AutoIt forums. I am not surprised that you get overflow problems with that code - it is as recursive a piece of code as I have ever seen posted here! it is also one of the more impenetrable scripts I have come across, without a word of explanation on what is happening - how a bout a description of what it is you are trying to accomplish? M23 P.S. When you post code please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Tomm Posted March 22, 2017 Author Share Posted March 22, 2017 I am trying to count different variables that I put in and the gap between them. Mainly my variable $Loop count gap between sequence of numbers. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 22, 2017 Moderators Share Posted March 22, 2017 Tomm, As clear as mud. You seem only to have a single input ($Input1), so where do you get these "different variables" that you "put in"? You certainly do read that input twice and put the results in $var1 & $var2, but as you only leave a maximum of 220 msecs inbetween the 2 reads, I wonder how you ever expect the 2 to differ..... Help us to help you - please provide a decent explanation of what is supposed to happen in this script or we are not really going to be able to offer you any sensible help as to how to structure your code. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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