Jump to content
The simFlight Network Forums

jimthomasjohnston

Members
  • Posts

    46
  • Joined

  • Last visited

About jimthomasjohnston

  • Birthday 06/16/1975

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Male
  • Location
    Newfoundland, CA

jimthomasjohnston's Achievements

Newbie

Newbie (1/14)

0

Reputation

  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, Many thanks yet again. Jim
  4. 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
  5. Pete, Thanks yet again. I like to think that I am learning something :) Jim.
  6. 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
  7. Pete, That did the trick. Thanks yet again :D you are worth your weight in gold. Jim
  8. 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
  9. 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
  10. Pete, Works like a charm...Thanks again for your continued efforts. Jim
  11. 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.
  12. 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
  13. 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
  14. 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
  15. 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
×
×
  • 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.