Accessible Script Requests for Disabled Users

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

Re: Accessible Script Requests for Disabled Users

Postby AKHUGHES90 » Wed Jan 20, 2016 7:52 pm

Let me know if this works as intended, You had 2 scripts above so i was unsure which you needed.

Code: Select all


int modtoggle=TRUE;

main {
if(get_val(XB1_VIEW) && get_ptime(XB1_VIEW) > 5000) {
modtoggle = !modtoggle;
}

if(!modtoggle) {
    if(event_press(PS3_L1)) {
        if((get_val(TRACE_1)) != 1) {
            set_val(TRACE_1, 1);
        } else if((get_val(TRACE_1)) == 1) {
            set_val(TRACE_1, 0);
        }
    }
    if((get_val(TRACE_1)) == 1) {
        set_val(PS3_L1, 100);
    }
    if(get_val(PS3_R1)) {
        set_val(PS3_L1, 100);
    }
   
    if((get_val(PS3_LY)) < -95) {
        set_val(PS3_R2, 100);
    }
    if((get_val(PS3_LY)) > 95) {
        set_val(PS3_L2, 100);
    }
    if(event_press(PS3_L3)) {
        if((get_val(TRACE_2)) != 1) {
            set_val(TRACE_2, 1);
        } else if((get_val(TRACE_2)) == 1) {
            set_val(TRACE_2, 0);
        }
    }
    if((get_val(TRACE_2)) == 1) {
        set_val(PS3_R2, 100);
    }
}
}

Image
"We always start with completing the difficult. It just takes us a little longer to do the impossible."
Console Tuner Support Team®
User avatar
AKHUGHES90
Major
Major
 
Posts: 927
Joined: Mon Nov 24, 2014 12:19 am
Location: Springfield, IL USA CST (-6:00)

Re: Accessible Script Requests for Disabled Users

Postby cdanv » Thu Jan 21, 2016 3:54 pm

Hi AKHUGHES90.
The two functions are working, I have not been able to do is disable and enable functions during the game by pressing the select button for 5 seconds. I made a change, but I still did not work ... trying ... if I can, notice here, ok ...
User avatar
cdanv
Master Sergeant
Master Sergeant
 
Posts: 29
Joined: Thu Aug 20, 2015 5:05 am

Re: Accessible Script Requests for Disabled Users

Postby AKHUGHES90 » Thu Jan 21, 2016 4:05 pm

cdanv wrote:Hi AKHUGHES90.
The two functions are working, I have not been able to do is disable and enable functions during the game by pressing the select button for 5 seconds. I made a change, but I still did not work ... trying ... if I can, notice here, ok ...

I edited the above code if you want to give it another try.
Image
"We always start with completing the difficult. It just takes us a little longer to do the impossible."
Console Tuner Support Team®
User avatar
AKHUGHES90
Major
Major
 
Posts: 927
Joined: Mon Nov 24, 2014 12:19 am
Location: Springfield, IL USA CST (-6:00)

Re: Accessible Script Requests for Disabled Users

Postby cdanv » Thu Jan 21, 2016 4:18 pm

Yes. I am very grateful
as soon as possible, leave here for me ... thanks
User avatar
cdanv
Master Sergeant
Master Sergeant
 
Posts: 29
Joined: Thu Aug 20, 2015 5:05 am

Re: Accessible Script Requests for Disabled Users

Postby cdanv » Mon Jan 25, 2016 5:47 pm

Hi, AKHUGHES90
J2Kbr made some changes that contributed enough ... now the command is responding perfectly. Is following to share. thank you (AKHUGHES90; J2Kbr)

Code: Select all
    int toggle = TRUE;
    int toggle_ctrl;

    init {
        ledFeedback();
    }

    main {
        if(toggle_ctrl) {
            if(event_release(PS3_SELECT)) toggle_ctrl = FALSE;
        } else if(get_val(PS3_SELECT) && get_ptime(PS3_SELECT) >= 3000) {
            toggle_ctrl = TRUE;
            toggle = !toggle;
            ledFeedback();
        }
        if(toggle) {
            if(event_press(PS3_L1)) {
                if(get_val(TRACE_1) != 1) {
                    set_val(TRACE_1, 1);
                } else if(get_val(TRACE_1) == 1) {
                    set_val(TRACE_1, 0);
                }
            }
            if(get_val(TRACE_1) == 1) {
                set_val(PS3_L1, 100);
            }
            if(get_val(PS3_R1)) {
                set_val(PS3_L1, 100);
            }

            if(get_val(PS3_LY) < -95) {
                set_val(PS3_R2, 100);
            }
            if(get_val(PS3_LY) > 95) {
                set_val(PS3_L2, 100);
            }
            if(event_press(PS3_L3)) {
                if(get_val(TRACE_2) != 1) {
                    set_val(TRACE_2, 1);
                } else if(get_val(TRACE_2) == 1) {
                    set_val(TRACE_2, 0);
                }
            }
            if(get_val(TRACE_2) == 1) {
                set_val(PS3_R2, 100);
            }
        }
    }

    function ledFeedback() {
        if(toggle) set_ledx(LED_4, 0);
        else set_ledx(LED_1, 0);
    }
User avatar
cdanv
Master Sergeant
Master Sergeant
 
Posts: 29
Joined: Thu Aug 20, 2015 5:05 am

Re: Accessible Script Requests for Disabled Users

Postby J2Kbr » Mon Jan 25, 2016 5:51 pm

Awesome!! :) Thanks for the feedback!!
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: Accessible Script Requests for Disabled Users

Postby SpecialEffect » Tue Mar 01, 2016 4:50 pm

Hi all,

I'm looking to boost the power of a person using a single joystick and buttons. The joystick could be something like an analogue Xbox 360 thumb-stick, or a Mayflash Arcade Stick. I'd like for them to be able to flick between three profiles using this process:

HOLD START + LEFT (LEFT-STICK acts as LEFT-STICK)
HOLD START + UP (LEFT-STICK acts as D-PAD)
HOLD START + RIGHT (RIGHT-STICK acts as RIGHT-STICK)
HOLD START + DOWN (MOVE down through the profiles, much as you can do with SELECT+XBOX/PS button).
(TAP START = START AS NORMAL..... HOLD START + something else - swallow START - so it's not passed through.)


I've got this far....

PROFILE 1 (LEFT-STICK) = blank

PROFILE 2 (D-PAD MODE) =

if(get_val(XB360_LY) < -20 ) set_val(XB360_UP,100);
if(get_val(XB360_LY) > 20 ) set_val(XB360_DOWN,100);set_val(XB360_LY,0);
if(get_val(XB360_LX) < -20 ) set_val(XB360_LEFT,100);
if(get_val(XB360_LX) > 20 ) set_val(XB360_RIGHT,100);set_val(XB360_LX,0);

PROFILE 3 (RIGHT-STICK) =

remap XB360_LX -> XB360_RX;
remap XB360_LY -> XB360_RY;
remap XB360_RX -> XB360_LX;
remap XB360_RY -> XB360_LY;


But I'm not sure how to switch profiles in this way. If possible, it would be handy for the arcade stick, if you could also hold START and press R1 or R2 to get "R3" and likewise, L1 or L2 to get "L3".

If anyone could help, I'd be really appreciative. Absolutely love what's possible with the Titan One. Brilliant device.

Barrie
User avatar
SpecialEffect
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 203
Joined: Mon Apr 07, 2014 3:26 pm

Re: Accessible Script Requests for Disabled Users

Postby J2Kbr » Wed Mar 02, 2016 5:14 pm

It is always a pleasure help you!! :joia:

Code: Select all
define NORMAL = 0;
define DPAD = 1;
define RIGHTSTICK = 2;

int profile = NORMAL;

main {
    if(get_val(XB360_START)) {
        if(event_press(XB360_LEFT)) profile = NORMAL;
        else if(event_press(XB360_UP)) profile = DPAD;
        else if(event_press(XB360_RIGHT)) profile = RIGHTSTICK;
        else if(event_press(XB360_DOWN)) {
            profile = profile + 1;
            if(profile > 2) profile = 0;
        }
        set_val(TRACE_1, profile);
    }
    if(profile == NORMAL) {
        // Nothing todo
    } else if(profile == DPAD) {
        if(abs(get_val(XB360_LY)) >= 20 || abs(get_val(XB360_LX)) >= 20) {
            if(get_val(XB360_LY) <= -30) set_val(XB360_UP, 100);
            else if(get_val(PS3_LY) >= 30) set_val(XB360_DOWN, 100);
            if(get_val(XB360_LX) <= -30) set_val(XB360_LEFT, 100);
            else if(get_val(PS3_LX) >= 30) set_val(XB360_RIGHT, 100);
        }
        set_val(XB360_LX, 0);
        set_val(XB360_LY, 0);
    } else if(profile == RIGHTSTICK) {
        swap(XB360_LX, XB360_RX);
        swap(XB360_LY, XB360_RY);
    }
}
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: Accessible Script Requests for Disabled Users

Postby SpecialEffect » Fri Mar 04, 2016 10:28 am

Huge thanks for getting back so quickly, much appreciated.

I'm finding this testing with Forza 2 Horizon on Xbox One....

1. START needs to be passed through when tapped, but swallowed when held (in anticipation of the joystick or a button being tapped to select a new mode/slot). It would be fantastic to be able to smoothly swap the power of the stick, without the Options menu popping up everytime, which is what currently happens.

2. I couldn't quite get your solution to work, but I can see it's cleverly doing it all within one profile. I'd be looking to sacrifice three slots (1= left-stick, 2=d-pad, 3= right stick) so that you get a nice clear indication that you've changed mode from the LED display on the Titan One.

3. All the modes I assume will need to share the script that changes the mode. An example of script 4 might be a single-stick driving mode:

if(get_val(XB360_LY) < -20 ) set_val(XB360_RT,80);
if(get_val(XB360_LY) > 20 ) set_val(XB360_LT,80);set_val(XB360_LY,0);

4. Ideally the stick that can be changed will be the left-stick, not the d-pad. This would work for a joystick and two big buttons (if using a modern day arcade stick, like the Mayflash Arcade Fightstick F300).... it would work for someone using a chin-switch and a sip-puff and noise switch... etc.


If this is a bit tricky to do, maybe just a way to change slot, using held then released START button (swallowed - with a quick tap to make it work as a normal start button).

Huge thanks again for all your help.

Barrie
User avatar
SpecialEffect
Sergeant Major of the Army
Sergeant Major of the Army
 
Posts: 203
Joined: Mon Apr 07, 2014 3:26 pm

Re: Accessible Script Requests for Disabled Users

Postby J2Kbr » Sun Mar 06, 2016 2:25 pm

Hi Barrie,

I implement your first suggestion, please check the script below.
I am not sure if I fully understood the remaining 3 requests. It seems all three are related to the same thing, have the same script in tree different slots, here the behavior depends of the slot number. It that correct?

Code: Select all
define NORMAL = 0;
define DPAD = 1;
define RIGHTSTICK = 2;

int profile = NORMAL;

main {
    // 1. START needs to be passed through when tapped, but swallowed when held
    // (in anticipation of the joystick or a button being tapped to select a new
    // mode/slot). It would be fantastic to be able to smoothly swap the power
    // of the stick, without the Options menu popping up everytime, which is
    // what currently happens.
    if(get_val(XB360_START)) {
        if(event_press(XB360_LEFT)) profile = NORMAL;
        else if(event_press(XB360_UP)) profile = DPAD;
        else if(event_press(XB360_RIGHT)) profile = RIGHTSTICK;
        else if(event_press(XB360_DOWN)) {
            profile = profile + 1;
            if(profile > 2) profile = 0;
        }
        set_val(TRACE_1, profile);
        set_val(XB360_START, 0);
    } else if(event_release(XB360_START) && get_ptime(XB360_START) < 300) {
        combo_run(StartTap);
    }
   
    if(profile == NORMAL) {
        // Nothing todo
    } else if(profile == DPAD) {
        if(abs(get_val(XB360_LY)) >= 20 || abs(get_val(XB360_LX)) >= 20) {
            if(get_val(XB360_LY) <= -30) set_val(XB360_UP, 100);
            else if(get_val(PS3_LY) >= 30) set_val(XB360_DOWN, 100);
            if(get_val(XB360_LX) <= -30) set_val(XB360_LEFT, 100);
            else if(get_val(PS3_LX) >= 30) set_val(XB360_RIGHT, 100);
        }
        set_val(XB360_LX, 0);
        set_val(XB360_LY, 0);
    } else if(profile == RIGHTSTICK) {
        swap(XB360_LX, XB360_RX);
        swap(XB360_LY, XB360_RY);
    }
}

combo StartTap {
    set_val(XB360_START, 100);
    wait(80);
}
ConsoleTuner Support Team
User avatar
J2Kbr
General of the Army
General of the Army
 
Posts: 20323
Joined: Tue Mar 18, 2014 1:39 pm

PreviousNext

Return to GPC1 Script Programming

Who is online

Users browsing this forum: No registered users and 49 guests