View Full Version : Disable axis script ?
Hi!
Have a small question.
I have the CH USB Yoke, Throttle Quadrant USB and the Pro pedals USB.
This is what i want to achieve:
-Press button 11 on my CM device 2 to center (128) then totally disable/enable (toggle) the CM device 1 X axis.
-Then use Button 1 on my CM device 1 to temporarely enable the CM device 1 X axis when pressed (released it turns back to state it was before it is pressed)
-and for a finish: The CM device 1 button 9 (shifted action) to Enable only the X axis on CM device 1 ( if pressed when X axis is enabled, it doesnt disable it )
Is this possible ?. and if thats the case ,.. how ?
I am new the CMS scripting,..all help appreciated..:)
Freddy Wilhelmsen
Norway
Bob Church
11-04-2005, 01:51 AM
Hi Fog,
>> I have the CH USB Yoke, Throttle Quadrant USB and the Pro pedals USB.
This is what i want to achieve:
-Press button 11 on my CM device 2 to center (128) then totally disable/enable (toggle) the CM device 1 X axis.
-Then use Button 1 on my CM device 1 to temporarely enable the CM device 1 X axis when pressed (released it turns back to state it was before it is pressed)
-and for a finish: The CM device 1 button 9 (shifted action) to Enable only the X axis on CM device 1 ( if pressed when X axis is enabled, it doesnt disable it )
Is this possible ?. <<
Sure!
>> and if thats the case ,.. how ? <<
Like this (I think):
script
// This just toggles B1 on each click of js2.b11. It might
// work with the TOGGLE statemente, too, but using B1 lets
// it be controlled externally.
//
sequence
wait( js2.b11 );
b1 = NOT b1;
endSequence
// Assume B1 ON is the disabled state. If it's not disabled
// or js1.b1 is down, then it's just going to track js1.a1.
// If neither of those is TRUE, then it provides a constant
// 128.
//
if( NOT b1 OR js1.b1 ) then
cms.a1 = js1.a1;
else
cms.a1 = 128;
endIf
// This is the tricky one (sort of). There is no shifted
// state in the script, you have to combine the buttons
// yourself. I'm not really clear on the action, either, but
// I think you just want to cancel the latching of the value
// at 128. That being the case and assuming that the shift
// button is JS1.B2 (you'll have to fix that up) then it's
// just a matter of waiting for both JS1.B9 and the shift
// button and when they come along together killing the B1
// bit to re-enable.
//
if( js1.b9 AND js1.b2 ) then
b1 = FALSE;
endIf
endScript
That's it for the script. Up in the GUI, you'd need to add the CMS controls to the map (actually, you have to do that to even enter the script). You'd also need to assign X axis on the you to have DX Device and DX Axis set to "None" and then assign CMS.A1 to CM Device 1, X Axis to get it to fill in for the yoke.
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Originally posted by Bob Church@Apr 11 2005, 12:51 AM
Hi Fog,
>> I have the CH USB Yoke, Throttle Quadrant USB and the Pro pedals USB.
This is what i want to achieve:
-Press button 11 on my CM device 2 to center (128) then totally disable/enable (toggle) the CM device 1 X axis.
-Then use Button 1 on my CM device 1 to temporarely enable the CM device 1 X axis when pressed (released it turns back to state it was before it isÂ* pressed)
-and for a finish: The CM device 1 button 9 (shifted action) to Enable only the X axis on CM device 1 ( if pressed when X axis is enabled, it doesntÂ* disable it )
Is this possible ?. <<
Sure!
>>Â* and if thats the case ,.. how ?Â* <<
Like this (I think):
script
// This just toggles B1 on each click of js2.b11. It might
// work with the TOGGLE statemente, too, but using B1 lets
// it be controlled externally.
//
sequence
wait( js2.b11 );
b1 = NOT b1;
endSequence
// Assume B1 ON is the disabled state. If it's not disabled
// or js1.b1 is down, then it's just going to track js1.a1.
// If neither of those is TRUE, then it provides a constant
// 128.
//
if( NOT b1 OR js1.b1 ) then
cms.a1 = js1.a1;
else
cms.a1 = 128;
endIf
// This is the tricky one (sort of). There is no shifted
// state in the script, you have to combine the buttons
// yourself. I'm not really clear on the action, either, but
// I think you just want to cancel the latching of the value
// at 128. That being the case and assuming that the shift
// button is JS1.B2 (you'll have to fix that up) then it's
// just a matter of waiting for both JS1.B9 and the shift
// button and when they come along together killing the B1
// bit to re-enable.
//
if( js1.b9 AND js1.b2 ) then
b1 = FALSE;
endIf
endScript
That's it for the script. Up in the GUI, you'd need to add the CMS controls to the map (actually, you have to do that to even enter the script). You'd also need to assign X axis on the you to have DX Device and DX Axis set to "None" and then assign CMS.A1 to CM Device 1, X Axis to get it to fill in for the yoke.
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
<div align="right">12015
[/quote]
Thx a lot!
It works just as it should!!..
Freddy
Bob Church
11-04-2005, 02:42 AM
Hi Freddy,
:) Great! Have fun with it!
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Great!
Now,. IF I want to add the CM device 1 - Y axis as well on the same conditions ?
(sorry for asking so much )
Freddy
Bob Church
11-04-2005, 03:01 AM
Hi Freddy,
So just have both axes lock at the same time? It would just be a matter of adding lines for JS1.A2 wherever there was one for JS1.A1 and then one for CMS.A2 wherever there was one for CMS.A1. You'd also need to unassign JS1.A2 in the GUI and assign CMS.A2 to handle the axis. If you just want them to work together, though, the existing logic should take care of it. Something like:
sequence
wait( js2.b11 );
b1 = NOT b1;
endSequence
if( NOT b1 OR js1.b1 ) then
cms.a1 = js1.a1;
cms.a2 = js1.a2;
else
cms.a1 = 128;
cms.a2 = 128;
endIf
if( js1.b9 AND js1.b2 ) then
b1 = FALSE;
endIf
If you wanted other buttons to do the switching, you'd just need to duplicate the first script (there should only be one script and one endScript statement around the lot) and then change the B1, axis, and button references in the new section to be what you wanted to use.
Is that what you were looking for?
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Superb!
You saved my day! ( ehh, umm.. night :) )
Thx a lot!
Freddy
Bob Church
11-04-2005, 03:08 AM
Hi Freddy,
You're welcome, sir!
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Hi again BOB..
Her is a challenge ( have tried, but my knowledge here is somewhat limited yet..still learning)
Start with the setup above... and add one Yoke and one Pro Pedal.
JS1 = Yoke1
JS2 = Ch Throttle Quadrant
JS3 = Pedals1
JS4 = Yoke2
JS5 = Pedals2
On the JS2 i want to use B1 and B3 simultaniously to toggle JS1/JS3 with JS4/JS5. Like in real, when using PF/PNF setup. (deactivate set1 and activate set2..)
Now, tha JS2.B11 should deactivate either JS1 x-y axis ore JS4 x-y axis, depending on what set is active
Regardless what set is active, the buttons described before should work the same way (JS1.B1 for temporarely enable the X and Y axis, if the JS1 is active. JS4.B1 of that set is active, etc)
Do you follow me ? :)
I recon this is simple to set up.. hope again you can throw a helping hand
Freddy
Bob Church
13-04-2005, 11:13 PM
Hi Freddy,
>> Her is a challenge ( have tried, but my knowledge here is somewhat limited yet..still learning)
Start with the setup above... and add one Yoke and one Pro Pedal.... <<
Switching the controllers is pretty simple, really. You just need to generate a bit that's Off or On depending on which set of controllers you want active and then use that to select one set or the other and feed it to one set of CMS axes, which are what actually control the sim. If you look at the Sample Scripts section in the Users Guide, it talks about doing just that.
The logic from the earlier post can work pretty much just as it does now. The only difference would be that the switching logic to select one set of controllers would end up putting data into a couple of intermediate variables like A1 and A2 rather than directly into CMS.A1 and CMS.A2. The A1 and A2 values would then be referenced in the original program rather than JS1.A1 and JS1.A2. IOW, if the second yoke was JS3, then the new controller selection logic would need to place either JS1.A1 and JS1.A2 or JS3.A1 and JS3.A2 into A1 and A2. A1 and A2 would then replace the JS1 references in the two statements:
cms.a1 = js1.a1;
cms.a2 = js1.a2;
so that they fed CMS.A1 and CMS.A2 from whichever controller was selected.
Does that help?
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Hi!
Man, that wa not much of a challenge :).. thx alot,. beginning to get the grip of tha programming now :)
Freddy
Originally posted by Bob Church@Apr 13 2005, 10:13 PM
Hi Freddy,
>> Her is a challenge ( have tried, but my knowledge here is somewhat limited yet..still learning)
Start with the setup above... and add one Yoke and one Pro Pedal.... <<
Switching the controllers is pretty simple, really. You just need to generate a bit that's Off or On depending on which set of controllers you want active and then use that to select one set or the other and feed it to one set of CMS axes, which are what actually control the sim. If you look at the Sample Scripts section in the Users Guide, it talks about doing just that.
The logic from the earlier post can work pretty much just as it does now. The only difference would be that the switching logic to select one set of controllers would end up putting data into a couple of intermediate variables like A1 and A2 rather than directly into CMS.A1 and CMS.A2. The A1 and A2 values would then be referenced in the original program rather than JS1.A1 and JS1.A2. IOW, if the second yoke was JS3, then the new controller selection logic would need to place either JS1.A1 and JS1.A2 or JS3.A1 and JS3.A2 into A1 and A2. A1 and A2 would then replaceÂ* the JS1 references in the two statements:
cms.a1 = js1.a1;
cms.a2 = js1.a2;
so thatÂ* they fed CMS.A1 and CMS.A2 from whichever controller was selected.
Does that help?
Best regards,
-Â* Bob
The StickWorks
http://www.stickworks.com
<div align="right">12078
[/quote]
Originally posted by fog@Apr 12 2005, 09:06 AM
Hi again BOB..
Her is a challenge ( have tried, but my knowledge here is somewhat limited yet..still learning)
Start with the setup above... and add one Yoke and one Pro Pedal.
JS1 = Yoke1
JS2 = Ch Throttle Quadrant
JS3 = Pedals1
JS4 = Yoke2
JS5 = Pedals2
On the JS2 i want to use B1 and B3 simultaniously to toggle JS1/JS3 with JS4/JS5. Like in real, when using PF/PNF setup. (deactivate set1 and activate set2..)
Now, tha JS2.B11 should deactivate either JS1 x-y axisÂ* ore JS4 x-y axis, depending on what set is active
Regardless what set is active, the buttons described before should work the same way (JS1.B1 for temporarely enable the X and Y axis, if the JS1 is active. JS4.B1 of that set is active, etc)
Do you follow meÂ* ? :)
I recon this is simple to set up.. hope again you can throw a helping hand
Freddy
<div align="right">12044
[/quote]
Proboably me that am a bit stupid here... can you pls post the new script in total ?
Freddy
Bob Church
18-04-2005, 11:56 PM
Hi Freddy,
>> Proboably me that am a bit stupid here... can you pls post the new script in total ? <<
Sure. Do you care whether or not the buttons are switch? Usually it's just the axes that need, the buttons are just a matter of not clicking the ones on the yoke that's not being used, but they can be locked out. Also, do you want both yokes to be able to do the switchover and which button did you want to use to do it with?
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Originally posted by Bob Church@Apr 18 2005, 10:56 PM
Hi Freddy,
>> Proboably me that am a bit stupid here... can you pls post the new script in total ? <<
Sure. Do you care whether or not the buttons are switch? Usually it's just the axes that need, the buttons are just a matter of not clicking the ones on the yoke that's not being used, but they can be locked out. Also, do you want both yokes to be able to do the switchover and which button did you want to use to do it with?
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
<div align="right">12169
[/quote]
Hi again!..
Here is my wishes: I want to use two buttons on my Throttle Quadrant to switch between the active sets..(yoke + pedals). lets say JS2.b12 and b10 presses together. When switching the set not active will have NO function at all,. meaning this wil disable both axis and buttons.. The above script for disabling the axis will only apply to the set of yoke/pedals thats active,,
rgd
Freddy
Bob Church
19-04-2005, 11:18 AM
Hi Freddy,
>> Here is my wishes: I want to use two buttons on my Throttle Quadrant to switch between the active sets..(yoke + pedals). lets say JS2.b12 and b10 presses together. When switching the set not active will have NO function at all,. meaning this wil disable both axis and buttons.. The above script for disabling the axis will only apply to the set of yoke/pedals thats active. <<
Okay. I think the MAP and CMS files in the attached zip should do the trick. Unzip it into the Maps folder and load it up in the CM GUI You'll just have to try it out, I don't have enough USB ports to actually run the file, but it does compile and download okay. You
should be able to see how the script works by looking at the CMS file. It just uses the B2 bit to select one of the yoke/pedal sets or the other and feed them to a CMS axis or button. The CMS axes and buttons actually end up going to Flight Sim, the yokes and pedals themselves all have null assignments. The Throttle Quad is used directly
though.
The X and Y axes from the switching logic as well as the 3 buttons that were used in the earlier script to control the switching of the axes are all passed into local variables rather than out to axes like they were in the original script. Those local variables feed the earlier logic so that they comes from the selected yoke.
One little problem. There's no way to switch the POV. I left the one on the first yoke tied to the POV on CM Device 1 and set the POV on the second yoke to go to CM Device 2. When you get into Flight Sim, you can assign them both and they should both operate the views. You'll just have to tell whoever is on the disabled yoke to not move the view hat, there's no way to actually shut it off.
Anyway, give it a try and see if it's doing what you want.
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
Originally posted by Bob Church@Apr 19 2005, 10:18 AM
Hi Freddy,
>> Here is my wishes: I want to use two buttons on my Throttle Quadrant to switch between the active sets..(yoke + pedals). lets say JS2.b12 and b10 presses together. When switching the set not active will have NO function at all,. meaning this wil disable both axis and buttons.. The above script for disabling the axis will only apply to the set of yoke/pedals thats active. <<
Okay. I think the MAP and CMS files in the attached zip should do the trick. Unzip it into the Maps folder and load it up in the CM GUI You'll just have to try it out, I don't have enough USB ports to actually run the file, but it does compile and download okay. You
should be able to see how the script works by looking at the CMS file. It just uses the B2 bit to select one of the yoke/pedal sets or the other and feed them to a CMS axis or button. The CMS axes and buttons actually end up going to Flight Sim, the yokes and pedals themselves all have null assignments. The Throttle Quad is used directly
though.
The X and Y axes from the switching logic as well as the 3 buttons that were used in the earlier script to control the switching of the axes are all passed into local variables rather than out to axes like they were in the original script. Those local variables feed the earlier logic so that they comes from the selected yoke.
One little problem. There's no way to switch the POV. I left the one on the first yoke tied to the POV on CM Device 1 and set the POV on the second yoke to go to CM Device 2. When you get into Flight Sim, you can assign them both and they should both operate the views. You'll just have to tell whoever is on the disabled yoke to not move the view hat, there's no way to actually shut it off.
Anyway, give it a try and see if it's doing what you want.
Best regards,
- Bob
The StickWorks
http://www.stickworks.com
<div align="right">12180
[/quote]
Thx bob!
I will try this upcoming weekend, as my friend is coming for a flight weekend :)..
Freddy
vBulletin® v3.7.2, Copyright ©2000-2009, Jelsoft Enterprises Ltd.