ohsnap 0 Posted March 24, 2015 Report Share Posted March 24, 2015 Can somebody please shed some light onto UBot's stange looping / threading behavior? When I run the following code, I get three alerts: 1, 2, and 3. (Strange that it's not 0,1, and 2, but that's besides the point). set(#loopCounter,0,"Global")loop(3) { thread { alert(#loopCounter) } increment(#loopCounter)} However, when I run the following code (I added "in new browser") my three alerts are all "3" set(#loopCounter,0,"Global")loop(3) { thread { in new browser { alert(#loopCounter) } } increment(#loopCounter)} I am trying to keep a variable inside each thread to keep track of that particular thread - but either UBot is not thread safe or I am doing something wrong. Any help greatly appreciated. Thanks Quote Link to post Share on other sites
ohsnap 0 Posted March 24, 2015 Author Report Share Posted March 24, 2015 I found the solution, thanks to Dan in an old thread.. http://www.ubotstudio.com/forum/index.php?/topic/17292-info-biggest-mistake-with-threading/?hl=thread+variable Quote Link to post Share on other sites
gavind 6 Posted March 25, 2015 Report Share Posted March 25, 2015 The best thing about it too is that he started the thread sharing what he found out. +1 to Dan! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.