April 27, 201510 yr 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, 201510 yr by creationx
April 27, 201510 yr 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, 201510 yr by Khaleesi
April 27, 201510 yr Author Thank you, Daenerys Targaryen. It is my pleasure to serve under your wing.
April 29, 201510 yr 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()); }
Create an account or sign in to comment