Jump to content
UBot Underground

Tutorial - How To Randomly Select Something


Recommended Posts

ui stat monitor("number picked",#randomselector)
set(#randomselector,$rand(1,5),"Global")
if($comparison(#randomselector,"<= Less than or equal to",4)) {
    then {
        alert("number {#randomselector} selected")
    }
    else {
        alert("number five selected (else)")
    }
}

Here above is a little code to understand how to randomize selections. Well it's one of the ways...

 

Ex:

You want the bot to click on YES (or whatever) more OFTEN. Well you would replace the ALERT COMMAND with your "Yes" CLICK COMMAND (or whatever you wish the bot to do) So numbers from 1 to 4 are GO, do something. 

 

If Number five is selected, then it will click NO button (or whatever you wish the bot to do) So number five is do something else.

 

In fact, you can put entire DEFINE commands in THEN and in ELSE

Just put the entire code in a loop so it will never stop.

ui stat monitor("number picked",#randomselector)
loop while($true) {
    set(#randomselector,$rand(1,5),"Global")
    if($comparison(#randomselector,"<= Less than or equal to",4)) {
        then {
            alert("number {#randomselector} selected")
        }
        else {
            alert("number five selected (else)")
        }
    }
    wait(3)
}
Link to post
Share on other sites

use variable in "loop while"

ui stat monitor("number picked",#randomselector)
set(#Check,$true,"Global")
loop while(#Check) {
    set(#randomselector,$rand(1,5),"Global")
    if($comparison(#randomselector,"<= Less than or equal to",4)) {
        then {
            alert("number {#randomselector} selected")
        }
        else {
            alert("number five selected (else)")
            set(#Check,$false,"Global")
        }
    }
    wait(3)
}
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...