help with simple script!

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

help with simple script!

Postby saminleo » Thu Feb 14, 2019 12:01 pm

Hi there

I need a script that runs every hour and 5 min... it’s a simple script

(PS4)

X
(Wait 10 seconds)
R2
(Wait 5 seconds)
Up
(Wait 3 seconds)
X
(Wait 5 seconds)
O

Need this repeating constantly every hour and 5 min

Please help!!!!
(I need the script to activate when pressing the L2 button and need the script to run right away then wait 1 hour and 5min and then run again until stopped)

Thanks!
User avatar
saminleo
Master Sergeant
Master Sergeant
 
Posts: 26
Joined: Thu Oct 29, 2015 1:57 pm

Re: help with simple script!

Postby J2Kbr » Thu Feb 14, 2019 12:11 pm

Please try this:
Code: Select all
int toggle;
int msecs, secs, mins, hours, days;
 
main {
    if(event_press(PS4_L2)) {
        toggle = !toggle;
        if(toggle) {
            RunMyCombo();
        } else {
            combo_stop(MyCombo);
        }
    }
    block(PS4_L2, 300);
 
    if(toggle) {
        msecs = msecs + get_rtime();
        if(msecs >= 1000) {
            msecs = msecs - 1000;
            secs = secs + 1;
            if(secs >= 60) {
                secs = secs - 60;
                mins = mins + 1;
                if(mins >= 60) {
                    mins = mins - 60;
                    hours = hours + 1;
                    if(hours >= 24) {
                        hours = hours - 24;
                        days = days + 1;
                    }
                }
            }
        }
        if(hours == 1 && mins == 5) {
            RunMyCombo();
        }
    }
}
 
combo MyCombo {
    set_val(PS4_CROSS, 100);
    wait(100);
    // Wait 10 seconds
    wait(4000);
    wait(4000);
    wait(2000);
 
    set_val(PS4_R2, 100);
    wait(100);
    // Wait 5 seconds
    wait(4000);
    wait(1000);
 
    set_val(PS4_UP, 100);
    wait(100);
    // Wait 3 seconds
    wait(3000);
 
    set_val(PS4_CROSS, 100);
    wait(100);
    // Wait 5 seconds
    wait(4000);
    wait(1000);
 
    set_val(PS4_CIRCLE, 100);
    wait(100);
}
 
function RunMyCombo() {
    msecs = 0;
    secs = 0;
    mins = 0;
    hours = 0;
    days = 0;
    combo_run(MyCombo);
    return;
}
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 91 guests