
DaveSCUSA
Members-
Posts
181 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Gallery
Downloads
Everything posted by DaveSCUSA
-
Thanks John, I set the tail hook to true in the apron.cfg and hangar.cfg files. All other .cfg files (runway.cfg, cruise.cfg, etc.) is set to false. I couldn't find a MFSF variable that could tell me whether a flight is prestart cold or started. I use this to tell the difference. So I can use the start checklist to start the aircraft. And since I prefer using switch and button panels instead of a mouse in the cockpit, I use as many techniques as possible to engage the sim with buttons and switches. Also, in one case, the DA62, of an aircraft I like to fly, the internal developed templates start of a flight on the apron has some controls already turned on that the real aircraft would turn off at shutdown (e.g. fuel valve, Pitot Heat, etc.). I turn them off when the aircraft starts on the apron or hangar. Using the complete manufacturer provided (not MSFS provided) checklist. I haven't been able to find how to set an offset using the preset code. I prefer to keep all buttons/switches from a piece of hardware in the same media. Yoke and throttle buttons set thru button assignments to FSUIPC controls or presets (using presets where I would use ipc.execCalcCode() in Lua (e.g events or variables with 2 indices). Or in the keypress case, where an activity is dependent on the action of another keypress. I learned how this could be done with buttons in the Appendix but can't find out how with keypress input. Many of us cockpit builders are choosing these keypads. They can be programmed to output keypress combinations. And they are much cheaper than Flight Sim button hardware. $34 for a keypad vs. $1,000 for a CDU. One pad I have has rotary switches which sends a specific keypress on a click in a direction. I can increase or decrease for example ADF input. And using the pushbutton in the rotary, one can tell the sim to increase or decrease the unit by 1, 10, 100, 1000 depending on the use.
-
Great response, thanks. I have a key on the keypad that tells the other keys to be used to send an ATC Menu number or, if it's off, send an exec command. I have two activities I want to execute with each key, a key that push on and release off as in the starter button: C510_Starter1_On#(>A:TAILWHEEL LOCK ON, Bool) 0 == if { 1 (>K:TOGGLE_STARTER1) } C510_Starter1_Off#(>A:TAILWHEEL LOCK ON, Bool) 0 == if { 0 (>K:TOGGLE_STARTER1) } In another case, I want the key on when pushed and off when pushed again: C510_Ign1_On#(>A:TAILWHEEL LOCK ON, Bool) 0 == if { 1 (>K:TURBINE_IGNITION_SWITCH_SET1) } C510_Ign1_Off#(>A:TAILWHEEL LOCK ON, Bool) 0 == if { 0 (>K:TURBINE_IGNITION_SWITCH_SET1) } In the first case, I use the key press assignment push for on and release for off, if the ATC selection, TAILWHEEL LOCK ON is off. Without using an LVar, I'm not sure I can manipulate the action in the second case. Push on then push off. Is there some other method to accomplish the second activity. I would appreciate it. If I'm using LVars, I may as well use one to activate ATC pushes. Is there a way to send a keyboard keypress with a preset like you can in Lua? There is an entry to bypass windows with a keypress in the FSUIPC7.ini file. May I assume that FSUIPC7 intercept the keypress and sends it directly to MSFS? Is a semi-colon used in events for a comment line or can there be just a blank line between the presets? One comment on assignments thru the UI. It would be more efficient if a searched control could appear at the top of the list instead of the bottom. Often the control is beyond the results of the search unless one keys in the whole control name. Thanks
-
Thanks. Both typos. Just looking for a technique to use a key to turn on if off and off in on using the presets. Not sure how to define a local var with the preset code in the myevents.txt file. I guess I could use lua to define several LVars but was hoping there was a cleaner way. Also, can the RPN code following the preset name (preset#.....) take more than one line, if so how to indicate a continuation if needed? Thanks again.
-
I am currently coding myevents.txt to use with a keypress mini keypad. I plan to use Presets to attach the keypad. I want each key to perform two actions based on a keypress. Could you help with a technique to use these keys as an on/off switch. One keypress turns on a variable to use other keypresses as ATC Menu input then turns it off. If the variable is off, another preset is executed. The presets are listed in the attached file. For most buttons, I want an on/off function. Could you help in how to use the on/off values on one push and off on the next push. Not press and release. I'm not sure how to use a local variable in presets as one would use in a module. I find presets are more accurate and active than some ipc.execCalcCode() executions in Lua. a question. Are input events variable type B:, as in (B:LIGHTING_POTENTIOMETER_30, Enum) Thanks myevents.txt
-
ipc.CalcCode("code") error (Can't figure out why)
DaveSCUSA replied to DaveSCUSA's topic in FSUIPC7 MSFS
Duh, thank you. That's why in progtramming one has walksthru. Or better error descriptions in compilers. -
Dear John, I am receiving Lua errors on several (or all) ipc.CalcCode("code") statements and can't figure out why. I double checked the ipc code, event syntax and compared the coding to similar code in the events.txt file. Please help. Following is the log error and Lua code for a couple of examples: 132562 *** LUA Error: C:\FSUIPC7\MSFSLua\DA62_12Keys.lua:68: attempt to call field 'CalcCode' (a nil value) 68 ipc.CalcCode("1 (>K:SET_STARTER1_HELD)") 128500 *** LUA Error: C:\FSUIPC7\MSFSLua\DA62_12Keys.lua:120: attempt to call field 'CalcCode' (a nil value) 120 ipc.CalcCode("1 (>K:ENGINE_MASTER_1_TOGGLE)") 130234 *** LUA Error: C:\FSUIPC7\MSFSLua\DA62_12Keys.lua:149: attempt to call field 'CalcCode' (a nil value) 149 ipc.CalcCode("1 (>K:ENGINE_MASTER_2_TOGGLE)") Sample events I looked are: PA24_250_Magneto_Both#3 (>K:MAGNETO1_SET) PA24_250_Magneto_Left#2 (>K:MAGNETO1_SET) PA24_250_Magneto_Off#0 (>K:MAGNETO1_SET) PA24_250_Magneto_Right#1 (>K:MAGNETO1_SET) For the life of me I can't figure out why. Thanks DA62_12Keys.log DA62_12Keys.lua FSUIPC7.ini FSUIPC7.log
-
As usual, thanks
-
Hello John, Really appreciate your support. Many othe MSFS venues take days to repond. You always respond quickly even if the issue may not be tied directly to FSUIPC7. I have two questions: 1. There are two methods to defining LVars I have found (there may be others). One is to define LVars in the system.cfg file [LocalVar.n] and their initial value. These LVars are persistent with the aircraft. Another method is to define an LVar in a .flt file in the same category as in the systems.cfg file (different formats) which is not persistent. I defined the LVars used in the DA62 in the system.cfg file instead of in the Lua and seems to work well. I use an LVar in the apron.flt and hangar.flt to let the Lua know the aircraft is not on the runway. The question has to do with the timeing of loading the LVars along with the Lua. I test for nil or 0 using the ipc.readLvar from the Library (not on Apron). I then test for the value set in the apron.flt file. The vaule is never what is contained in the apron.flt file DA62L_Apron = 22 or the runway.flt file DA62L_Apron = 0. So far I have seen the vaues 622 and 135 from the LVar. Are Lua executions initiated befor the LVars are loaded? If the flight is started, an immediate list of the LVars (from the console) contains the LVars defined in the .cfg or .flt files. After a few moments, the console list Lua shows the defined LVars and the correct values. Is there a way to wait until the LVars are loaded with the correct initial values? Test that the load is complete? There are several discussions about LVars using Simconnect and C++ but no where else. I have asked the same question in the MSFS Forum and no answer after 5 days. 2. And do you know if an LVar and its value defined in the system.cfg file can be changed by the LVars entry in the .flt file. Or are they mutually exclusive (can't have the same LVar in both definitions). Thanks as always FSUIPC7.log MSFS_Lua.lua
-
PS , I found the answer to the last question. In the system.cfg file, one can assign/create LVars. In the apron.flt file and/or runway.flt file, one can assign values to an LVar. I can create the LVars there and not use the Lua to create the LVars. But, would like to know why the error.
-
I keep obtaining an error attempting to create an LVar. The error (in the FSUIPC7.log) is: 429750 [ERROR]: Error: CDA with id=18 not found 429750 [ERROR]: Error: CDA with id=0 not found 429750 [ERROR]: Error: CDA with id=0 not found 429750 [ERROR]: Error: CDA with id=0 not found 429750 [ERROR]: Error: CDA with id=0 not found 429750 [ERROR]: Error: CDA with id=0 not found 429750 [ERROR]: Error: CDA with id=25 not found A Google search returns: "There are no results for "[ERROR]: Error: CDA with id=0 not found"". A search on just "Error: CDA" returns no results except Canadian Dental Association. In Lua, MSFS_Lua.lua is a function that creates a set of LVars for use to communicate with Air Manager (it has an variable subscriber that is executed upon change of a variable, including LVars). MSFS_Lua.lua also sets up several items used by the Add-on DA62 Mod. I executed two flights in MSFS and included the FSUIPC7.log. The first flight is with a DA20 at the end of the runway (non-DA62). The second flight is the DA62 at the apron. This when the Error: CDA appears. Previously, I started a DA62 flight with the ipc.createlvars commented out. At first I was creating the LVars with ipc.createLvar("L:DA62_DI_Mode",false) but changed it to ipc.createLvar("L:DA62_DI_Mode", 0). Still the error. Can you help? Thanks Another question please. Do you know of an MSFS variable for the location of an aircraft when starting a flight - Apron or Runway? Currently, I am setting the tail hook variable in the apron.cfg to on to differntiate. MSFS_Lua.lua MSFS_Lua.log FSUIPC7.log FSUIPC7.ini
-
Thank you. Sometimes very confusing and not obvious. Still becoming used to Lua.
-
I keep getting this error: ********* LUA: "MSFS_Lua" Log [from FSUIPC version 7.4.1] ********* 157562 System time = 22/02/2024 18:32:10, Simulator time = 18:32:08 (23:32Z) 157562 LUA: beginning "C:\FSUIPC7\MSFS_Lua.lua" 157562 *** LUA Error: C:\FSUIPC7\MSFS_Lua.lua:15: '=' expected near 'else' 157593 >>> Thread forced exit (ipc.exit or os.exit) <<< 157593 System time = 22/02/2024 18:32:10, Simulator time = 18:32:08 (23:32Z) ********* LUA execution terminated: Log Closed ********* For the life of me, I cannot seem to find the correction. I've looked at the error online (it stated the if statement was in error ????). I've used aircraft == typeac1, aircraft ~= typeac1 or aircraft == "DA62". Please help, you are the only one that I know to ask. I'm using this module to communicate different aircraft controls and instruments to use keypads, Alpha and Bravo devices. Addon aircraft are not consistent with the use of controls, events and input events. MSFS_Lua.lua
-
No sure any more, Perhaps a spelling correction or missing word. Sorry
-
follow
-
I use two instances of MSFS with the same user id on two different computers. On is a test machine for MSFS development, periferals and Lua coding. The other is the main flying server. I share files with a local ethernet network obtaining modified files from the client and moving them to the MSFS server. Is there any way of preventing MSFS from sharing files over the cloud between the two instances?
-
Thanks. Can global variables or LVars in Lua be shared between Air Manager logic (in Lua) and FSUIPC7 Lua. FSUIPC7 compiles on the fly. Air Manager compiles when a panel is shown (executed). Does not need the sim to be running. I can figure how to code to tell when both are running.
-
Thank you John, As I said, I am using Air Manager to detect switch positions delivered to MSFS from a keypad. The AM code is from a series of AM instruments for the Diamond DA62. They are available to purchase (AU$28). For consistency, I want to use the same MSFS variables, events in the Lua used to read the keypad with keypress combinations. There is a potentiometer control but I can't figure out how to tell the control which potentiometer (glareshield and instrument). Could you point out how? The MSFS indexes show which electrical connection. Thanks
-
I have been playing with Air Manager to place monitoring of switches to a tablet, such things as starter, fuel valve, master engine, etch. These switches are being set through either Honeycomb Alpha or Bravo and an HID device. The HID device has 2 rotary switches sending forward and backward pulses. I used the Key Assignment UI to check viability. The keys section in the FSUIPC7.ini shows: 7=49,13,66058,0 -{lalt+lshift+1: Press=PANEL_LIGHTS_SET }- 8=34,13,66058,0 -{lalt+lshift+PgDn: Press=PANEL_LIGHTS_SET }- 9=37,13,66974,0 -{lalt+lshift+Left: Press=GLARESHIELD_LIGHTS_SET }- 10=39,13,66974,0 -{lalt+lshift+Right: Press=GLARESHIELD_LIGHTS_SET }- As you well know, MSFS uses indexing which can be handled in FSUIPC7 by using the ipc.execCalcCode("A:LIGHT_POTENTIOMETER:3, Percent"). Air Manager can manipulate switches on a touch screen. It also shows the status of a switch using variable subscriptions. The Air Manager Lua code to do this is: fs2020_variable_subscribe("LIGHT POTENTIOMETER:3", "Percent", --instrument/panel "LIGHT POTENTIOMETER:5", "Percent", update) --glare Air Manager uses its event management to also manipulate the MSFS events: First it sets the knob positions based on the subscribe: function update(inst, flood) --show correct knob positions inst_dim_lvl = inst[2] flood_dim_lvl = flood[1] rotate(inst_lt_knob, inst_dim_lvl * 300 - 150) rotate(flood_lt_knob, flood_dim_lvl * 300 - 150) end The update function manipulates the image. If the image on the touch screen is used, the Air Manager defined image updates the events. The panel (inst image) is defined by: --instrument light dimmer inst_lt_knob = img_add("da62 dimmer knob.png", 34, 56, 112, 112) inst_lt = dial_add(nil, 34, 56, 112, 112, function(dir) local new_val = var_cap(inst_dim_lvl + dir * 0.05, 0, 1) fs2020_event("K:PANEL_LIGHTS_SET", 1, 1) fs2020_event("K:LIGHT_POTENTIOMETER_SET", 3, new_val * 100) end) In using my HID device and its knobs, I would like to accomplish the same, left to dim the light, right to brighten the light. I'm almost certain my code will work but have doubts about enlisting a variable in an ipc.execCalcCode("code"). Here is the code I want to use. event.key(49,13,1,"PANEL_LIGHTS_SET-") --{lalt+lshift+1: Press=PANEL_LIGHTS_SET -}- event.key(34,13,1,"PANEL_LIGHTS_SET+") --{lalt+lshift+1: Press=PANEL_LIGHTS_SET +}- function PANEL_LIGHTS_SET-() panelneg = ipc.execCalcCode("A:LIGHT_POTENTIOMETER:3, Percent") panelneg = (panelneg * -1) panelneg = panelneg - 3 ipc.execCalcCode("1 (>K:PANEL_LIGHTS_SET, Bool)") ipc.execCalcCode("panelneg (>K:LIGHT_POTENTIOMETER_SET:3, Percent)") end function PANEL_LIGHTS_SET+() panelneg = ipc.execCalcCode("A:LIGHT_POTENTIOMETER:3, Percent") panelneg = panelneg + 3 ipc.execCalcCode("1 (>K:PANEL_LIGHTS_SET, Bool)") ipc.execCalcCode("panelneg (>K:LIGHT_POTENTIOMETER_SET:3, Percent)") end I use the ipc.execCalcCode due to the indexing. The glareshield light uses ipc.execCalcCode("glareneg (>K:LIGHT_POTENTIOMETER_SET:5, Percent)"). Thanks for your time.
-
Situation - shut down FSUIPC7 while MSFS is running, delete logs, make .lua or .ini changes if necessary, restart flight, restart FSUIPC7. 1. Would the restart run FSUIPC7 as a clean run? Question 2: Is there a way to assign a logging function to a button or keypress to turn on or off? While debugging a button or key press. Turn on logging. Press lua button. Use mouse to exercise same switch in the virtual cockpit. Turn logging off. Compare event, inputevent and lua log. It can be cumbersome to use the UI. Thanks
-
Thank you
-
One more question, 3. Is there a way to compile an Lua plugin outside of MSFS?
-
Two questions please: 1. Can you point me to documentation or let us know what to do if we change an Lua program or change the FSUIPC7.ini to retetst the change? Must we restart MSFS from scratch? The changes don't seem to take effect on Flight Restart or creating a new flight from the Main Menu. Time consuming to start MSFS from scratch. 2. Is there a way to eliminate all Lua traces and still display ipc.log entries? If you need more info, please let me know. Thanks
-
Couldn't find any mention in the guides. Is there a way to assign a sleep or delay to a button press in the FSUIPC7.ini. I have also read the section on compound button press. I want to sleep for 750 ms between two button presses. Thanks