Jump to content
The simFlight Network Forums

Paja

Members
  • Posts

    30
  • Joined

  • Last visited

Everything posted by Paja

  1. Hello Pete, I am back with this after some time. I have now a joystick card connected to button presses as follows: button 1 = last number of decimal is 5 (fsuipc 0) button 2 = last number of decimal is 0 (fsuipc 1) button 9 = pre-last number of decimal is 3 button 10 = pre-last number of decimal is 2 button 11 = pre-last number of decimal is 5 button 12 = pre-last number of decimal is 4 button 13 = pre-last number of decimal is 1 button 14 = pre-last number of decimal is 0 button 17 = pre-last number of decimal is 6 button 18 = pre-last number of decimal is 7 button 19 = pre-last number of decimal is 8 button 20 = pre-last number of decimal is 9 button 25 = whole is 108 (fsuipc 24) button 26 = whole is 109 (fsuipc 25) button 41 = whole is 110 button 42 = whole is 111 button 43 = whole is 112 button 44 = whole is 113 button 45 = whole is 114 button 46 = whole is 115 button 47 = whole is 116 button 48 = whole is 117 button 35 = DME test button 36 = DME ON/OFF So for example frequency 113.45 is coded with button press: 44 + 12 + 1 Now I am trying to make LUA script to determine the frequency which is currently set and send it to FS. while 1 do joy = 1 wholeeight = ipc.testbuttonflag(joy,24) wholenine = ipc.testbuttonflag(joy,25) wholeten = ipc.testbuttonflag(joy,40) wholeeleven = ipc.testbuttonflag(joy,41) wholetwelve = ipc.testbuttonflag(joy,42) wholethirteen = ipc.testbuttonflag(joy,43) wholefourteen = ipc.testbuttonflag(joy,44) wholefifteen = ipc.testbuttonflag(joy,45) wholesixteen = ipc.testbuttonflag(joy,46) wholeseventeen = ipc.testbuttonflag(joy,47) decimalzero = ipc.testbuttonflag(joy,13) decimalone = ipc.testbuttonflag(joy,12) decimaltwo = ipc.testbuttonflag(joy,9) decimalthree = ipc.testbuttonflag(joy,8) decimalfour = ipc.testbuttonflag(joy,11) decimalfive = ipc.testbuttonflag(joy,10) decimalsix = ipc.testbuttonflag(joy,16) decimalseven = ipc.testbuttonflag(joy,17) decimaleight = ipc.testbuttonflag(joy,18) decimalnine = ipc.testbuttonflag(joy,19) lastzero = ipc.testbuttonflag(joy,1) lastfive = ipc.testbuttonflag(joy,0) frequencywhole = (wholeeight * 800) + (wholenine * 900) + (wholeten * 1000) + (wholeeleven * 1100) + (wholetwelve * 1200) + (wholethirteen * 1300) + (wholefourteen * 1400) + (wholefifteen * 1500) + (wholesixteen * 1600)+ (wholeseventeen * 1700) frequencydecimal = (decimalzero * 0) + (decimalone * 10) + (decimaltwo * 20) + (decimalthree * 30) + (decimalfour * 40) + (decimalfive * 50) + (decimalsix * 60) + (decimalseven * 70) + (decimaleight * 80) + (decimalnine * 90) + (lastzero * 0) + (lastzero * 5) frequency = frequencywhole + frequencydecimal ipc.writeDD(0350,frequency) ipc.sleep(500) end Questions to the code: I know that LUA can handle button numbers 0 - 31. Any ideas what can I do with numbers greater > 31? It would be very useful to handle them as some external applications in windows can without problems... I am not sure if I have chosen correctly the ipc.writeDD to do the task - right? The frequency is in the format suitable for offset 0350, I hope I did at least this correctly :razz: Sorry it the code is unnecessarily complicated, still newbie with LUA. Thank you again for your time! Pavel
  2. Hello, I have one _maybe_ similar problem which I am trying to solve using the LUA script. I have joystick with one axis and I have L:var which I am trying to write. My L:var describes a knob position which has 13 positions. My joystick is sensing real hardware knob. The task is to move the L:var knob between its 13 positions according to real knob movement (which is linear). I was thinking about such code: while 1 do ipc.sleep(100) KnobPosition=ipc.axis(1,X) if math.abs(255 - KnobPosition) > 235 ipc.writeLvar(dc9_ap_turn_knob, 1) end if math.abs(255 - KnobPosition) > 216 logic.and math.abs(255 - KnobPosition) < 235 ipc.writeLvar(dc9_ap_turn_knob, 2) end if math.abs(255 - KnobPosition) > 196 logic.and math.abs(255 - KnobPosition) < 216 ipc.writeLvar(dc9_ap_turn_knob, 3) end --and so far up to 13 I think end Is my approach even possible? I think the axis has positions 1 - 255 which divided to 13 parts gives about 19,6 for each part. So I am trying to make 13 if conditions where all the time just one would be true and the LUA would set the L:var to my desired position. I am pretty sure I am wrong handling the logic.and operator - how can I combine two conditions like I am trying to? Sorry for lame questions, just first attempt ever to use LUA script... Pavel www.dc-9.eu
  3. Great, I will try LUA, thank you Pete! Pavel
  4. Hello Pete, I am working on interfacing old real Gabels radio head to FSX (both COM and NAV radios) and I have following idea. The radio can do a closed loops for each digit of frequency -> when connected to joystick card every single digit can be recognised as a button press. For example when I tune 1 on the third place in my frequency (111,60) I have press of some key. When I tune 2 on the second place of my freq (112,60) I have a different key press. Can I interface it to FSX via FSUIPC somehow? I was thinking about assigning control to each of the "buttons" with Nav 1 Radio Set and parameter like **1,** or **2,** - which would just set the third number of frequency and the rest would be left unmodified. Is something like that possible with FSUIPC? I hope you know what I mean, it is quite hard to explain... Thank you for your help, Pavel Brodsky DC-9 project (www.dc-9.eu)
  5. Hello, I would like to ask how a question. On how many computers can I use your software? If I have purchased licence for FSUIPC and WideFS, is it allowed to use it also on my second PC? Thank you for your reply. Pavel Brodsky Czech Republic
×
×
  • 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.