Jump to content
The simFlight Network Forums

jimthomasjohnston

Members
  • Posts

    46
  • Joined

  • Last visited

Everything posted by jimthomasjohnston

  1. Pete, Yet agan you have done me a great service. It works perfectly. Jim
  2. Pete, How about a totally unrelated Lua question? I live in Newfoundland, Canada, and as such, we have on odd time zone i.e. we are 3.5hrs behind UTC (15:00 NST(Newfoundland Standard Time) --> 18:30 UTC). I do alot of flying from my home airport of St. John's (CYYT). I have always been disappointed that the time zone is never detected correctly. I run my computer time on UTC, and use a program called Timekeeper (v1.9) to keep FS9.1 on the correct time. I am always 30 minutes ahead of the real time i.e. its 15:30 NST and FS gives 16:00. When I go to, for example, CYHZ (Halifax, NS), then the local time is correct. It's like FS detects the wrong time zone i.e. the full hour zone east of Halifax when in Newfoundland. Is there anyway to correct this that you are aware of? Jim
  3. Pete, Me again. I have written what I thought was a simple Lua plug-in to easily tune a chosen radio by simple entering the last 4 digits of the frequency after selecting the appropriate radio from a displayed menu i.e. 1 - Com1, 2 - Com2, etc. I can get the menu to display, and even the second part to work were I am able to "write" the frequency to the radio (i.e. I replace the first line in the code "whichradio=1" or "2"... and it then writes the freq to the correct radio). The only part that does not work is selecting the appropriate radio. I have no idea what is wrong; the code logically makes sense to me. I have been trying various thing for the last day now with no headway. I do not know whom else to ask, so could I bug you one more time so you may give me a nudge in the right direction? whichradio=ipc.ask("Select Radio to Tune:\n\n1 - Com 1\n2 - Com 2\n3 - Nav 1\n4 - Nav 2") if whichradio==1 then Freq = ipc.ask("Enter Com 1 Frequency\n 1**.**") decimalval = tonumber(Freq,16) ipc.writeUW("034E",decimalval) ipc.display("Com 1 Tuned to\n 1"..n, 2) end if whichradio==2 then Freq = ipc.ask("Enter Com 2 Frequency\n 1**.**") decimalval = tonumber(Freq,16) ipc.writeUW("3118",decimalval) ipc.display("Com 2 Tuned to\n 1"..Freq, 2) end ---etc... BTW, don't know were I can get a good book on Lua programming (Lua for Dummies)? This is getting addictive and I hate to be bothering you for your help, as I can appreciate that you are a busy person. Jim
  4. Pete, Thanks yet again. I like to think that I am learning something :) Jim.
  5. Pete, ...a work in progress... I don't suppose there is a way to add to the code you sent me to make the "long press" button run the same command in two different ways? For example, if I wanted to increase my heading, I could either press and hold the button and get a single degree increase, or I could continue to hold the button for just a bit longer and the "repeat" takes over, increasing the heading at a faster rate, kind of like a fine and course adjustment? Jim
  6. Pete, That did the trick. Thanks yet again :D you are worth your weight in gold. Jim
  7. Pete, I am using the following code: joy = 0 btn = 6 interval = 500 -- 1/2 second press, gap, press limits local function timebutton(test) while true do time2 = ipc.elapsedtime() if (time2 - time1) > interval then return false end if ipc.testbutton(joy, btn) == test then time1 = time2 return true end ipc.sleep(20) end end function buttonpress(j, b, du) event.cancel("buttonpress") time1 = ipc.elapsedtime() if timebutton(false) then if timebutton(true) then if timebutton(false) then -- this was a double press ipc.macro("PMDG 1900:Prop Sync") end else -- This was a single press ipc.macro("PMDG 1900:Feather") end else -- This was a longer press repeat ipc.macro("PMDG 1900:Altimeter Inc") ipc.sleep(250) until ipc.testbutton(joy, btn) == 0 end event.button(joy, btn, 1, "buttonpress") end event.button(joy, btn, 1, "buttonpress") however, when I press and hold the button, the macro i.e. "PMDG 1900:Altimeter Inc" repeats, but does not stop when I release the button. The altimeter continues to increase despite releasing the button. It is as if the plug-in does not detect the button release. Jim
  8. Pete, I am successfully using your "Triple Use.Lua" plug in with my CH Throttle Quad to have 36 functions using only the 6 toggle buttons. What I am now wondering is if it is somehow possible to use the "long press" to immitate the R function as described for programming buttons in FSUIPC. That is to say, "Repeat" the key press or control whilst the button is kept held down. For example, I have several buttons programmed to increase/decrease Hdg, Course, IAS, Altimeter, etc using the "Triple Use.Lua" plug-in, assigned to the "long press" portion. It would be great if one could get these to repeat until the button is released, as right now, when the "long press" is detected, the Alt, Hdg, Course, etc only change one unit at a time, meaning, for example, I would have to press and hold the same button 180 times to adjust from a heading of 180 to 360. Jim
  9. Pete, Works like a charm...Thanks again for your continued efforts. Jim
  10. Pete, Thanks. :D I will give it a try this afternoon and let you know how I make out. Given my programming experience :lol: I will just stick with the individual Lua files for each button. Jim.
  11. Pete, I will zip the files and e-mail them to you. I press one button, and then a second button. I even wait a second or two between button presses; It still hangs. Jim
  12. Pete, I successfully got the Lua plug for the axis working using event.offset. To my second request, I was thinking of using as many as 12 buttons in total (CH Throttle Quadrant). If I have to write a Lua plug-in for each, that would be fine. Having said that, I tried last evening to run two of the "triple use" Lua plug-ins using [Auto] in my fsuipc.ini file. I simply modified your code, changing the commands "ipc.control(#####)" with "ipc.macro("macroname"). Individually, each Lua plug-in works no problem. However, when I try both files together, they work for maybe one or two button presses, then FS9.1 freezes up and I have to "End Program" via right click in the task bar. Some info that you may require: I am running FS9.1 on a Vista Home 64bit machine, am using FSUIPC 3.966, and am using the AutoAssignLetters=Yes in the .ini file, however in the Lua "triple use" files, I have use "J=number" instead of "J=letter". I tried switching to letters in the Lua plug-in; however, it no longer functioned at all. Jim
  13. Pete, Thanks for the info. Still no luck figuring out the event.offset, however I am pleased that I got it working anyway, given that I have nil in programming experience. Placing the last "ipc.sleep(10)" call in the outside loop also solved another problem that I as having. I had copied the Lua plugin to do a similar thing with my cut off switches, which I also have assigned to axis, however when I attempted to load it together with the on for the ParkBrake axis, FS9 would freeze up and become unresponsive. After moving the "icp.sleep(10)" to outside the loop, the problem disappeared. On another note, I am really interested in using your plug in that allows the user to assign three commands to a single button. I have somewhat successful incorporated it into my setup, however I am having a problem using it with more then a single button. How can I add more button assignments to the one Lua plug-in? I assume that one does not need to write a separate Lua plug-in for each button, but rather have the one plug-in able to control several buttons. If you could just provide me with the required modifications, when you get the time, that I would have to make to your existing Lua plug-in file, I would certainly be grateful. Jim
  14. Pete, Here is what I ended up with. It works fine, however I would be interested in using the "event.offset", just not sure how to set it up. while 1 do PB=ipc.readSW(0x0BC8) Axis=ipc.readSD(0x66C1) if (Axis>0) and (PB>-1) then ipc.writeSW(0x0BC8,0) end if (Axis<0) and (PB>-1) then ipc.writeSW(0x0BC8,-1) ipc.sleep(10) end end I assigned the axis to offset 66C1. Jim
  15. Pete, Thanks for the reply. I will try that and let you know how I make out. Jim
  16. Pete, I am just wondering if it is possible to read the value of an axis in Lua. I currently have my parking brake assigned to an axis; in one position it's on, in the other it's off. What I would like to do is write a Lua plug-in that reads the position of the axis, and sets the park brake to match the hardware. For example, if the axis value is in the negative range (which means the brake should be on), and the on-screen setting does not match, then write the appropriate value, and vice-versa. I know how to write the value (ipc.control(65752)), just need a little help in reading the axis value. I have identified the axis of interest as Joystick 0, Axis R. Jim
  17. Hi Pete, Thanks for the quick reply, as always. I was able to solve my problem by doing as you suggested. Thanks again. Jim
  18. Pete, I recently deleted my config file for FS9.1 in an attempt to prevent some programs from "auto loading", after playing around with FSUIPCRun Options, hoping that this would stop it from occurring. Unfortunately, the programs continue to load, or attempt to load (like the ones that I have since uninstalled from my PC). To add to the situation, my version of FSUIPC (3.966) continues to function as set up, prior to removing the config file, despite my not being able to locate it anywhere on the PC. That is to say, my axis, button, etc assignments continue to present in the FSUIPC menu as I have programmed them despite there being NO config file anywhere. I can live with the programs trying to load, however I am now unable to manually edit any of the parameters in the config file because I have no idea where it can be. FYI, the OS is Vista 64bit. Jim
  19. Pete, Just found the following line repeated several times in my FSUIPC log file: 52760 *** LUA Error: ...les (x86)\Microsoft Games\Flight Simulator 9\MODULES\Sync 2 Throttle.lua:1: unexpected symbol near 'ï' Still can not get the plug-in to work. What does this error mean? Jim
  20. Should the same code work in FS9? I can not get the twin engine code to work at all. Jim
  21. Pete, I have asked this question to PM support, however I figure that I might gat a quicker response for you... Is there a offset to toggle the DH/DA display on the project meganta's PFD. At the moment, I have the word and value for Radio and Baro both trying to occupy the same space on my PFD. PM Support suggested "This is the DH or DA setting – it is dependent on the switch position on the efis selector. Make sure the selector is in either or position. " So, how do I do this. I am using FSUIPC (3.945), WideFS (6.791), FS9 (9.1) and am using a touch screen on a client computer to control all of my EFIS buttons. Suggestions? Jim
  22. Pete, Thanks for the prompt reply, as always. My thinking on this issue is that I want something that can detect my current switch positions and then relay this information to pmSystems. I already have done this successfully. What I want to happen is, say for example, I inadvertently forget to turn off a fuel pump, or some other switch, at the end of a flight. The next time I start up FS, I want this to get detected and sent to pmSystems. I believe that pmSystems has the ability to do this with phidgits hardware, however I do not think that it can be done through pmSystems with Go-Flight Hardware. Jim
  23. Pete, I remember reading in a post awhile ago that it is possible to write a Lua plug-in that would check the position of switches and send the correct values to the simulator. I am interested in doing just that; however I have no idea how to go about it. My set-up consists of FS9.1, FSUIPC 3.912, WideClient 6.7, the latest builds of pmSystems, GC, MCP, and CDU, and numerous GF modules which control pmSystesm 737 overhead. I am also using GFGisplay 1.24 to control displays on the GF modules. Would it be possible to have a Lua plugin read the switch positions on the GF modules and send the correct information to pmSystems? If so, were do I start? Jim
×
×
  • 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.