Jump to content
UBot Underground

Random (Quick Question)


Recommended Posts

How to make random from only 1,4

 

 

 

i know only this way.. there is easier way ?

set(#random$rand(1, 2), "Global")
if($comparison(#random"=", 1)) {
    then {
        click(<for=1>"Left Click""No")
    }
    else {
    }
}

 

if($comparison(#random"=", 2)) {
    then {
        click(<for=4>"Left Click""No")
    }
    else {
    }
}

Edited by dahid84
Link to post
Share on other sites

 

You can take out the if commands

set(#random, $rand(1, 4), "Global")
click(<for=#random>, "Left Click", "No")

yes but random wil be pickup from 1,2,3,4 and i don't need 2,3 ;/ only 1 and 4

Link to post
Share on other sites

I use the above method but for a smaller range like that I use spin function as it is more "random" it seams.

 

Instead of getting a lot of one numbers in a row it gives different number more often.

 

 

alert($spin("\{1|2|3|4\}"))
define $random number(#MIN#MAX) {
    set(#F_index,#MIN,"Global")
    loop(#MAX) {
        add item to list(%F_ramd_list,#F_index,"Delete","Global")
        increment(#F_index)
    }
    set(#F_rand_list,%F_ramd_list,"Global")
    clear list(%F_ramd_list)
    return($spin("\{{$text from list($list from text(#F_rand_list,$new line),"|")}\}"))
}
comment("if you have a bigger bot then you might need to use a lot
so to drag from \"custome commands\"
is much easier and you end up using less code most of the time.
Also, if you want a larger range it is nice too.")
alert($random number(1, 4))

 

CD

Link to post
Share on other sites

 

 

You can take out the if commands

set(#random, $rand(1, 4), "Global")
click(<for=#random>, "Left Click", "No")

yes but random wil be pickup from 1,2,3,4 and i don't need 2,3 ;/ only 1 and 4

 

didn't see that till after I posted.

 

just use spin func with {1|4}

 

click(<for=$spin("\{1|4\}")>,"Left Click","No")

 

CD

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