PDA

View Full Version : Switching axis between devices - IL-2 as an example



Revvin
10th November 2006, 12:34 AM
I can't take credit for this as it comes straight out of the Control Manager manual. I stumbled across this accidentally and realised that it could be used in a different way than suggested in the help file.

Scenario
I play IL-2 among other multi aircraft sims. I own a Fighterstick and a Flight sim Yoke and like to fly bombers and fighters. Before I used this script I would have to exit the sim and load in a new profile if I wanted to switch to using the yoke for a while. While this was not a big problem this script now allows me to switch the X and Y axis from the Yoke to the Fighterstick by pressing the button I designate in the CMS script. This switch is done instantly and does not require me to load in a new profile or make changes to the games controller options. The switch can be done in flight if I so wish and I can switch back to the Fighterstick at any time.

The Script
Load up your profile into the Control Manager software and click on the CM Editor button http://www.ch-hangar.com/SiteFiles/Images/faq/cmeditorbtn.jpg If you have not added CMS capability to your map then click the add button http://www.ch-hangar.com/SiteFiles/Images/faq/cmaddbtn.jpg and select 'CMS Controls' and click 'Okay'. This will add a CMS Controls tab into the GUI. Once you have the CM Editor open cut and paste the following script inbetween the words script and endscript.



SEQUENCE //***********CONTROLLER SWITCH SCRIPT****************
WAIT( JS4.B1 ); // Wait until the Pro Throttle Button 1 is pressed.
B1 = NOT B1; // Flip the state of the B1 variable
ENDSEQUENCE
IF( B1 ) THEN // If b1 is TRUE then the Yoke is flight controller
CMS.A2 = JS5.A1; // The Yoke controls the X axis,
CMS.A3 = JS5.A2; // The Yoke controls the Y axis,
ELSE // Otherwise the Fighterstick is flight controller
CMS.A2 = JS1.A1; // The Fighterstick controls the X axis,
CMS.A3 = JS1.A2; // The Fighterstick controls the Y axis,
ENDIF


Now we can close that window and go back into the GUI and select the Fighterstick tab in the GUI (this can be any CH joystick, depending on what you own of course). We need to stop the X and Y axis from being tied only to the Fighterstick so to do this click on the picture of the Fighterstick somewhere on the shaft of the stick so the X and Y axis can be accessed in the GUI. Look at the example image below and click on the DX Device drop down box and select 'None' then click on the green 'Y' to select the Y axis and select 'none' from the DX Device drop down box again. Now you need to deselect the X and Y axis from the yoke in the same way.

http://www.ch-hangar.com/SiteFiles/Images/faq/cmsaxissw.jpg[/URL]

Once that is done you will need to click on the 'CMS Controls' tab in the GUI and assign the X and Y axis to the CMS controls so that Control Manager can assign these axis to whichever controller you select. To do this click on the CMS tab and you will find an array of buttons on your screen. In the script example above I've used CMS axis A2 and A3 as I've already used CMS axis A1 in another part of my IL-2 profile. If you move your mouse over the Axes buttons you will see tooltips appear telling you the name of that CMS axis. Click on CMS axis A2 and then in the DirectX Function mode box on the right we're going to select 'CM Device 1' and 'X Axis' as shown in the image below.

http://www.ch-hangar.com/SiteFiles/Images/faq/cmsaxissw1.jpg

Now you need to click on CMS Axis A2 and repeat those steps except this time select 'Y Axis' for 'CM Device 1'.

Now we need a trigger to make this switch happen. In the script example above you'll see I've used 'JS4.B1' at the top of the script. By pressing button 1 on joystick 4 - joystick 4 being my Pro Throttle in my map file and button 1 on the Pro throttle being the ministick when pressed in I can now switch the axis. This 'trigger' for the axis switch can be any button you like so if you wanted to use the button on the top side of your Fighterstick which is button 3, and your Fighterstick was the first device on your map file then in the script change 'JS4.B1' to 'JS1.B3'.

Once you've done that you should be able to go into IL-2 and map your X and Y axis in the games controller config screen (you may have to move your joystick or your yoke depending on which one is currently set to the X and Y axis) and thats it!

The profile in which I've used this script can be downloaded [URL="http://www.ch-hangar.com/forum/showthread.php?t=2250"]here (http://www.ch-hangar.com/SiteFiles/Images/faq/cmsaxissw.jpg).