Jump to content
UBot Underground

Weird Issue With Threading - Expert Help Needed


Recommended Posts

So I am developing a scheduler for a big bot I am creating. My issue is for some reason ubot is having issues doing math within a thread. If I run this script regularly it runs with no problems but once I put it into a thread and new browser it stops executing the math. Any help would be much appreciated.

 

ui text box("Articles To Submit", #Articles)
ui text box("Days", #Days)
ui button("RunTimer") {
   thread {
       in new browser {
           wait($eval($multiply(#Days, 86400)))
           Timer()
       }
   }
}
define Timer {
   set(#Seconds, $eval($multiply(#Days, 86400)), "Global")
   set(#TimeBetweenSubmissions, $eval($divide(#Seconds, #Articles)), "Global")
   set(#ArticlesSubmitted, 0, "Global")
   set(#AmountofSecondsPassed, 0, "Global")
   loop(#Articles) {
       loop(#TimeBetweenSubmissions) {
           wait(1)
           increment(#AmountofSecondsPassed)
       }
       increment(#ArticlesSubmitted)
       navigate("http://www.success.com/", "Wait")
   }
}

Link to post
Share on other sites

Change your variables to local stead of global from the advanced area of the node.

 


set(#Seconds, $eval($multiply(#Days, 86400)), "Local")
   set(#TimeBetweenSubmissions, $eval($divide(#Seconds, #Articles)), "Local")
   set(#ArticlesSubmitted, 0, "Global")
   set(#AmountofSecondsPassed, 0, "Local")


Link to post
Share on other sites

ui text box("Articles To Submit", #Articles)
ui text box("Days", #Days)
ui button("RunTimer") {
   set(#ArticlesSubmitted, 0, "Global")
   thread {
       in new browser {
           set(#AmountofSecondsPassed, 0, "Global")
           wait($eval($multiply(#Days, 86400)))
           Timer()
       }
   }
}
define Timer {
   set(#Seconds, $multiply(#Days, 86400), "Global")
   set(#TimeBetweenSubmissions, $divide(#Seconds, #Articles), "Global")
   loop(#Articles) {
       loop(#TimeBetweenSubmissions) {
           wait(1)
           increment(#AmountofSecondsPassed)
       }
       increment(#ArticlesSubmitted)
       navigate("http://www.success.com/", "Wait")
   }
}

 

Seems to work, but if you run more then 1 thread, then you will need to set the variables to local (which you cant see running in debugger when set to local)

Link to post
Share on other sites

Thanks for all your help. It seems to be working but for some reason the variables don't update. Ive added in after the "Success" navigation a save to file option. Which would save the position of all of the variables. That way if the bot crashed you could use the file to figure out where it left off. Any idea why the variables seem to be running correctly but I can't "see" or "print" them?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...