Thhat Posted June 11, 2014 Report Posted June 11, 2014 Dear Pete, Just a very short question with the PFC Cirrus programming: Is it possible to launch a Lua script directly from the PFC.MCRO file? Like: //passes the parameter from the PFC Nav Switch to an unused FSX control: 1 = Nav = C66366 //Calls a Lua Script which reads the variable and does some action: 2 = Lua Do_Something Or is necessary to have the Lua script calls in the FSUIPC.INI file only? Thanks for clarifying, Thomas
Pete Dowson Posted June 11, 2014 Report Posted June 11, 2014 Just a very short question with the PFC Cirrus programming: Is it possible to launch a Lua script directly from the PFC.MCRO file? Like: The PFC.MCRO file is just another macro file and abides by the rules for those as described in the FSUIPC Advanced User's guide. I'm afraid the .MCRO file format, and the internal tables these files generate, don't cater for Lua plug-in execution. The problem is that there's really only room for one name, the macro name (which can be an L:Var name, distinguished by the L: part). I suppose it would be conceivable to have another name format for macros -- which would need to be something different from "Lua name" because that entry would occur in the drop-down list for assignments already. However, it would be a complex change which I'm not really willing to undertake at this stage. If you really want to run a plug-in (or use any Lua-related controls, like LuaValue or LuaSet) from a macro file entry the only way I can think of achieving this would be to use the controls to send a unique key press combo and program that in FSUIPC's Keys tab to execute the relevant Lua function. Sorry, I know it isn't very elegant. If i can think of an easier way to implement this I'll do so, but it's not cropped up before. And I'm afraid the code for processing Macro files is now so old I'd be scared stiff of wrecking it if I started messing now. Regards Pete
Thhat Posted June 11, 2014 Author Report Posted June 11, 2014 Dear Pete. Thanks for your fast answer - I understand your point. How about the following approach: 1) In the PFC macro file I read the parameter input from the PFC switch and hand it over to a FSX Command which I do not use for this plane (for example starter of engine 4) 2) In the [auto] section of FSUIPC.ini I call a Lua script (this is possible according to the documentation) and within the script I read the variable mentioned in step 1 and write the necessary action statement into the Lvar which I want to change. For me it seems logical, but before I start programming I would need to know if the event triggered by the switch will be recognized in the Lua script... Of course I also can do it with the "button turnaround" as you described above, but this would not work for a 4-way switch like the tank selector. Thanks again, Thomas
Pete Dowson Posted June 11, 2014 Report Posted June 11, 2014 1) In the PFC macro file I read the parameter input from the PFC switch and hand it over to a FSX Command which I do not use for this plane (for example starter of engine 4) 2) In the [auto] section of FSUIPC.ini I call a Lua script (this is possible according to the documentation) and within the script I read the variable mentioned in step 1 and write the necessary action statement into the Lvar which I want to change. Yes, good idea, actually. Beware of using any control which may have an adverse effect even though it looks like it shouldn't. Better probably to use a custom control number -- i.e. well outside the FS range. Avoid those used by PMDG too. their 737NGX uses a fair few above the normal FSX range. For me it seems logical, but before I start programming I would need to know if the event triggered by the switch will be recognized in the Lua script... Yes, the Lua function event.control can be used to receive the control and its parameter. Pete
Thhat Posted June 12, 2014 Author Report Posted June 12, 2014 Thanks Pete - great support as always!!
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now