Accessibility: Progressive Plunger (Analogue variation on Digital button)
This script (by Elvish) was created for The Pinball Arcade, to give a digital button on an arcade stick, a way to fine control the strength of the plunger. Button X whilst held progressively pulls back on the right-stick (Y-axis) until released, returning to rest and shooting the ball into play. Button Y tapped once, progressively pulls back on the right-stick (Y-axis) until Y is tapped again, shooting the ball into play. This could be adapted for Pool games too. The principle is useful for people using an arcade stick, accessibility switches and other assistive technology that works in an on/off manner. Search the GPC Library for "SpecialEffect" or "Accessibility" for more useful scripts like this one.
|
RATE
|
- Code: Select all
int Increase_Rate = 20; // 5000(5 seconds) / 75 = 66 It takes 1 second for the stick to reach maximum pull strength. Higher = Faster, Lower = Slower
/* Joystick Times
Time / (Maximum Strength - Dead_Zone) = Increase_Rate; Note these answers are aproximate.
1000 / 75 = 13; 1 Second = 13 Increase_Rate
2000 / 75 = 26; 2 Second = 26 Increase_Rate
3000 / 75 = 40; 3 Second = 40 Increase_Rate
4000 / 75 = 53; 4 Second = 53 Increase_Rate
5000 / 75 = 66; 5 Second = 66 Increase_Rate
6000 / 75 = 80; 6 Second = 80 Increase_Rate
7000 / 75 = 93; 7 Second = 93 Increase_Rate
8000 / 75 = 106; 8 Second = 106 Increase_Rate
9000 / 75 = 120; 9 Second = 120 Increase_Rate
10000 / 75 = 133; 10 Second = 133 Increase_Rate
*/
int Dead_Zone = 25;//The size of the dead zone for a controller, I think Xbox is set at 25
int Idle_Time = 0;
int Position = 0;
int Pulling_Stick = FALSE;
main {
//Increment stick while holding X, set to home position when X is released
//Increment stick starting after a Y press, release when Y is pressed again.
Idle_Time = Idle_Time + get_rtime();
if(Idle_Time >= 30000){
Idle_Time = 0;
}
if(event_press(XB1_Y)){
set_val(XB1_Y, 0);
Pulling_Stick = !Pulling_Stick;
if(!Pulling_Stick){
Position = 0;
set_val(XB1_LY, 0);
}
if(Pulling_Stick){
Position = Dead_Zone;
}
}
if(event_release(XB1_X)){
Position = 0;
set_val(XB1_LY, 0);
}
if(event_press(XB1_X)){
Position = Dead_Zone;
}
if(get_val(XB1_X) || Pulling_Stick){
set_val(XB1_X, 0);
set_val(XB1_RB, 100);
set_val(XB1_LB, 100);
set_val(XB1_A, 100);
set_val(XB1_RY, Position);
if(Idle_Time >= Increase_Rate && Position > -100){
Idle_Time = 0;
Position = Position + 1;
if(Position >= 100){
Position = 100;
}
}
}}