Accessible Script Requests for Disabled Users

GPC script programming for Titan One device. Code examples, how to, questions, requests.

Moderators: The_Rabid_Taco, pablosscripts, bonefisher, Baby Cham, Elvish

Accessible Script Requests for Disabled Users

Postby SpecialEffect » Fri Jun 12, 2015 4:54 pm

The Titan One has been a revolution for many people. Thanks so much to Jefferson for creating it. These are two [updated] requests I hope someone can help with...


1. Blink Switch: I'm hoping to find a way to create a filter for a man using a blink switch as his only way to interact with a computer. I thought perfecthuntr's code below would be the solution, but I think there's a bit more to this than I first realised. This is what is needed to the best of my understanding...

    A. You can replicate the blink hardware (a Toby Churchill unit plugged into an adapted Xbox 360 joypad) by holding the "A" button down to simulate shutting your eyes, or releasing "A" to open your eyes.

    B. A filter is needed so that fast presses of the A button (quick blinks) are ignored.

    C. When a deliberate longer press of the A button is detected, this is passed through as a short pressed then released activation. There then needs to be a delay before checking for input again.

    D. An inverted version is needed, whereby the man can select by opening his eyes (releasing "A").




Code: Select all
int timer, stop;

main {
   // Timer - Countdown function
   if (timer > 0) {
      timer = timer - get_rtime();
   }

   // Timer - Detection of the first tap
   if (event_press(PS4_CROSS)) {
      timer = fTapTimer(timer);
      if (timer == 0) { // If a second tap was detected
         stop = TRUE;
      }
   }

   if (stop) { // If the second tap was detected, stop the PS4_CROSS button for 100 ms
      combo_run(test);
   }
}

combo test {
   set_val(PS4_CROSS, 0);
   wait(100);
   stop = FALSE;
}

// Timer function for multi-taps
function fTapTimer(timer) {
   if (timer <= 0) {
      timer = 100;          // Start the timer
   }
   // Timer - Detection of next tap within 100 ms
   else {
      timer = 0;
   }
   return timer;
}



2. Two switch exploration filter: The code below seems to work nicely with huge thanks to UK_Wildcats_Fans. I just need a way to filter out a bounced 2nd press of the L3 button. More on this later on in this thread. This code enables exploration using just two buttons.

Code: Select all
// Script for Special Effect
// see the posts below as reference
// viewtopic.php?f=6&t=1210
// viewtopic.php?f=6&t=1795&p=12979#p12979

define forward_val = 70;
define side_val = 70;
define DeadZoneLeftStick = 20;

int ForwardToggleON = FALSE;
int LeftMovementToggle = FALSE; // FALSE = move right; TRUE = move left;
int timer, stop;


main {
  // Dead Zone Detection
  if ( get_val(PS3_LX) >= -DeadZoneLeftStick && get_val(PS3_LX) <= DeadZoneLeftStick) {set_val(PS3_LX,0);}
  if ( get_val(PS3_LY) >= -DeadZoneLeftStick && get_val(PS3_LY) <= DeadZoneLeftStick) {set_val(PS3_LY,0);}

  // Forward Movement
  if (event_press(PS3_L3)) {ForwardToggleON = !ForwardToggleON;} // Toggles forward movement on/off
  if (ForwardToggleON) {set_val(PS3_LY,-forward_val);set_val(PS4_L3, 0);} // -value is move forward; +value is move backwards     ; Swallow L3 button whilst turning on movement
  if (!ForwardToggleON) {set_val(PS4_L3, 0);} //                                                                                  ; Swallow L3 button whilst turning off movement

  // Side to Side Movement
  if (event_press(PS3_R3)) {LeftMovementToggle = !LeftMovementToggle;} // Toggles between left and right movements
  if (get_val(PS3_R3) && LeftMovementToggle) {set_val(PS3_RX,-side_val);set_val(PS4_R3, 0);} // -value is move left     ; Swallow R3 button whilst looking left.
  if (get_val(PS3_R3) && !LeftMovementToggle) {set_val(PS3_RX,side_val);set_val(PS4_R3, 0);} // +value is move right    ; Swallow R3 button whilst steering right.

}




The Blink Switch is quite pressing. The two-switch exploration would just be very nice for a group of learning disabled users, who'd be able to explore Proteus on the Playstation 3 with this method with minimal technical support needed for supporting staff.
Last edited by SpecialEffect on Sat Jun 13, 2015 4:25 pm, edited 3 times in total.
User avatar
SpecialEffect
Command Sergeant Major
Command Sergeant Major
 
Posts: 146
Joined: Mon Apr 07, 2014 3:26 pm

Re: Accessible Script Requests for Disabled Users

Postby SpecialEffect » Fri Jun 12, 2015 4:56 pm

Here's the blink-sensor we're hoping to use....

Image
User avatar
SpecialEffect
Command Sergeant Major
Command Sergeant Major
 
Posts: 146
Joined: Mon Apr 07, 2014 3:26 pm

Re: Accessible Script Requests for Disabled Users

Postby UK_Wildcats_Fans » Fri Jun 12, 2015 5:38 pm

1. See my post on that thread. We just need to get the sequence correct.

2. Press the LS/L3 button will make the left joystick move forward. Press LS/L3 again will make stop the movement. The LS/L3 accepts values of 0 to 100 - i.e. 0 = no movement, 50 = joystick halfway and 100 = joystick fully forward (or backwards). What value would you want to use for this?

2. I am not fully following on the RS/R3. The RS/R3 button is ON/OFF. We could program it similar to LS/L3 as described about, but it would be limited to one direction.
User avatar
UK_Wildcats_Fans
Colonel
Colonel
 
Posts: 1926
Joined: Thu Jan 08, 2015 6:53 pm
Location: San Diego, California USA

Re: Accessible Script Requests for Disabled Users

Postby SpecialEffect » Fri Jun 12, 2015 6:51 pm

Thanks again!

On point 2, I think 70% movement would be great. I could always tweak it once the logic is in place. A dead zone filter would need to be in place, as the Xbox 360 thumb-sticks are a bit drifty I find. So: tap L3 and you walk forwards until you tap L3 again to stop walking forwards. Filter out a bounced double-press ideally.

On point 3, RS/R3, whilst held, would act as either looking left (r-stick left 70%) or right (r-stick right 70%). Much like this: https://www.youtube.com/watch?v=8QGJRERSOrg&feature=youtu.be&t=18s but a bit slower. No bounce filter needed on this.

Would be amazing to get this working all in firmware.
User avatar
SpecialEffect
Command Sergeant Major
Command Sergeant Major
 
Posts: 146
Joined: Mon Apr 07, 2014 3:26 pm

Re: Accessible Script Requests for Disabled Users

Postby UK_Wildcats_Fans » Fri Jun 12, 2015 7:44 pm

point 2 - RS/L3 is a binary switch (on/off), so it does not have a deadzone. The movement can be a variable that is set in the script.

point 3 - In the video, he is inputting voice commands that define what the button does. What are the inputs that would define whether to go left or right?
User avatar
UK_Wildcats_Fans
Colonel
Colonel
 
Posts: 1926
Joined: Thu Jan 08, 2015 6:53 pm
Location: San Diego, California USA

Re: Accessible Script Requests for Disabled Users

Postby SpecialEffect » Fri Jun 12, 2015 8:03 pm

point 2... That's good news. I've had some really drifty Xbox joypads, so I guess I just meant to add this:

define DeadZoneLeftStick = 20;

within the script.


point 3 - that video might be a bit of a distraction. The system has an auto-scanning system that speaks to you. When the item you want is highlighted/spoken (e.g. "X" standing for X-axis) - your switch takes on that power. In this case when you press the switch it moves left until you let go. When you press it again, it move right until you let go. This loops. That single function is what I'm after replicating, triggered by the RS button.

I thought I could set a variable to 0 to represent LEFT and 1 to represent RIGHT then check for two conditions.

IF RS is activated AND LR-VARIABLE = 0 then activate the right stick -70%.
IF RS is activated AND LR-VARIABLE = 1 then activate the right-stick +70%.

I couldn't work out the logic to make this work though.

Does that make any sense. My problem is I've got a BASIC programming mind-set, and it's a bit of a jump to this type of scripting. I'm trying!
User avatar
SpecialEffect
Command Sergeant Major
Command Sergeant Major
 
Posts: 146
Joined: Mon Apr 07, 2014 3:26 pm

Re: Accessible Script Requests for Disabled Users

Postby UK_Wildcats_Fans » Fri Jun 12, 2015 8:10 pm

Point 2 - Gotcha

Point 3 - Do you want the script act like you described in video - i.e. each time you HOLD RS it moves the opposite direction?
User avatar
UK_Wildcats_Fans
Colonel
Colonel
 
Posts: 1926
Joined: Thu Jan 08, 2015 6:53 pm
Location: San Diego, California USA

Re: Accessible Script Requests for Disabled Users

Postby SpecialEffect » Fri Jun 12, 2015 8:44 pm

Point 3 - Yes. It needs to alternate in function.

HOLD RS and you'll look left. Release and nothing happens. HOLD RS again and your'll look right. Release and nothing happens. And repeat....

Will enable a person who can only use a single button to look around. The other person will be able to walk forwards with a tap of their switch.
User avatar
SpecialEffect
Command Sergeant Major
Command Sergeant Major
 
Posts: 146
Joined: Mon Apr 07, 2014 3:26 pm

Re: Accessible Script Requests for Disabled Users

Postby UK_Wildcats_Fans » Fri Jun 12, 2015 8:48 pm

J2Kbr, perfecthuntr, others - Please see the thread below (SpecialEffects & my posts) for other things that we need to add to it.

http://www.consoletuner.com/forum/viewtopic.php?f=6&t=1210

I have started a script that adds some of what we discussed and merged in the double click code from the previous thread. It has been a very long and stressful week, so I am going brain dead. I also need to finish some deadline items. Below is what I have so far, so please help when you can especially on the "A" stuff. Also, please make sure that I have the X,Y values (i.e. negative vs postive) orientations correct.

Thank you.

Code: Select all
// Script for Special Effect
// see the posts below as reference
// viewtopic.php?f=6&t=1210
// viewtopic.php?f=6&t=1795&p=12979#p12979

define forward_val = 70;
define side_val = 70;
define DeadZoneLeftStick = 20;

int ForwardToggleON = FALSE;
int LeftMovementToggle = FALSE; // FALSE = move right; TRUE = move left;
int timer, stop;


main {
  // Dead Zone Detection
  if ( get_val(PS3_LX) >= -DeadZoneLeftStick && get_val(PS3_LX) <= DeadZoneLeftStick) {set_val(PS3_LX,0);}
  if ( get_val(PS3_LY) >= -DeadZoneLeftStick && get_val(PS3_LY) <= DeadZoneLeftStick) {set_val(PS3_LY,0);}

  // Forward Movement
  if (event_press(PS3_L3)) {ForwardToggleON = !ForwardToggleON;} // Toggles forward movement on/off
  if (ForwardToggleON) {set_val(PS3_LY,-forward_val);} // -value is move forward; +value is move backwards

  // Side to Side Movement
  if (event_press(PS3_R3)) {LeftMovementToggle = !LeftMovementToggle;} // Toggles between left and right movements
  if (get_val(PS3_R3) && LeftMovementToggle) {set_val(PS3_RX,-side_val);} // -value is move left
  if (get_val(PS3_R3) && !LeftMovementToggle) {set_val(PS3_RX,side_val);} // +value is move right
 
   // Timer - Countdown function
   if (timer > 0) {
      timer = timer - get_rtime();
   }

   // Timer - Detection of the first tap
   if (event_press(PS3_CROSS)) {
      timer = fTapTimer(timer);
      if (timer == 0) { // If a second tap was detected
         stop = TRUE;
      }
   }

   if (stop) { // If the second tap was detected, stop the PS4_CROSS button for 100 ms
      combo_run(test);
   }

}

combo test {
   set_val(PS4_CROSS, 0);
   wait(100);
   stop = FALSE;
}

// Timer function for multi-taps
function fTapTimer(timer) {
   if (timer <= 0) {
      timer = 100;          // Start the timer
   }
   // Timer - Detection of next tap within 100 ms
   else {
      timer = 0;
   }
   return timer;
}
User avatar
UK_Wildcats_Fans
Colonel
Colonel
 
Posts: 1926
Joined: Thu Jan 08, 2015 6:53 pm
Location: San Diego, California USA

Re: Accessible Script Requests for Disabled Users

Postby SpecialEffect » Sat Jun 13, 2015 10:02 am

Very close to what I'm after, and already very useful, very nice. Thank you for all your efforts so far.

Some thoughts....

1. Separation: The "Blink Filter (A-button)" script needs to be completely separate from the "Walk/Look (L3/R3)" script, please.

2. Swallow L3/R3 in the Walk/Look script: If a game treats L3 or R3 as look backwards or prone/crouch, it could get confusing for people when they press their button. Would be great to swallow those commands when needed. If this "swallow" function could be commented in your script, I'll be able to remove it if ever it's useful to keep the way it is now.

3. Filter on L3: It would be very helpful if you could filter out bounced presses of L3. Your first press is always acknowledged but if you press again too quickly (accidentally), the second press is ignored.

4. Separate Script for Blink Filter (A-button): - More details here: http://www.consoletuner.com/forum/viewtopic.php?f=6&t=1210. Basically, a filter for bounced presses of the Xbox A button (that part solved and scripted), and a way to invert the function of the A button (so push to break contact in effect, release to make contact - the opposite of the A buttons normal operation.... but still with a filter effect).

Hugely appreciate this forum, and your work so far. :)

Barrie
User avatar
SpecialEffect
Command Sergeant Major
Command Sergeant Major
 
Posts: 146
Joined: Mon Apr 07, 2014 3:26 pm

Next

Return to GPC Script Programming (Titan One)

Who is online

Users browsing this forum: Google [Bot] and 7 guests