Random Timer

This script shows you one of many ways you can get a psudo random number between 1000 and 4000. The intent is getting a random number for a wait( ); value, but this can be modified to get a random number for any reason.
Version1.00
AuthorElvish
Publish DateFri, 7 Aug 2015 - 21:29
Last UpdateFri, 7 Aug 2015 - 21:29
Downloads46
RATE


2

0

Code: Select all
////////////////////
//Psudo Randomizer//
////////////////////
 
int Wait_Minimum = 1000;
int Wait_Maximum = 4000;
 
int Random_Time = 0;
int Random_Wait = 0;
 
int Running = FALSE;
 
init{
    Random_Time = Wait_Minimum;
}
 
main {
    //Update this per milisecond of running
    Random_Time = Random_Time + get_rtime();
    if(Random_Time >= Wait_Maximum){
        Random_Time = Wait_Minimum;
    }
 
    //Press Right Stick to toggle
    if(event_press(XB1_RS)){
        Running = !Running;
    }
 
    //This will update the random wait time every time the combo runs
        //It can be anywhere from 1000 to 4000 MS waited.
    if(Running && !combo_running(Attack)){
        Random_Wait = Random_Time;
        combo_run(Attack);
    }
}
 
combo Attack
{
    set_val(XB1_RT, 100);
    wait(750);
    set_val(XB1_RT, 0);
    wait(Random_Wait);
}