Jump to content
UBot Underground

How To Restart Command If The Page Contains A Certain Text?


Recommended Posts

Hi,

 

So i want to restart a command if the page contains a certain text, when this text is not there i want ubot to do somthing els.

 

 

Idealy i want to make a bot like this

 

 

IF  text contains: example wurd

  Then restart the IF command      ( example word is on page)

   Els Go do somthing else             (example word is NOT on page)

 

 

 

What i want to ask is,  wich commands in ubot should i use ?

 

Anybody can get me in the right direction? 

 

Thanks

Link to post
Share on other sites

theres a lot of ways to do it,the best would probably be a define command,but heres a simple example

load html("<p id=\"text\">text</p>
")
loop while($comparison($scrape attribute(<id="text">,"innertext"),"=","text")) {
    wait(2)
    load html("<p id=\"text\">No longer</p>
")
}
alert("text changed")

Link to post
Share on other sites

This command will call itself until wurd is not found and track the number of times it s found:

ui stat monitor("Count:",#count)
comment("Counter to see how many times the command calls itself")
set(#count,0,"Global")
Recursive Command Name()
define Recursive Command Name {
    comment("Some random loading code so that it can eventually exit")
    set(#num,$rand(1,1000),"Global")
    comment("24/1000 chance of not being \"wurd\"")
    if($comparison(#num,">=",25)) {
        then {
            load html("wurd")
        }
        else {
            load html($random text(10))
        }
    }
    set(#text,$scrape attribute($element offset(<tagname="body">,0),"innertext"),"Global")
    if($contains(#text,"wurd")) {
        then {
            increment(#count)
            Recursive Command Name()
        }
        else {
            alert("No \"wurd\" found, do something else")
        }
    }
}

  • Like 1
Link to post
Share on other sites

Code is not jet my cup of thee.  Will watch all ubot training and hope it makes some more sens at the time.

 

I can drag and drope comands in to ubot, thats all the skills i have at the moment.

Link to post
Share on other sites

Code is not jet my cup of thee.  Will watch all ubot training and hope it makes some more sens at the time.

 

I can drag and drope comands in to ubot, thats all the skills i have at the moment.

 

Click on "Code View" and paste in the code, then click back to node view and you will be able to see the nodes the code represents.

  • 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...