Amateur in need of help with a simple script

GPC1 script programming for Titan One. Code examples, questions, requests.

Amateur in need of help with a simple script

Postby Zanzo » Mon Aug 12, 2019 3:33 pm

Basically what I am trying to do is have my script call a specific combo based on the value of a flag (or switch). I would like it to run the QuickJoin combo if the flag is set to FALSE, or the QuitToFreeRoam combo if the flag is set to TRUE. So initially the flag is false, the script runs the QuickJoin combo, then after the combo completes I'm trying to have my script run a combo or function that holds the LB button and rotates the RS clockwise repeatedly until it receives any kind of rumble feedback then changes the value of the flag/switch (ie: if true set to false, if false set to true) when it receives a rumble. Then starts the whole thing again but this time executes the QuitToFreeRoam combo instead of QuickJoin because the flag changed

Code: Select all
// Basic Turbo Tutorial Script
 
 
 
define speed=80;            // This number denotes both how long the button is held as well as how long of a pause is in-between button presses.
                            // Larger numbers slow the speed of turbo whereas smaller numbers increase the speed.
 
define button=XB1_LS;        // 4 is the identifier for the RT on the XB1 and 360 and R2 on the PS3/4. Auto-fire of a weapon makes things easier,
define btnLeft=XB1_LEFT;
define btnUP=XB1_UP;
                            // and this is the most common button used to fire. For a complete list of identifiers see section 12 (bottom):
                            // http://goo.gl/sQ2lcg
 
int loop;                   // Initialize keyword for our switch to turn this script on and off at will.
int looper=0;
int boolRumbleCheck;        // Initialize keyword for our RumbleCheck to switch between calling QuitToFreeRoam & QuickJoin
int result;
int boolStep;
 
main {
 
    if (event_press(XB1_LS)) {loop=!loop;}          // Press LS/L3 (identifier 8) to enable/disable this combo.
    if (loop) {combo_run(switch);}             // If the loop is active, run the combo 'switch'.
    if (!loop) {combo_stop(switch);}           // If the loop is inactive, stop combo.
                                               // Since this command resides in the MAIN area of the script, it is always running.
                                               // You can start and stop this at will by pressing LS/L3.
    result = RumbleCheck(boolRumbleCheck);
    if (!result)
    }
    else
    {
        call (QuickJoin);
    }
}
 
combo switch {
 
    //if (get_val(button)) {combo_run (FarmingMethod);}    // This runs the combo whenever the button (RT/R2 in this case) is pressed.
    //combo_run (FarmingMethod);
    //call (QuitToFreeRoam);
    //call (RumbleCheck);
    //combo_stop (QuitToFreeRoam);
    //combo_run (QuickJoin);
 
}
 
combo FarmingMethod {
    call (QuickJoin);
    //combo_run (XboxJoinFriend);
    call (QuitToFreeRoam);
}
 
combo QuickJoin {
    wait (4000);
    wait (4000);
    wait (4000);
    wait (3000);            //Wait 15s
    //wait (4000);
    //wait (4000);
    //wait (4000);
    //wait (3000);            //Wait 15s
    set_val(XB1_LEFT,100);
    wait (speed);
    set_val(XB1_LEFT,0);
    wait (2000);
    set_val(XB1_UP,100);
    wait (speed);
    set_val(XB1_UP,0);
    wait (1000);
    set_val(XB1_UP,100);
    wait (speed);
    set_val(XB1_UP,0);
    wait (1000);
    set_val(XB1_A,100);
    wait (speed);
    set_val(XB1_A,0);
    wait (1000);
    set_val(XB1_UP,100);
    wait (speed);
    set_val(XB1_UP,0);
    wait (500);
    set_val(XB1_UP,100);
    wait (speed);
    set_val(XB1_UP,0);
    wait (500);
    set_val(XB1_UP,100);
    wait (speed);
    set_val(XB1_UP,0);
    wait (500);
    set_val(XB1_A,100);
    wait (speed);
    set_val(XB1_A,0);
}
 
combo XboxJoinFriend {
    set_val(XB1_LEFT,100);
    wait (speed);
    set_val(XB1_LEFT,0);
    wait (1000);
    set_val(XB1_DOWN,100);
    wait (speed);
    set_val(XB1_DOWN,0);
    wait (1000);
    set_val(XB1_A,100);
    wait (speed);
    set_val(XB1_A,0);
    wait (1000);
    set_val(XB1_A,100);
    wait (speed);
    set_val(XB1_A,0);
    wait (1000);
    set_val(XB1_DOWN,100);
    wait (speed);
    set_val(XB1_DOWN,0);
    wait (800);
    set_val(XB1_A,100);
    wait (speed);
    set_val(XB1_A,0);
    wait (3000);
    set_val(XB1_DOWN,100);
    wait (speed);
    set_val(XB1_DOWN,0);
    wait (800);
    set_val(XB1_DOWN,100);
    wait (speed);
    set_val(XB1_DOWN,0);
    wait (1000);
    set_val(XB1_A,100);
    wait (speed);
    set_val(XB1_A,0);
    wait (4000);
    set_val(XB1_B,100);
    wait (speed);
    set_val(XB1_B,0);
    wait (500);
    //set_val(XB1_B,100);
    //wait (speed);
    //set_val(XB1_B,0);
    //wait (4000);
    //wait (4000);
    //wait (4000);
    //wait (4000);
    //wait (4000);
    //wait (4000);
    //wait (4000);
    //wait (2000);            //Wait 30s
    //combo_run (QuickJoin);
    //combo_stop (QuickJoin);
}
 
combo QuitToFreeRoam {
    //set_val(XB1_LEFT,100);
    //wait (speed);
    //set_val(XB1_LEFT,0);
    //wait (1000);
    //set_val(XB1_UP,100);
    //wait (speed);
    //set_val(XB1_UP,0);
    //wait (1000);
    //set_val(XB1_A,100);
    //wait (500);
    set_val(XB1_XBOX,100);
    wait (speed);
    set_val(XB1_XBOX,0);
    //wait (500);
    //set_val(XB1_A,0);
    wait (1000);
    //set_val(XB1_XBOX,100);
    //wait (speed);
    //set_val(XB1_XBOX,0);
    //wait (800);
    call (XboxJoinFriend);
    wait (4000);
    wait (4000);
    wait (4000);
    wait (4000);
    wait (4000);
    wait (4000);
    wait (4000);
    wait (2000);            //Wait 30s
    //call (QuickJoin);
}
 
combo LBRSCircle{
    set_val(XB1_RX, -100);
    wait (250);
    set_val(XB1_RX, 0);
    wait (250);
    set_val(XB1_RY, 100);
    wait (250);
    set_val(XB1_RY, 0);
    wait (250);
    set_val(XB1_RX, 100);
    wait (250);
    set_val(XB1_RX, 0);
    wait (250);
    set_val(XB1_RY, -100);
    wait (250);
    set_val(XB1_RY, 0);
    wait (250);
}
 
function RumbleCheck(boolRumble) {
    while (boolRumble == FALSE)
    {
        combo_run (LBRSCircle);
        if(get_rumble(RUMBLE_A) || get_rumble(RUMBLE_B))
        {
            combo_stop (LBRSCircle);
            boolRumble = TRUE;
            boolStep = !boolStep;
            return boolStep;
        }
    }
}


I know my code is sloppy as hell, I've been fooling around with tons of ideas in this same script file lol... but if anyone could either clean my code up to achieve the result im looking for, or possibly just write a fresh script that can do what i'm looking for.
User avatar
Zanzo
Private
Private
 
Posts: 1
Joined: Tue Jul 09, 2019 4:07 am

Re: Amateur in need of help with a simple script

Postby J2Kbr » Mon Aug 19, 2019 6:39 pm

Related with your first request, to run a combo use the command "combo_run". The command "call" works only inside combos, it is intended to start other combo and wait until that combo finishes before proceed with the combo that used "call".

Code: Select all
    result = RumbleCheck(boolRumbleCheck);
    if (!result) {
        combo_run(FarmingMethod);
    }
    else
    {
        combo_run(QuickJoin);
    }
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm


Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 105 guests

cron