Jump to content
UBot Underground

A Function That Does Stuff While Something Runs


Recommended Posts

Hey there

 

Is it possible to do "something" while a specific task is running?

 

What I´d like to achieve, is kind of an alive/status check.

 

While performing a define wrapped task, I´d need to check if the user(bot) still is logged in.

 

Basically:

define (Search Something)
      Loop through pages
          Search and Collect Data

At the moment i navigate to a page which is only visible if logged in. Then i check the page for a string. If the string is not there, id did not get to that page, which means i am not logged in.

 

I could check that at the end of every loop, but that feels not right (plus it would take much longer to finish that task and more data would have to be saved in memory). I would prefer to do this as another thread which checks the login status while the define (Search Something) is running.

 

 

 

 

 

Link to post
Share on other sites

That sounds like what i search for.

 

But how does the other thread know when to start and when to stop?

I remember there was something for executing/stopping a task, but i do not remember what it was. 

Link to post
Share on other sites

Here is an example in the real world you would want to maybe use something like in shared browser:

ui stat monitor("Parallel Task",#parallelIncremnt)
ui stat monitor("Long Running Task",#longRunningIncrement)
set(#taskRunning,$true,"Global")
thread {
    ParallelTask()
}
LongRunningTask()
define ParallelTask {
    set(#parallelIncremnt,0,"Global")
    loop while(#taskRunning) {
        wait(1)
        increment(#parallelIncremnt)
    }
    alert("Parallel task finished!")
}
define LongRunningTask {
    set(#longRunningIncrement,0,"Global")
    loop(3) {
        wait(5)
        increment(#longRunningIncrement)
    }
    set(#taskRunning,$false,"Global")
    alert("Long running task finished!")
}
  • Like 1
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...