PS4 LED flash instead of rumble

GPC2 script programming for Titan Two. Code examples, questions, requests.

PS4 LED flash instead of rumble

Postby umpmanjoe » Mon Sep 04, 2017 1:30 am

Does anyone have code for flashing the PS4 controller LED when activating a mod? I don't have rumbles in any of my controllers and I would like to have the led flash different colors for each mod I activate.

I just need a combo code. So instead of

combo RUMBLE_ON {
ffb_set(FFB_1, 66.0, 320);
wait(0); wait(320);

It would flash less. code for 6 different colors would be nice, but i'll take one that I can use universally to know that a mod activated or deactivated.
Trying to teach myself how to program these scripts even though I'm old
User avatar
umpmanjoe
First Sergeant
First Sergeant
 
Posts: 45
Joined: Mon May 25, 2015 1:23 am

Re: PS4 LED flash instead of rumble

Postby bonefisher » Mon Sep 04, 2017 2:35 am

Code: Select all
 
bool toggle;
 
main {
    //hit triangle or Y button to test
    if(event_active(BUTTON_14)) {
        toggle = !toggle;
        if(toggle) {
            // Blink LED_1 10 times and then stop
            led_vmset(LED_1, 250, 250, 10);
        }
    }
}
 

Here is example to test!
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

Re: PS4 LED flash instead of rumble

Postby umpmanjoe » Mon Sep 04, 2017 3:53 am

this is perfect. How do you get it to return to the original color after flashing? Basically I would want it to flash 5 times (I figured out how to do that) and then return to the previous color or any any other color
Trying to teach myself how to program these scripts even though I'm old
User avatar
umpmanjoe
First Sergeant
First Sergeant
 
Posts: 45
Joined: Mon May 25, 2015 1:23 am

Re: PS4 LED flash instead of rumble

Postby Scachi » Mon Sep 04, 2017 8:40 am

umpmanjoe wrote:this is perfect. How do you get it to return to the original color after flashing? Basically I would want it to flash 5 times (I figured out how to do that) and then return to the previous color or any any other color

To reset it: use led_reset ;-)
User avatar
Scachi
Brigadier General
Brigadier General
 
Posts: 3044
Joined: Wed May 11, 2016 6:25 am
Location: Germany

Re: PS4 LED flash instead of rumble

Postby umpmanjoe » Mon Sep 04, 2017 9:28 am

Scachi wrote:
umpmanjoe wrote:this is perfect. How do you get it to return to the original color after flashing? Basically I would want it to flash 5 times (I figured out how to do that) and then return to the previous color or any any other color

To reset it: use led_reset ;-)


Thanks. What wound that line of code look like? Do you put it right below the other code? Sorry, but I’m completely new at this.

Would it be this?

led_vmset(LED_1, 250, 250, 55);
led_reset;
Trying to teach myself how to program these scripts even though I'm old
User avatar
umpmanjoe
First Sergeant
First Sergeant
 
Posts: 45
Joined: Mon May 25, 2015 1:23 am

Re: PS4 LED flash instead of rumble

Postby J2Kbr » Mon Sep 04, 2017 4:19 pm

It should be something like this:
Code: Select all
bool toggle;
 
main {
    //hit triangle or Y button to test
    if(event_active(BUTTON_14)) {
        toggle = !toggle;
        if(toggle) {
            // Blink LED_1 10 times and then stop
            led_vmset(LED_1, 250, 250, 10);
        } else {
            led_reset();
        }
    }
}
 
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

Re: PS4 LED flash instead of rumble

Postby bonefisher » Mon Sep 04, 2017 5:21 pm

J2Kbr wrote:It should be something like this:
Code: Select all
bool toggle;
 
main {
    //hit triangle or Y button to test
    if(event_active(BUTTON_14)) {
        toggle = !toggle;
        if(toggle) {
            // Blink LED_1 10 times and then stop
            led_vmset(LED_1, 250, 250, 10);
        } else {
            led_reset();
        }
    }
}
 

Actually just looked at this and it doesn't work at all like it should....
bonefisher
Lieutenant General
Lieutenant General
 
Posts: 5413
Joined: Thu Jan 29, 2015 10:49 am

Re: PS4 LED flash instead of rumble

Postby J2Kbr » Tue Sep 05, 2017 9:30 am

alright, this should work as requested in the first post.
Code: Select all
bool toggle;
 
main {
    if(event_active(BUTTON_14)) {
        toggle = !toggle;
        if(toggle) modEnabled(6);
    }
}
 
 
////////////////////////////////////////////////////////////////////////////////
bool blinking;
 
void modEnabled(uint8 no) {
    led_reset();
    if(no & 0x01) led_vmset(LED_1, 250, 250, 4);
    if(no & 0x02) led_vmset(LED_2, 250, 250, 4);
    if(no & 0x04) led_vmset(LED_3, 250, 250, 4);
    blinking = TRUE;
}
 
main {
    if(blinking && !led_vmget(LED_1) && !led_vmget(LED_2) && !led_vmget(LED_3)) {
        led_reset();
        blinking = FALSE;
    }
}
////////////////////////////////////////////////////////////////////////////////
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 GPC2 Script Programming

Who is online

Users browsing this forum: midg3t2 and 78 guests