Jump to content
The simFlight Network Forums

dazz

Members
  • Posts

    104
  • Joined

  • Last visited

Everything posted by dazz

  1. So, I'm already connecting to the NGX. I figured if this is some event driven implementation, I don't really need to register any C++ functions, but instead be able to call some custom Lua functions once some event is triggered. And I already got to print the state of the AFT LEFT FUEL PUMP in Lua... right after that FSX crashed to desktop, haha. I guess you can't have it all :P So far I'm still using the implementation in the example provided by PMDG in their PMDG_NGX_connectionTest.cpp, but it's looking great already
  2. Ok, thanks. I'll do some reading on the Simconnect SDK to get a general idea of how it works
  3. I'm going to do only the read part. We already have all the tools to send stuff with Lvars and ipc.control. yeah, I was also planning on calling the SimConnect_CallDispatch only when there's a read request instead of that loop. Question is if I implement a function for each and every switch/light/knob, it will need to retrieve the entire "struct PMDG_NGX_Data" every time. Doesn't look like a very efficient solution.
  4. Passing parameters worked too. const char *param = luaL_checklstring(L, 1, NULL); [/CODE] ...now off to learn some Simconnect
  5. Success :) Time to figure out how to pass data thorugh the stack an call functions from Lua EDIT: it's working already. Pushing the result to the top of the stack and then retrieving the result worked just fine require "ngxSDK2Lua" a123 = ngxSDK2Lua.ngxTest() ipc.log("Result ... " .. a123) I'll see if I can pass some parameters to the function
  6. Ok, I added the Lua souces to my project and will be compiling them myself then. I picked Lua 5.1.5 since it's the last 5.1 revision issued.
  7. extern "C" { #include "include\lua.h" #include "include\lauxlib.h" #include "include\lualib.h" } static int my_ngxTest(lua_State *L) { return 1; } extern "C" __declspec(dllexport) int luaopen_ngxSDK2Lua(lua_State *L){ static const luaL_Reg asd [] = { {"ngxTest", my_ngxTest}, {NULL,NULL} }; luaL_register(L,"ngxSDK2Lua", asd); return 1; }[/CODE] The error I get now: [CODE] 1> Creating library E:\Projects\ngxSDK2Lua\Release\ngxSDK2Lua.lib and object E:\Projects\ngxSDK2Lua\Release\ngxSDK2Lua.exp 1>ngxSDK2Lua.obj : error LNK2001: unresolved external symbol _luaL_register 1>E:\Projects\ngxSDK2Lua\Release\ngxSDK2Lua.dll : fatal error LNK1120: 1 unresolved externals [/CODE] do I need to link my code to some dll (lua51.dll maybe?) in Visual Studio?
  8. Thanks so much Pete. So the data communication goes through the Lua stack itself... I can see the relevant part of the code in the luacom library now That should get me going for a while.
  9. #define NGX_VERSION "ngxSDK2Lua 0.1 2012-03-07" #define NGX_AUTHORS "Darío Iriberri" #ifdef __cplusplus extern "C" { #include "include\lua.h" #include "include\lauxlib.h" } #endif extern "C" int my_ngxTest(lua_State *L) { return 102; } static int luaopen_ngxSDK2Lua(lua_State *L){ static const luaL_Reg asd [] = { {"ngxTest", my_ngxTest}, {NULL,NULL} }; luaL_register(L,"ngxSDK2Lua", asd); return 101; } [/CODE] This is what I've got right now. The luaopen_ngxSDK2Lua function is supposed to be called when the require clause is executed in Lua, registering the function (at least that's what someone posted @ stckoverflow), but apparently that's not what's happening. I still get the same error message. I'm looking at Luabind and other wrapper libs, but at this point I think this is all way over my head
  10. Thanks, I missed that part, true :)
  11. Hi Pete. I've got a first test version of the dll ready (ngxSDK2Lua.dll), with just a dummy function "testNGX" that takes a parameter and returns it plus 1 Copied the ngxSDK2Lua.dll to modules/lua (modules/dll didn't seem to work) and called the function from a lua script in the modules folder: require "ngxSDK2Lua" a123 = ngxSDK2Lua.ngxTest(2) ipc.log("Result ... " .. a123) [/CODE] I get this error: [CODE] LUA Error: error loading module 'ngxSDK2Lua' from file 'C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\modules\lua\ngxSDK2Lua.dll': The specified procedure could not be found [/CODE] So I tried with the luacom script posted here (following the instructions there) and I get the same error. [CODE] LUA Error: error loading module 'luacom' from file 'C:\Program Files (x86)\Microsoft Games\Microsoft Flight Simulator X\modules\lua\luacom.dll': The specified module could not be found [/CODE] Any idea what's going on please? EDIT: the error raises in the require statement
  12. Thank you Paul. I'll let you all know when/if I have something to test Doesn't SIOC interface with FSX via FSUIPC? if it can "talk" to a C++/Simconnect host then you don't need another layer in FSUIPC. The idea behind accesing the SDK through Lua is to be able to use all the facilities in FSUIPC already available. For VRInsight panels, or just about any switches where you can now read the actual switch position and have it work as an UP-on/DOWN-off switch instead of a simple toggle switch for example
  13. Thanks again Pete. I found the luacom source code, so I guess I could take that as an example to build a dll for the NGX SDK. Don't know if I'll be able to do it and when, but sure it will be fun trying I think I can answer the second part Ned. For inputs, FSUIPC provides with a function to monitor control inputs you can use to determine which controls are called with which parameters so you can later map buttons/keystrokes to those controls. The news about the SDK is for reading data. Prior to the SDK, only a few Lvars for the MCP were made available to read the MCP displays. Now you can read any switch position, light status... through the PMDG_NGX_Data struct
  14. Ok, those are those the ipc, socket, com, gfd.... libraries, right? would this method avoid the above mentioned offset space restriction? Thanks Pete
  15. I'm curious about this too. Not a C++ or Simconnect developer though, but I found this way to call c++ / c functions from Lua and was wondering if it would work in FSUIPC. I think the functions need to be registered though. I'm Probably talking nonsense here, but if it makes some kind of sense, is it possible to register C/C++ functions dynamically upon FSUIPC startup so that we can then call them from Lua scripts?
  16. Great stuff Pete! Glad to here it's tackled and that it involves a simple fix. Actually I first came across the issue back in may, but never got round to testing it until now. But who cares :D Thanks a lot
  17. Version 4.703 does the same thing as 4.719. I can see mouse macro events within miliseconds in the log triggered just by hovering the mouse over the clickspots: 285607 Mouse by function: RX43ca0*X8bcc,19 (flags=000CF94C), Module="PMDG_737NGX.DLL" 285607 *** EVENT: Cntrl= 70316 (0x000112ac), Param= 4194304 (0x00400000) <unknown> 285607 Mouse by function: RX43ca0*X8bcc,19 (flags=000CF94C), Module="PMDG_737NGX.DLL" 285607 *** EVENT: Cntrl= 70316 (0x000112ac), Param= 4194304 (0x00400000) <unknown> 285654 Mouse by function: RX44090*X8bcc,19 (flags=000CF94C), Module="PMDG_737NGX.DLL" 285654 *** EVENT: Cntrl= 70007 (0x00011177), Param= 4194304 (0x00400000) <unknown> 285654 Mouse by function: RX44090*X8bcc,19 (flags=000CF94C), Module="PMDG_737NGX.DLL" 285654 *** EVENT: Cntrl= 70007 (0x00011177), Param= 4194304 (0x00400000) <unknown> 285654 Mouse by function: RX44090*X8bcc,19 (flags=000CF94C), Module="PMDG_737NGX.DLL" 285654 *** EVENT: Cntrl= 70007 (0x00011177), Param= 4194304 (0x00400000) <unknown> 285654 Mouse by function: RX44090*X8bcc,19 (flags=000CF94C), Module="PMDG_737NGX.DLL" 285654 *** EVENT: Cntrl= 70007 (0x00011177), Param= 4194304 (0x00400000) <unknown> 285654 Mouse by function: RX44090*X8bcc,19 (flags=000CF94C), Module="PMDG_737NGX.DLL" 285669 *** EVENT: Cntrl= 70007 (0x00011177), Param= 4194304 (0x00400000) <unknown> 285669 Mouse by function: RX44090*X8bcc,19 (flags=000CF94C), Module="PMDG_737NGX.DLL" 285669 *** EVENT: Cntrl= 70007 (0x00011177), Param= 4194304 (0x00400000) <unknown> 285669 Mouse by function: RX44090*X8bcc,19 (flags=000CF94C), Module="PMDG_737NGX.DLL" 285669 *** EVENT: Cntrl= 70007 (0x00011177), Param= 4194304 (0x00400000) <unknown> 285669 Mouse by function: RX44090*X8bcc,19 (flags=000CF94C), Module="PMDG_737NGX.DLL" 285669 *** EVENT: Cntrl= 70007 (0x00011177), Param= 4194304 (0x00400000) <unknown> So yeah, that's it (not out of the blue like I said) Pete, take your time, or schedule it depending on what you think is best for you and FSUIPC. We can always use the control events log (what a great little feature this and Lvars) or simple switch back to 4.6 temporarily Actually I'm done configuring my hardware in the NGX already, even without the SDK thanks to FSUIPC, so no hurries on my part
  18. Tried a complete reinstall of 4.703: deleted the Modules directory and started fresh with the installer + activation Please let me help you with this. Is there a way I can download previous versions and try them out?
  19. Ok, it only happens in PMDG A/C (tried the NGX and the MD11 and both have the same problem but the Maddog works fine) Admittedly I just dropped 4.719 in the modules folder, yes, but I just reinstalled with the same results. What is weird is that v4.628 works flawlessly. These NGX mouse macros were created yesterday with that version of FSUIPC4: [Macros] Module="PMDG_737NGX.DLL" 1=AP HDG+=RX437c0*X8bcc,31 2=GEAR DOWN=RX4ab70*X8bcc 3=GEAR UP=RX4ab70*X8bcc,31 4=RST=RX43e30*X8bcc 5=MINS-=RX43e50*X8bcc 6=MINS+=RX43e50*X8bcc,31 7=BARO+=RX43ef0*X8bcc,31 8=MINS BARO=RX43e10*X8b05,31 9=BARO STD=RX43ed0*X8bcc 10=BARO-=RX43ef0*X8bcc 11=MINS RADIO=RX43e10*X8b05,14 12=BARO HPA=RX43eb0*X8bcc,31 13=BARO IN=RX43eb0*X8bcc The problem is that it detects mouse hovers as clicks, yes, and even with the mouse in the middle of nowhere, or once the macro has been ended, the message to name the macro still shows up out of the blue sometimes I'll keep on investigating to make sure it's not a problem in my end
  20. One more thing. Mouse Macro creation is not working for me since I upgraded to version 4.719. I can use existing macros, but can't create new ones. After I select "Create Mouse Macro" in the GUI and go back to the sim to click on the 2D panel, it starts detecting all sort of spurious inputs and I can't save the Macro I tried unplugging everything, even my keyboard with the same results. Also tried deleting the ini file and letting FSUIPC build a default one in case it was something in my config. Going back to v4.6 fixes it anyone else with the same problem please?
  21. Sorry Pete. I failed misserably at interpreting the documentation. Was editing out my message as you were posting. The idea of running a program when fsx is closed could have some useful applications, but nothing that can't be done manually. forget it
  22. Thanks Günter for this. For what it's worth, here's a little mod to add knob acceleration. This example is for the ALT SEL knob: require "socket" KNOB_SENSITIVITY = 50 KNOB_ACCELERATION = 6 -- ALT plus elseif ipcPARAM == 10 then thisALTinc = socket.gettime()*1000 lastALTinc = ipc.get("lastALTinc") ipc.set("lastALTinc", thisALTinc) Var = ipc.readLvar("IrcAltSelKnob") if Var >= 100 then Var = 1 end if (thisALTinc - lastALTinc) > KNOB_SENSITIVITY then ipc.writeLvar("IrcAltSelKnob", Var+1) ipc.control(66587,3921) ipc.control(66587,8031) else ipc.writeLvar("IrcAltSelKnob", Var+3) for n=1, KNOB_ACCELERATION, 1 do ipc.control(66587,3921) end ipc.control(66587,8031) end and the release buttons for the condition levers: -- Right Latch Release ON elseif ipcPARAM == 1001 then ipc.writeLvar("RightLatchRelease", 1); -- Right Latch Release OFF elseif ipcPARAM == 1002 then ipc.writeLvar("RightLatchRelease", 0); -- Left Latch Release ON elseif ipcPARAM == 1003 then ipc.writeLvar("LeftLatchRelease", 1); -- Left Latch Release OFF elseif ipcPARAM == 1004 then ipc.writeLvar("LeftLatchRelease", 0);
×
×
  • 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.