Jump to content

Create a lua config funtion for a button???


Recommended Posts

Hello all.

 

Hello all. i have a X52 joystick (not the pro version)

And im trying to setup the buttons for mig21 etc.

 

I am not using the saitek software so, please dont post if youre suggestion involves using that software ;p

 

I see that the the config files are written in lua scipting language.

Now. i like to know if i if its possible to use example button 16 on my joystick..

to switched between (key button 1,2,3,4,5,6,7,8,9) "on the keyboard"

 

basically what i want i that when i press button 16 on joystick it be the same as pressing 1 on keyboard. pressing the button one more time is the same as pressing 2 and so forth. once it reaches 9 it starts at 1 on next press.

 

is is possible to make such a function?

can anyone show me howto if so..


Edited by Lumax
Link to comment
Share on other sites

Ok. so after searching around a bit i found where my config was saved.

C:\Users\Me\Saved Games\DCS\Config\Input\MiG-21Bis\joystick\Saitek X52 Flight Controller {B768C110-8B26-11e2-8001-444553540000}.diff.lua

I dig around in that file and found the button number i want to have as a "toggle switch". i descriped in 1st post.


       ["d3188pnilunilcd42vd0.6vpnilvunil"] = {
           ["added"] = {
               [1] = {
                   ["key"] = "JOY_BTN16",
               },
           },
           ["name"] = "Select Weapon AA 1-2",
       },

so form here im stuck.

 

so i dig a bit more around. and noticed the file

"C:\Games\DCSWorld\Scripts\Input\InputEvents.lua"

i noticed down the file this..

addEvent("JOY_BTN16", JOYSTICK_BUTTON15)

im just starting to learn lua. but to me this seems like a event function that is triggered on control input.

 

can i add this to the bottom of my config file:

(Saitek X52 Flight Controller {B768C110-8B26-11e2-8001-444553540000}.diff.lua )

 

---

function MYFUNCTION ()   
 do stuff   
 return something 
end
addEvent("JOY_BTN16",MYFUNCTION)

and clear out the d3120pnilunilcd14vd0vpnilvunil dict ?


Edited by Lumax
Link to comment
Share on other sites

  • Recently Browsing   0 members

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