creationx Posted April 27, 2015 Share Posted April 27, 2015 (edited) 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 April 27, 2015 by creationx Quote Link to comment Share on other sites More sharing options...
Khaleesi Posted April 27, 2015 Share Posted April 27, 2015 (edited) 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 April 27, 2015 by Khaleesi 1 Quote Link to comment Share on other sites More sharing options...
creationx Posted April 27, 2015 Author Share Posted April 27, 2015 Thank you, Daenerys Targaryen. It is my pleasure to serve under your wing. 1 Quote Link to comment Share on other sites More sharing options...
lare96 Posted April 29, 2015 Share Posted April 29, 2015 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()); } Quote Link to comment Share on other sites More sharing options...