View Full Version : Brake Pedals (again!)
Aceweepop
13th March 2008, 05:29 PM
Hi Bob
Can you help with a scripting problem.:confused:
I use the following in Open Falcon to delay application of left or right toebrakes untill pedal at least 1/2 down. (too much effect on steering if NWS is on) cms.a49 and cms.a50 are X and Y axis's on Pro Pedals device.
//delay to toe brake application till pedal half down then two times effect to compensate.
if ([js3.a1 < 128]) then
cms.a49 = 0;
else
if ([ js3.a1 >128]) then
cms.a49 = js3.a1;
else
cms.a49 = (js3.a1 * 2);
endif
endif
if ([js3.a2 < 128]) then
cms.a50 = 0;
else
if ([ js3.a2 >128]) then
cms.a50 = js3.a2;
else
cms.a50 = (js3.a2 * 2);
endif
endif
I am also wanting to use the same delay in Red Viper which does not have seperate brake axis's,so I want either pedal to apply brakes.
I tried changing cms.a50 in scripting to cms.a49 and just assigned brakes to cms.a49 but still only one pedal works.
I can rem out either js3.a1 or js3.a2 and that leaves the other working so nothing basically wrong the script.
Can you suggest where I am going wrong.
Cheers aceweepop:cheers:
531_Ghost
13th March 2008, 06:55 PM
// CMS Script File
//
// Game Title: Jane's F/A 18
// Written By: Ken 'Ghost' King
// Date: 3/12/08
//
script
TIMER ( INTERVAL, D2, 1, 3 ) = JS2.B7; // PT HAT 1 Up
TIMER ( INTERVAL, D3, 1, 3 ) = JS2.B5; // PT HAT 1 Down
CMS.B1 = D2; // Antenna-Tilt-Up
CMS.B2 = D3; // Antenna-Tilt-Down
CMS.B3 = [js2.a2 < 70]; // Radar-Cursor-Up
CMS.B4 = [js2.a2 > 180]; // Radar-Cursor-Down
CMS.B5 = [js2.a1 < 70]; // Radar-Cursor-Left
CMS.B6 = [js2.a1 > 180]; // Radar-Cursor-Right
CMS.B7 = [js3.a1 > 50]; // Wheel-Brakes-Left-Pedal <--- Play with this number 'til it feels "right"
CMS.B8 = [js3.a2 > 50]; // Wheel-Brakes-Right-Pedal <--- This one too.
endScript
Works for me.
Aceweepop
13th March 2008, 08:11 PM
Hi Ghost,
Sorry but I cannot see any relevance in your reply.:confused:
I want brakes to be analog ie axis not button!!!!
Thats why I have a problem,I want to combine two physical axees
into one device axis because program does not allow me to script two device axees to same output,
:unsure:
Bob Church
14th March 2008, 01:09 AM
Hi aceweepop,
>> Can you help with a scripting problem. I use the following in Open Falcon to delay application of left or right toebrakes untill pedal at least 1/2 down. (too much effect on steering if NWS is on) cms.a49 and cms.a50 are X and Y axis's on Pro Pedals device....
...I am also wanting to use the same delay in Red Viper which does not have seperate brake axis's,so I want either pedal to apply brakes. I tried changing cms.a50 in scripting to cms.a49 and just assigned brakes to cms.a49 but still only one pedal works. I can rem out either js3.a1 or js3.a2 and that leaves the other working so nothing basically wrong with script.
Can you suggest where I am going wrong. <<
Well, the pedal dropping out is probably just processing order. Things really do only happen one at a time, and the last one that happens is the one that will get the sims attention.
I think there are a couple of other problems, too. One is that is that, at halfway down you're putting out 128 already. If you double that value, you're starting with 256 which is all you can have. You'd just end up with a snap to full brakes when you crossed the 128 threshold actually. You're getting away with it because it can't really happen. The IF/THEN splits the action at 128. The code that doubles it never executes because it's alway less than 128 or greater than 128.
The processing order thing is easy to fix if that's what it is. Both are going to be 0 until you're halfway down, so just pick the one with the highest output. I think the guys use the same sort of thing in IL2. Since you're talking about two different scripts, I won't try to make a combined deal. If you just set things to pick the one that has brake halfway down, correct it to 0 minimum, and stretch it so you get 0..255 over the bottom half of the travel, then take the larger of the two and gives that one to CMS.A50, you can pull the brake out at CMS.A50. Since there is only one axis, the ordering won't come into play. Anyway, I would try:
script
// pick up a49 if it's past 128
//
a49 = 0;
if ([ js3.a1 > 128 ]) then
a49 = ( js3.a1 - 128 ) * 2;
endIf
// Do the same with a50
//
a50 = 0;
if ([ js3.a2 > 128 ]) then
a50 = ( js3.a2 - 128 ) * 2;
endif
// Make sure they're not out of range
//
if([ a49 > 255 ]) then
a49 = 255;
endIf
if([ a50 > 255 ]) then
a50 = 255;
endIf
// Send the larger value to cms.a50. If both pedals
// are released, it will still send a value, but the
// value will be 0 and won't matter anyway.
//
cms.a50 = a50;
if([ a49 > a50 ]) then
cms.a50 = a49;
endIf
endScript
The way you had it, the output was really 128..255. I think you wanted 0..255 and set it up that way. If you really want 128..255 just, just change the "( js3.ax - 128 ) * 2" lines to "js3.ax" like you had them for your second case in your original script. I also switched it to just use internal variables (a49 and a50) during the calculations, saves you some CMS outputs.
So, give it a shot and see if it works out for you. Let me know if you have any trouble!
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Aceweepop
14th March 2008, 07:04 PM
Hi Bob,
Thankyou ,as always you know the answer,:thumbsup:I think you must know this program inside out.
I had allready worked out a very simple solution after getting a clue from Ghost's reply.
//This allows each pedal to apply up to half braking power
cms.a51 = (js3.a2/2) + (js3.a1/2);
But your solution is much better.:cheers:
I have amended in Open Falcon which has seperate braking and it is now much smoother starting at 0 instead of 128.
In Red Viper I used your script as is. It was nice to be able to just copy/paste because you took the trouble to write it using my choices.:)
Once again thankyou
Aceweepop:salute:
Bob Church
15th March 2008, 02:49 AM
Hi aceweepop,
>> Thankyou,... <<
You're quite welcome!
>> as always you know the answer,I think you must know this program inside out. <<
:) Yes. But then I wrote it so do have a little advantage.
In some cases you can actually implement sort of a "pseudo differential braking" even when it doesn't exist. It does take a little more scripting. You need to split the brakes as you had for Falcon, then take the average of the two values and feed it to it's own axis. That becomes the brake and the averaging makes the braking proportional to both pedals.
The second step then is to tap off a percentage of the toe brake outputs and use a script somewhat like what Ghost suggested, combine them so one goes right and the other goes left. Then, when you're braking, you're also feeding it some bit of rudder in the same direction which emulates the "differential" part, push the left brake further than than the right brake and you end up with the average value for brake and some left rudder to make the aircraft turn a bit.
Anyway, I'm glad it worked out for you!
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Aceweepop
15th March 2008, 08:30 PM
Hi aceweepop,
In some cases you can actually implement sort of a "pseudo differential braking" even when it doesn't exist. It does take a little more scripting. You need to split the brakes as you had for Falcon, then take the average of the two values and feed it to it's own axis. That becomes the brake and the averaging makes the braking proportional to both pedals.
The second step then is to tap off a percentage of the toe brake outputs and use a script somewhat like what Ghost suggested, combine them so one goes right and the other goes left. Then, when you're braking, you're also feeding it some bit of rudder in the same direction which emulates the "differential" part, push the left brake further than than the right brake and you end up with the average value for brake and some left rudder to make the aircraft turn a bit.
Like this??
//delay toe brake application till pedal halfway down then return value to 0
//but increase at double rate for rest of travel
//.................................................. ...........................
// pick up a49 if it's past 128 (left pedal)
a49 = 0;
if ([ js3.a1 > 128 ]) then
a49 = ( js3.a1 - 128 ) * 2;
endIf
// Do the same with a50 (right pedal)
a50 = 0;
if ([ js3.a2 > 128 ]) then
a50 = ( js3.a2 - 128 ) * 2;
endif
// Make sure they're not out of range
if([ a49 > 255 ]) then
a49 = 255;
endIf
if([ a50 > 255 ]) then
a50 = 255;
endIf
// average outputs from both pedals
a51 = (a49 + a50)/2;
// feed to brake output
cms.a49 = a51;
// Introduce element of steering to simulate seperate toe brakes
//.................................................. ..........................
// create new internal value equal to rudder axis + or - a fraction of left and right brake pedals
// adjust sensitivity by changing fraction. eg /4 gives 50% of braking effort to steering effect.
a52 = js3.a3 + (a50/4 - a49/4);
// Make sure not out of range up or down
if([ a52 > 255 ]) then
a52 = 255;
endIf
if([ a52 < 0 ]) then
a52 = 0;
endIf
//feed to rudder output
cms.a50 = a52;
It works fantastic but I bet you would do it more eloquently.:rolleyes:
PS I love this program:dance:
Bob Church
16th March 2008, 11:36 AM
Hi Aceweepop
>> It works fantastic but I bet you would do it more eloquently. <<
Great! It looks fine to me. The key was to realize that you had to pass the real rudders through the script so you could add them, I didn't mention that, but you picked it right up. Good work!
>> PS I love this program <<
:)
Have fun with it!
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Powered by vBulletin® Version 4.1.4 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.