Jump to content
The simFlight Network Forums

ThomasAH

Members
  • Posts

    70
  • Joined

  • Last visited

Everything posted by ThomasAH

  1. Hi! Just to show you (and possibly other interested people) what I am doing, and to indicate that I'm still interested in ext.hasfocus() :): To get rid of the hourglass, I'm now using ext.postmessage to do the focus check (which I want to do in lua) and mouse movement (which is already possible in lua). I'd like to post this to the user contributions subforum when I can completely implement it in lua, because then the following problems will be solved: - having to enter the window title of the FSX window (which changes when I'm using FSUIPC to monitor offsets) - requiring an external program to run (and to be compiled beforehand) - having to adjust the path for ext.run FSX/Modules/lua/mousemove.lua (called via ipc.runlua('lua\\movemouse') in ipcReady.lua): -- Move mouse to upper window edge of FSX window mouse is not used. -- Workaround for a performance issue when the mouse pointer is -- inside the FSX window. mousemove = ext.run('D:\\FSX\\FSX\\Modules\\mousemove\\mousemove.exe', EXT_HIDE, EXT_FOCUS, EXT_CLOSE) function mousemove_reset() mousemove_timeout = 3 end function mousemove_timer() x, y = mouse.getpos() if x ~= mousemove_old_x or y ~= mousemove_old_y then mousemove_reset() mousemove_old_x = x mousemove_old_y = y elseif mousemove_timeout > 0 then mousemove_timeout = mousemove_timeout - 1 elseif mousemove_timeout == 0 then mousemove_timeout = -1 ext.postmessage(mousemove, 0x1001, 0, 0) end end mousemove_old_x = nil mousemove_old_y = nil event.mouseleft("mousemove_reset") event.mousemiddle("mousemove_reset") event.mouseright("mousemove_reset") event.mousewheel("mousemove_reset") event.mousehoriz("mousemove_reset") event.timer(1000, "mousemove_timer") FSX/Modules/mousemove/mousemove.ahk (compiled to mousemove.exe): #NoEnv #SingleInstance force Suspend := "Suspend/Resume mousemove" Menu, tray, NoStandard Menu, tray, Add, %Suspend%, menuSuspend Menu, tray, Add, Exit, menuExit Menu, tray, Default, %Suspend% Menu, Tray, Click, 1 ; autohotkey script to move mouse to upper window edge of FSX window ; receives postmessage 0x1001 to avoid having to execute more than once ; workaround for FSUIPC not yet providing FSX focus information to Lua scripts: ; mousemove(wParam, lParam, msg, hwnd) { FS := "Microsoft Flight" FS := "Monitor IPC" IfWinActive, %FS% { WinGetPos, , , Width, Height, %FS% MouseMove, Width // 4, 0, 0 } } OnMessage(0x1001, "mousemove", 1) return menuSuspend: Pause return menuExit: ExitApp return
  2. The "basic quadrant" that is connected to the Saitek yoke with a PS/2-like cable is seen by FSX/FSUIPC as additional three axes (U/V/P) and additional 9 buttons of the yoke, not as a separate "joystick" like the USB-connected quadrant (with axes X/Y/Z).
  3. Thank you, and my best wishes for your daughter and your child-in-law-to-be!
  4. Hi! I want to do something in a Lua script only when FSX currently has the focus. Currently I work around this problem by using ext.run to call a small autohotkey script, but this has the drawback (besides not being the most efficient way to do it) that this causes an hourglass to be shown next to the mouse pointer for a very brief moment. FSUIPC4.log already contains lines like these: Lost focus to PID=2056, "VirtuaWin.exe" Focus lost: culprit unknown So FSUIPC already should have this information. Maybe similar to ext.isrunning(), e.g.: bool = ext.hasfocus() And if later you want to implement a method to query focus for any window, this can be extended to: bool = ext.hasfocus(handle) bool = ext.hasfocus("name") Of course having an offset to make this available without Lua would work for me, too, whatever you think is more useful. Can you implement something like this? Regards, Thomas
  5. I have used FSC this way until I switched to AivlaSoft EFB (which has its own network code) and it worked fine.
  6. Aivlasoft EFB does not use WideFS, the data provider runs on the FSX (or P3D) host, and the EFB client connects to the data provider.
  7. Can you post the [JoyNames], [buttons] and [Axes] sections of your FSUIPC4.ini for each of the two situations? Besides this, I would really recommend using AutoAssignLetters=No and manually assign a letter which is meaningful, e.g. F for the Fighter Stick and Y for the yoke.
  8. Installing over the existing installation will work, all files (except the .ini) will be overwritten.
  9. Pete Dowson is away until Wednesday. Maybe you still have a backup of your previous "Microsoft Flight Simulator X\Modules\FSUIPC4.key"? Alternatively you could login at https://secure.simmarket.com/ and lookup your registration details.
  10. I had the same problem and for me it was exactly this: I used "throttle set" instead of the correct "axis throttle set". Thank you! Thomas
  11. Hi! I just modified VRI_SetBaro.lua from "Example LUA plugins.zip" to use the unit setting in the general options of FSX instead of Lua flag 0 and thought it would be nice to share it. Unrelated changes (yes, I know that one should not mix changes, but maybe you want them, too :)) are: - replaced tabs with 2 spaces (otherwise existing indentation would be wrong) - set my VRIdriver/VRIdevice ports when testing Regards, Thomas -- VRInsight example: displays Inches or Millibars, by Pete Dowson, March 2010 -- adjusted to respect unit setting at offset 0C18, by Thomas Arendsen Hein, November 2011 -- Needs these filters: -- WrFilter.1=BAR? -- RdFilter.1=BAR?+ if VRImodel == nil then -- Set known ports if testing with Lua not loaded automatically VRIdriver = "COM6" VRIdevice = "COM5" end speed = 115200 -- is this the same for all VRI devices? handshake = 0 -- No handshake minsize = 8 maxsize = 8 -- VRI seems to use fixed length blocks of 8 bytes dev = com.open(VRIdevice, speed, handshake) if dev == 0 then ipc.log("Could not open VRIdevice port") ipc.exit() end function setbarodisplay(off, val) -- val is BARO setting in 16ths of millibar if ipc.readUW(0xC18) > 0 then -- need whole number of millibars val = (val + 8) / 16 -- Note rounding by addition of 8 else -- need to convert to 100ths of inch val = ((val * 2992) / (1013.2 * 16)) + 0.5 -- note rounding end str = string.format("BAR%04d", val) com.write(dev, str, 8) end function setbarovalue(handle, str) -- need to check only for BARnnnn+/- and send correct millibars x 16 to FS baro = tonumber(string.match(str, "BAR(%d%d%d%d)")) if baro ~= nil then if ipc.readUW(0xC18) > 0 then -- metric, using millibars baro = baro * 16 -- FS units are 16ths else -- using inches baro = ((baro * 1013.2 * 16) / 2992) + 0.5 -- note rounding end ipc.writeUW(0x330, baro) end end function unitchanged(off, val) setbarodisplay(0x330, ipc.readUW(0x330)) end unitchanged(nil, nil) event.offset(0x330, "UW", "setbarodisplay") event.offset(0xC18, "UW", "unitchanged") event.VRIread(dev, "setbarovalue") [/CODE] Same file as attachment for your convenience: VRI_SetBaro.lua.txt
×
×
  • 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.