Jump to content
The simFlight Network Forums


  • Content Count

  • Joined

  • Last visited

  • Days Won


Everything posted by ark1320

  1. Hi Pete, I can't seem to find how to specify the formatting of string variables for a CSV file using, I assume, the newline \n character. I know how to do it with numerical variables, but am not having any luck with string variables. For example, using something like file:write(string.format("%-3s %-6s %-5s ", str_var1, \n str_var2, \n str_var3 \n )) I want to end up with the value of each string variable on a separate line in the CSV file but can't seem to get the syntax correct. Thanks for any suggestions, Al
  2. At the end of a flight I'd like to use a Lua script to save a small number of offset values (fuel tank quantities) to be read and loaded at the next sim session. As far as I can tell there are no special facilities for this in the FSUIPC lua library, so I assume I will need to learn how to use standard Lua io methods for reading and writing files. If anyone has any recommendations on how best to proceed or where to look for good examples, that would be most appreciated. Thanks, Al
  3. Hello Pete, Does n= ipc.readLvar() assume a particular data format for the value n read (byte, word, floating point, etc), or does it just default to the Lvar's format? I'm asking because if I read an Lvar value and then want to write it to an offset with ipc.writeXX(0x1234, n), I need to decide what XX is (UB, SW, DBL, etc). Best for the holidays, Al
  4. Yes, I understand. I'm familiar with negative number representation. Thanks, Al
  5. Hi Pete, It seems in P3Dv4.3 that sometimes the code ipc.writeSTR(0x3380, " text ") ipc.writeSW(0x32FA, n) writes to the sim's 'Green Bar', and other times to the common Simconnect window. Is there a way to force the output text to the "Green Bar", and to know to which type of display window the output will go? Thx, Al FSUIPC5.141e Win10
  6. ark1320

    ipc.writeSTR() Window

    Ah, it was the single line vs multi-line difference that I didn't understand. Thanks very much for clearing that up. Al
  7. Hi Pete, Many of my Lua scripts make extensive use of the setowndisplay() command and now that this command does not work in P3Dv4 as it previously did, I am trying to find alternatives to the extent possible. As a first step I'm trying to understand how the ipc.setdisplay() command works with the 'common use' P3D4 simconnect message display window. When I run the small test script below with a keystroke, the display window is not in the location or the size that I expect. I understand ipc.setdisplay parameters are percentages relative to a display window, but what window? Do the percentages apply to the previous window even after it has been closed? Do I perhaps need to somehow reset the P3D4 simconnect display window location and size (e.g., to 'full screen size') before setting it to the size I need? Clearly there is something basic I don't understand about initializing and controlling the common simconnect message window location and size. In addition, when I ran the script below I got the 'dual' display (green bar and the little simconnect msg window) shown below as expected. But if I comment out the ipc.writeSTR() and ipc.writeSW() lines, I get no display at all. It is as if the green bar string display is also triggering the simconnect msg window display somehow. Without that trigger there is no simconnect window display. Also note the ipc.getdisplay() returns a sy window size of 50 vs 60 for some reason. If I change the simconnect location parameters from 100, 100 to 50, 50, the little display window moves about an inch to the left and an inch up on the screen. Test script: ipc.setdisplay (100, 100, 40, 60) ipc.display ("TEST") state, x,y, sx, sy = ipc.getdisplay() ipc.writeSTR(0x3380, state..x..y..sx..sy) ipc.writeSW(0x32FA, 10) ipc.sleep (10000) ipc.display ("") return Thanks for your help, Al FSUIPC 5.14 Win10, P3Dv4.3 Edited with new information
  8. ark1320

    P3Dv4 Display Help Needed

    OK, yes, I use the Window mode with P3D4, so that explains why it didn't work. Not really important in the scheme of things right now. I will send you an email now so you can respond on Monday at your convenience. Thanks, Al
  9. ark1320

    P3Dv4 Display Help Needed

    Sure, glad to help. I can just uncomment the ipc.setdisplay() commands in my scripts to test things. Maybe ipc.setdisplay(SET_PERCENTS: x, y, cx, cy) The : after PERCENTS implies the x,y,cx,cy parameters are percentages, at least to me. 😊 BTW, the RestoreSimcWindows=Yes option does not seem to work for me -- another P3Dv4 casualty I guess. Al
  10. ark1320

    P3Dv4 Display Help Needed

    Ah, a great tip -- thanks! Al
  11. ark1320

    P3Dv4 Display Help Needed

    Pete, In regard to my second post above about NO display after reinstalling P3Dv4, the solution to the problem was I needed to check the Message Text box found on the P3Dv4 Information Tab under MISCELLANEOUS TEXT. That little detail has cost me many many hours of grief, so I hope this helps someone! Regarding my first post above, I have found the best temporary solution is to grab and reposition/resize the SimConnect Msg window as I want it and leave it there for all Lua scripts to use. I have temporarily commented out all the ipc.setdisplay() commands from the scripts. This is not an ideal solution, but better than what I had. And if you ever find a way to have more than one window active at a time, that would be great! I really miss having that capability. Thanks very much for your efforts with this difficult display issue. Al
  12. ark1320

    P3Dv4 Display Help Needed

    Pete, Another problem related to the issue of display in P3Dv4 as described above: After reinstalling P3Dv4 and FSUIPC5 (after a Win10 update caused problems), I not getting any Lua script displays at all on the screen (not the green bar or the simconnect message window) even though the Lua scripts are running . For example, I have a script that moves an aircraft after asking the user to input information like new heading, distance to move, etc, using the ipc.ask() function. Even though there is no display as expected as a result of the ipc.ask() functions, the aircraft does move as expected based on the inputs I provide "in the blind". And these scripts have all been used in FSX for a long time. I had the exact same problem the first time I installed P3Dv4 and FSUIPC5 and after a day of struggles the problem went away but I don't know why ( have not been so lucky this time). The issue seems to have to do with somehow initializing the simconnect message window location and size in order to get a display on the screen. Al
  13. Landing_Params is a Lua script for FSX/P3D that displays landing parameters in a small text window that pops up after the aircraft has landed and has slowed to taxi speed. The script should be activated with a key or button (like the gear down key/button) during the approach to landing. Parameters displayed in the window at touchdown are Indicated Airspeed (IAS, Kts), Ground Speed (GS, Kts), Landing Distance (LD, ft), Landing Roll (LR, ft), Vertical Speed (VS, ft/min), Attitude Indicator pitch at touchdown (AI), and Bounce Count (BC). Data collection begins when the a/c passes through a radar altimeter determined threshold altitude window between 45 and 55 ft (i.e., the nominal 50ft threshold height). In addition, more detailed landing parameter information may also be logged. May not display correctly with P3Dv4 due to Lua display limitations. Documentation included. Landing ParamsFiles.zip
  14. Approach CallOuts consists of two Lua scripts and a sound folder with wav files that work together to provide altitude, gear and flap settings, and approach minimums (Decision Height) audio callouts on an approach to landing. The altitude callouts are at Radio Altimeter (RA) heights of 2000, 1000, 500, 400, 300, 200, 100, 50, 40, 30, 20, and 10 ft. At 800ft RA (a user settable value) you get a callout of current flap and gear positions. There is no gear callout if the aircraft has a fixed gear. The minimums callout may be based on a RA or BARO (MSL) altitude. May not display correctly with P3Dv4 due to Lua display limitations. Documentation included. ApproachCallOut2Files.zip
  15. Hi Pete, Does the ipc.display and setowndisplay combination work in P3Dv4? I recall there have been some issues with this in the past. I'm trying to help a friend but unfortunately don't have P3D myself for testing. Scripts I've written using ipc.display that work in FSX on my friend's machine are not displaying anything in P3Dv4. Thanks for an update on this, Al
  16. Hi Pete, Is my understanding below correct? If a key assignment is made using Lua ScriptName under the FSUIPC Key assignments tab, then when that key is pressed the Lua file ScriptName is loaded and run. In contrast to this, if a key assignment is made using LuaToggle ScriptName along with a Parameter field entry (flag number), then when the key is pressed the associated flag value is toggled, but that is all, the script ScriptName is not loaded and run at that point due to the key stroke. So if ScriptName is to detect and process the changed flag value, [e.g., by using event.flag( ) ], ScriptName must of previously been loaded and run such as by listing it under an [Auto] section in the FSUIPC.ini file. Thanks, Al
  17. ark1320

    LuaToggle Clarification

    Pete -- thanks very much for the detailed answer. Al
  18. Hi Pete, Is it correct to say that each Lua plug-in has its own set of 256 flags to be independently manipulated and tested? BTW, there seems to be a minor typo in the event.flag() documentation: "If no flag number (0 – 256 255) is provided, any of the 256 changing will trigger the event. Otherwise only the selected flag will do so." Thx, Al
  19. Hi Pete, In the documentation for event.offset() it says: The function is also executed initially, when the plugin is first run, in order to initialise things. This saves using an explicit call to do the same. Q1. Does this mean, for example, if the purpose of the called function is to terminate the script with an ipc.exit() command when the value in the offset changes, the script will be immediately terminated because the function is executed automatically when the script is first run even though the offset value has not changed? Q2. If execution of the script has been suspended with an ipc.sleep() command, will a change in the offset being monitored by event.offset() be missed or ignored? In other words, does ipc.sleep() also suspend the action of the event.offset() command? Thanks, Al
  20. ark1320

    event.offset() questions

    OK, I see. And if the only condition you were trying to detect was a change in the offset value, rather then a particular offset value, you would need to identify the first call to the function associated with event.offset() and handle that as a special case. Thx, Al
  21. Hi Pete, A strange problem has popped up when using Lua scripts to display multiple lines. This is happening with different scripts that previously had no display problems, and happens with both green bar and ipc.setowndisplay type display windows. Instead of the data just appearing 'smoothly', there is jitter as the multiple lines are displayed (single lines display fine). I am only talking about 10 or so short lines of information. I get the sense there is a tiny delay between the display of each line, but once all the lines are displayed, the window display is stable. With the green bar multi-line display, I can faintly see individual single green lines as the window grows in size vertically as the lines are displayed. I don't know how the multi-line display functions work but wonder if something could be causing the scripts to pause for a tiny fraction of a second between the display of each line, or perhaps something has slowed the overall execution speed of the scripts enough to produce this effect? I apologize for this description of the problem -- just don't know a better way to put it. I did 'suffer' a recent Win10 update, but don't see any other display issues with the computer, and can't be sure if this only started after the update. The Nvidia GPU driver is up to date. Thanks for any ideas on what I might check or look for. Al FSUIPC 4.972 Boxed FSX, Win10/64
  22. Hi Pete, Perhaps a bit of encouraging news is I've discovered that FSX-SE, which is on the same computer as FSX, does not have the display problem described above. So there is some hope regarding the impact of the latest WIN10 update. I now need to see if I can figure out what might be different between FSX and FSX-SE as far as how the Lua displays are being handled by the system. Al
  23. If anyone else has a similar issue, please let me know. I'd like to determine it this Lua display problem is unique to my setup for some reason. Thx, Al
  24. Pete, In each case all the multi-line data is sent for display with one command that contains the new line characters. For example, in one script we have: if on_ground_flag == 1 then v_rotate = v_rotate_calc() -- call function ipc.display(" Vr = "..v_rotate.."\n Reversers Armed\n Annunciator Lights\n AP Set\n Altitude Set\n Spoilers Off\n Flaps Set\n Trim Set\n Yaw Damper Off\n Lights On\n Heading Bug Set\n Course Set\n Altimeter Set\n NAV/GPS Set\n Pitot Heat On") -- Display check list for TO_list_time sec repeat ias = ipc.readUD(0x02BC)/128 -- IAS in Knots ias = math.floor (ias + 0.5) -- round to no decimal places (nearest integer) until ias >= v_rotate - rotate_callout_gs_delta -- rotate callout is initiated rotate_callout_gs_delta knots before the v_rotate speed is reached ref=sound.play("Rotate",0) -- Rotate callout ipc.display("") -- close takeoff checklist window end Another script displays a menu using ipc.ask: aircraft_sel=ipc.ask(tab.."Select (followed by Enter): \n 1 FSX Default or Std Add-on A/C\n 2 A2A Cherokee 180\n 3 FLIGHT1 KA B200\n 4 PMDG B737 NGX\n 5 PMDG B777\n * NpC Off",1) So I need to figure out what has changed because neither of these scripts previously exhibited the behavior I described above, but do now. The scripts themselves have not been changed. I'm beginning to think the problem is related to the Win10 update -- perhaps how it works with SimConnect. Should I try reinstalling SimConnect? Thanks, Al

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.