RubberBand

This is a generic rubber band script. Rubber band a button is equivalent to keep it pressed all the time. Usage: - Press "back" on Xbox360 Controller or "select" on PS3 Controller. - Now press the button you want to rubber band. - The player LED will be blinking until you stop the rubber band. - To disable the ruber band, press "back" or "select" again. NOTE: While the script is running, the "back" or "select" button press don't go to the console. You can rubber band any button you want, with exception of the analogic sticks and the D-Pad (you can do it with the analogic stick button).
Versionv1.0
Authorvkruoso
Publish DateSat, 20 Oct 2012 - 23:55
Last UpdateSat, 20 Oct 2012 - 23:55
Downloads263
RATE


1

0

Code: Select all
define NONE=255;
 
int rubberbanded,currentled,rubberbandbutton;
int led,button;
 
// buttons that may be rubber banded
int buttons[10];
 
init {
    buttons[0] = XB360_RB;
    buttons[1] = XB360_RT;
    buttons[2] = XB360_RS;
    buttons[3] = XB360_LB;
    buttons[4] = XB360_LT;
    buttons[5] = XB360_LS;
    buttons[6] = XB360_Y;
    buttons[7] = XB360_B;
    buttons[8] = XB360_A;
    buttons[9] = XB360_X;
    rubberbandbutton = NONE;
}
 
main {
    if(event_press(XB360_BACK)) rubberbanded = !rubberbanded;
    if(rubberbanded && rubberbandbutton!=NONE){
        set_led(getcurrentled(),3);
        combo_run(RubberBand);
    } else {
        set_led(getcurrentled(),1);
        rubberbandbutton = NONE;
    }
    getnewevent();
    set_val(XB360_BACK,0);
}
 
// set a button to be fully pressed (rubber banded)
combo RubberBand {
    set_val(rubberbandbutton,100);
}
 
// will return the number of the current on led
function getcurrentled(){
    led = 0;
    while(led<4){
        if(get_led(led)==1) currentled = led;
        led = led+1;
    }
    return currentled;
}
 
// will check the button pressed from the buttons list
function getnewevent(){
    button = 0;
    while(button<10){
        if(event_press(buttons[button])){
            rubberbandbutton = buttons[button];
            break;
        }
        button = button+1;
    }
}