Fake Fractions - The first ever script with fractions

GPC doesn't allow fractions. E.g GPC drops the fraction and returns an integer. 9/4 is equal to 2 because the fraction is dropped. I purpose a workaround for this.Take a look at this script. This script is a demonstration demonstrating "fake" fractions. Press dpad UP to increase rate of fire. I think you will notice an increase in precision compare to normal rapidfire scripts.. This is not the "final" fake fraction script. I will improve the formula. Please enjoy. - Token
Version1.01
Authortoken
Publish DateSat, 3 May 2014 - 21:43
Last UpdateWed, 7 May 2014 - 01:03
Downloads187
RATE


3

0

Release Notes: I added one more comment.
Code: Select all
// adjustable RAPIDFIRE using more accurate values
define RAPIDFIRE_BUTTON = XB1_RT; // The rapidfire button
define ROF_UP = XB1_UP; // Press UP for increase
define ROF_DOWN = XB1_DOWN; // Press DOWN for decrease
define ROF_RESET = XB1_RIGHT; // Press RIGHT for reset
 
int check = TRUE;
int RATE_OF_FIRE_DEFAULT = 10 ; // The default rate of fire for reset
int RATE_OF_FIRE = 10 ; // The initial rate of fire. Fractions should look like this 15.5 = 155. Use 155 for 15.5
int MyRate = 0;
int MyBit;
int MyResult;
int hold_time, rest_time;
 
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(ROF_UP)) {
RATE_OF_FIRE = RATE_OF_FIRE + 10;}
if(event_press(ROF_DOWN)) {
RATE_OF_FIRE = RATE_OF_FIRE - 10;}
if(event_press(ROF_RESET)) {
RATE_OF_FIRE = RATE_OF_FIRE_DEFAULT ;}
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;}
}