Jump to content

Randomly picking a case


creationx

Recommended Posts

Hey guys, super noob AGAIN.

 

So I'm currently in the process of developing my anti-ban for my scripts, and I want to do the following.

 

 

I want to generate a random number, then using that number, pick an antiban through cases.

 

FOR EXAMPLE:

 

My script CXMonkCurser has done a bunch of curses and it's time to antiban, so we call upon antiban;

 

then antiban generates the number 42.

 

So then it goes into the antiban and checks which antiban it should used based on the number generated "42".

 

Case1-100: do nothing

Case100-200: click a random tab

case300-400: spin camera

 

in this example it would go to case1-100 and do nothing.

 

 

How would I go about turning this idea into useable code?

Edited by creationx
Link to comment
Share on other sites

How would I go about turning this idea into useable code?

if(number <=100){
   // Do nothing
}else if(number <= 200){
   // Click tab
}else if(number <= 300){
   // Spin camera
}else{
   // Even higher
}
Why not just get a random number from 0-2 ?

switch(number){
   case 1:
   // Click tab
   break;

   case 2:
   // Spin camera
   break;
}
Edited by Khaleesi
  • Like 1
Link to comment
Share on other sites

Thank you, Daenerys Targaryen. It is my pleasure to serve under your wing.

 

Could also do something like this if you're using some sort of event-node state system.

private static final ImmutableList<Event> ANTIBAN = ImmutableList.of(new IdleEvent(), new AntibanEvent1(), new AntibanEvent2());

private static Event getRandomEvent() {
    return ANTIBAN.get((int) Math.random() * ANTIBAN.size());
}
Link to comment
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.
Note: Your post will require moderator approval before it will be visible.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...