Jump to content

Recommended Posts

Posted

My joystick does not have any mode switches, to compensate I want to be able to use the some of the extra buttons as switch modifiers to toggle between navigation, Air to Air, Air to Ground, communication and ground modes.

 

 

 

The problem I have encountered is that when a button has a function mapped to multiple modifiers it can be difficult to discern which function is going to fire because it takes two clicks to disable a modifier and there are no indicators showing which modifiers are enabled.

 

 

 

What I'd like to do is write some code that will only allow me to enable one modifier switch at a time. In short when a modifier switch button is pressed it will check the state of all of the modifier switches and set them to off. It will then enable just the modifier switch of the button that was just pressed.

 

 

 

It would look something like this for when Modefier3 is pressed:

 

 

if(Mdofier1State== true) then Modeifer1State ==False end

 

if(Mdofier2State== true) then Modeifer2State ==False end

 

if(Mdofier3State== false) then Modeifer3State ==True end

 

 

 

Is what I want to do possible and if so does anyone know the code for checking the state of a modifier switch and whether the switch state can be set through custom code? If so is there a better way to go about doing it?

Posted

Now that I have spent some time tinkering around with the DCS control files I can see that what I want is not possible (At least not with my current level of knowledge). As a poor man's alternative I decided to program my Logitech G15 keyboard instead. Here is the code I used:

 

 



local NavMode = false local AtAMode =false
local AtGMode = false
local Msg = ""
function OnEvent(event, arg)
     Msg = "";
     if event=="G_PRESSED" and arg==1 then 
           SetMKeyState(1,"kb");
           NavMode = false; 
           AtAMode = false; 
           AtGMode = false; 
           Msg = "Keyboard Reset." ;
     end


     if (event == "M_PRESSED" ) then 
           if (arg == 1) then 
                 if NavMode == false then 
                        Msg = "Nav Mode enabled" ;
         NavMode = true;
                        if AtAMode == true then PressAndReleaseKey("a"); end
                        if AtGMode == true then PressAndReleaseKey("g"); end
                        AtAMode = false; 
                        AtGMode = false;
                 end;
         end
         if (arg == 2) then 
               if AtAMode == false then 
                      Msg = "ATA Mode enabled" ;
                      AtAMode = true;
                      PressAndReleaseKey("a");
                      if AtGMode == true then PressAndReleaseKey("g"); end
          NavMode = false; 
                      AtGMode = false;
                end;
         end
         if (arg == 3) then 
                if AtGMode == false then 
                        Msg = "ATG Mode enabled" ;
                        AtGMode = true;
                        PressAndReleaseKey("g");
                        if AtAMode == true then PressAndReleaseKey("a"); end
                        NavMode = false; 
                        AtAMode = false;
                end;
   end
     end 




      OutputLCDMessage(Msg, 5000)
end



The downside of this method is that it can get out of sync with the game so I made G1 a reset key back to Nav mode and can use the keyboard commands to reset the modifiers. So far I've not had to do a a reset mid mission.

 

 

 

I could have opted to use programing in my joystick, but I like that I can quickly see my current state at a glance based on the highlighted M key. With the joystick there would not have been any indicators to tell me what mode I was in.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...