Jump to content
The simFlight Network Forums

mattmcgonegle

new Members
  • Posts

    3
  • Joined

  • Last visited

Posts posted by mattmcgonegle

  1. Sorry Pete.

    Can't get lua file to run. Want to control TrackIR(Centering View&Pausing it)using single CH Yoke button(joy 2, btn 1). FSX doesn't respond to the desired 2 TrackIR cmnds)when clicking this button. I've copied/modified a working lua that handles bringing up panels 2,3 or 4. This one works fine. The TrackIR lue(1But_F12-F11) doesn't. I must be sending keypress cmnd(s) wrong?? I've included listing of non-running TrackIR button press lua(for ur debugging?)

    Hope this helps.

    Thx In Advance

    ~ Matt

  2. 1. Included(but modified) "TripleUse.lua" works.

    2. Made new lua for TrackIR-One button click for "CENTER", two for "PAUSE". Also wanted to automatically turn on "PRECISION".

    3. TripleUse(for Panels 2,3,4) works fine, must be error in sending keypresses.

     

    4. Bottom of FSUIPC4.ini looks like:

    [Auto]

    1=Lua 1But_F12-F11

    2=Lua 1But_Panel-2-3-4

    3=Lua SynAxis

     

    5. 1But_F12-F11.lua looks like:

    --  TrackIR Control

    -- 1st, Turn "Precision Control ON"
    ipc.keypress(F10)

    -- Making a single button give two separate uses:
     
     
     -- The multiple use is obtained by a simple method:
       -- A short press and release (like a mouse click)
       -- A double short press and release (like a double click)
     

     
     -- Single short press = F12 (TrackIR Center)
     -- Two short presses  = F11 (TrackIR Pause)

            -- Yoke, Right Side Red Button

    joy = 2
    btn = 1
    interval = 500 -- 1/2 second press, gap, press limits

    -- Function to time the button being pressed or left released
    -- Allow only up to "interval" till decide no change local function timebutton(test)
      while true do
      time2 = ipc.elapsedtime()
      if (time2 - time1) > interval then
       return false
      end
       if ipc.testbutton(joy, btn) == test then
       time1 = time2
       return true
      end
       ipc.sleep(20)
     end
    end

    function buttonpress(j, b, du)
     -- Cancel event so we don't get called again for double press
     event.cancel("buttonpress")
     
     -- Note time button was pressed
     time1 = ipc.elapsedtime()

      -- First press / release counts: see if there's another
      if timebutton(true) then
       -- got another press in time, look for release
       if timebutton(false) then
        -- this was a double press, send "Instrument/Panel #2"
        ipc.keypress(F11)
       end
               else 
       -- This was a single press, send "Instrument/Panel #1"
       ipc.keypress(F12)
      end

     -- Restore cancelled event
     event.button(joy, btn, 1, "buttonpress")
    end

    -- Enable event on button being pressed (only)
    event.button(joy, btn, 1, "buttonpress")

     

    Thx In Advance

    ~ Matt

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.