// FAKE FRACTION SIMPLE RAPIDFIRE
//DECLARATIONS - define
//--------------------------------------------------------------
define RAPIDFIRE_BUTTON = 4; // RIGHT TRIGGER
//VARIABLES - int
//--------------------------------------------------------------
int check = TRUE;
int RATE_OF_FIRE = 100 ; // The initial rate of fire. Fractions should look like this 15.5 = 155. Use 155 for 15.5. 100 is 10.
int MyRate = 0;
int MyBit;
int MyResult;
int hold_time, rest_time;
//MAIN BLOCK - main
//--------------------------------------------------------------
main {
set_bits(MyBit, 0, 15, 255*257);
MyResult = (MyBit - ((1500*10)+536))*-1;
hold_time = MyResult / RATE_OF_FIRE;
rest_time = hold_time - 20;
if(rest_time < 0) rest_time = 0;
MyRate = MyRate - get_rtime()*2;
if(event_press(RAPIDFIRE_BUTTON)) {set_val(RAPIDFIRE_BUTTON, 100); check = TRUE; MyRate = hold_time;}
else if(get_val(RAPIDFIRE_BUTTON) && check) {set_val(RAPIDFIRE_BUTTON, 100);}
else if(!check) {set_val(RAPIDFIRE_BUTTON, 0);}
if(!get_val(RAPIDFIRE_BUTTON) && MyRate<=0 && check == FALSE) {MyRate = hold_time; check =TRUE;}
if(MyRate<=0 && check == TRUE) {MyRate = rest_time; check =FALSE;}
}