Jump to content
The simFlight Network Forums

kaha

Members
  • Posts

    150
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by kaha

  1. Thank you. I will inform you whenever I see irregularities. Best, Karl
  2. I saw the thread, there are wired things going on. Are you using this in a permanent lua script or in a button assignment? Maybe it's a timing matter? Life time of variables in Lua?
  3. Ok, I see. I am not familiar with this calc code language. I just thought, by looking at code in some .xml files, that this could work. But it'S strange, why does it work here and not for you? What was your code?
  4. This: value = 34 calc_code = value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:1, Percent) " .. value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:2, Percent) " .. value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:3, Percent) " ipc.execCalcCode(calc_code) results in the following string being executed: "34 (>A:GENERAL ENG THROTTLE LEVER POSITION:1, Percent) 34 (>A:GENERAL ENG THROTTLE LEVER POSITION:2, Percent) 34 (>A:GENERAL ENG THROTTLE LEVER POSITION:3, Percent) " This should be perfectly valid RPN code, isn't it? What do you mean when you say "using registers"
  5. Hello John, Doing calc_code = value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:1, Percent) " .. value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:2, Percent) " .. value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:3, Percent) " ipc.execCalcCode(calc_code) is the same as this, I think. At least it works perfectly: calc_code = value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:1, Percent)" ipc.execCalcCode(calc_code) calc_code = value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:2, Percent)" ipc.execCalcCode(calc_code) calc_code = value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:3, Percent)" ipc.execCalcCode(calc_code) But maybe I'm missing something concerning "ipc.execCalcCode()? This: value = value > 99.0 and 100 or value < 1.0 and 0 or value can be done due to the fact that true and false work differently in lua than in any other language. It makes sure that any value greater than 99.0 becomes 100.0 and any value smaller than 1.0 becomes 0.0 The construct x > y and a or b would in C/C++ read: x > y ? a : b;
  6. Thank you! Karl
  7. John, I've got a question: What's the better choice? To split code in seperate files like this: ------------ file 1 ---------------------------- function throttle1(offset, value) function throttle2(offset, value) event.offset (0x25F0, "SW", "throttle1") event.offset (0x25F2, "SW", "throttle2") ------------ file 2 ---------------------------- function mixture1(offset, value) function mixture2(offset, value) event.offset (0x2550, "SW", "mixture1") event.offset (0x2552, "SW", "mixture2") Or put everything in one file? Thank you, Karl
  8. I have 2 throttle levers and what I'm actually doing is controlling the left 3 and the right 3 seperately, or (by a switch) all 6 using the left throttle. event.offset (0x25F0, "SW", "throttle1") event.offset (0x25F2, "SW", "throttle2") function throttle1(offset, value) if user_aircraft_type:find(special_aircraft_names["BAE146"], 1, true) then ipc.control(67103, value) ipc.control(67110, value) if logic.And(ipc.buttons("C"), 8388608) == 8388608 then ipc.control(67117, value) ipc.control(67124, value) end elseif user_aircraft_type:find(special_aircraft_names["LATECOERE"], 1, true) then value = ((value + 16384) / 32767.0) * 100.0 value = value > 99.0 and 100 or value < 1.0 and 0 or value calc_code = value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:1, Percent) " .. value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:2, Percent) " .. value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:3, Percent) " ipc.execCalcCode(calc_code) if logic.And(ipc.buttons("C"), 8388608) == 8388608 then calc_code = value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:4, Percent) " .. value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:5, Percent) " .. value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:6, Percent) " ipc.execCalcCode(calc_code) end else ipc.control(67103, value) if logic.And(ipc.buttons("C"), 8388608) == 8388608 then ipc.control(67110, value) end end end function throttle2(offset, value) if user_aircraft_type:find(special_aircraft_names["BAE146"], 1, true) then if logic.And(ipc.buttons("C"), 8388608) ~= 8388608 then ipc.control(67117, value) ipc.control(67124, value) end elseif user_aircraft_type:find(special_aircraft_names["LATECOERE"], 1, true) then value = ((value + 16384) / 32767.0) * 100.0 value = value > 99.0 and 100 or value < 1.0 and 0 or value if logic.And(ipc.buttons("C"), 8388608) ~= 8388608 then calc_code = value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:4, Percent) " .. value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:5, Percent) " .. value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:6, Percent) " ipc.execCalcCode(calc_code) end else if logic.And(ipc.buttons("C"), 8388608) ~= 8388608 then ipc.control(67110, value) end end end Karl
  9. Thank you. I control throttles individually in a lua script using execCalcCode. This works from engine 1 to engine 6. calc_code = value .. " (>A:GENERAL ENG THROTTLE LEVER POSITION:1, Percent)" ipc.execCalcCode(calc_code) There are also variables for mixture and pitch: A:GENERAL ENG THROTTLE LEVER POSITION:1 and A:GENERAL ENG PROPELLER LEVER POSITION:1, but they only work for engines 1 to 4. Just wanted to be sure that those variables cannot be accessed somehow. Karl
  10. Is there a possibility to bind a hardware axis to throttle, prop and mixture of engine numbers greater than 4? I only succeeded to bind the throttle axis using Avars (A:GENERAL ENG THROTTLE LEVER POSITION:nr) Maybe this is a sim restriction? Karl
  11. Thank you John. Karl
  12. How can I get a notification that an aircraft is unloaded in an automatically loaded lua script [AUTO]? I use a bidirectional com communication between the Arduinos and my lua scripts. My Arduinos know which aircraft is currently loaded and can react accordingly. I do that using the offset event at 0x3D00. Now, as an example, if I go back to main menu in the sim no aircraft is loaded anymore but the Arduino doesn't know. At the moment the Arduino has to poll the lua script to check if it is still running. It would be nice to have sort of a callback in the lua script that tells me the script is about to end because the aircraft is unloaded. Any chance to get that?
  13. Ok. As you explain it it might as well disappear in the future, maybe it will get substituted by something else. But for now it's my only possibility to store and recall my own camera views. Thank you, Karl
  14. Thank you! Actually I use offsets 0x86A0 to 0x86B4 to set (and store) my own camera views and to restore them at the press of a button. Please don't make them inactive. Karl
  15. Is there a possibility to read the 6DOF values of the current camera? Offsets 0x86A0 to 0x86B4 are write only. By the way: Offset 0x8320 is readable (still red in "FSUIPC Offsets Status.pdf". Karl
  16. John, this works. For the WBsim 172 I had all 4 lights working already. It was the Asobo classic 172 I was struggeling with. I use a switch to switch the light on (to 75%) and off: local light = math.floor(ipcPARAM / 1000) local percent = ipcPARAM - light * 1000 local n if light < 1 or light > 30 then return end local function rtrim(s) n = #s while n > 0 and string.byte(s:sub(n, n)) < 32 or string.byte(s:sub(n, n)) > 127 do n = n - 1 end return s:sub(1, n) end local aircraft_name = ipc.readSTR(0x3D00, 256) aircraft_name = rtrim(aircraft_name) --ipc.log("Aircraft = " .. aircraft_name) if aircraft_name:find("Cessna Skyhawk Asobo", 1, true) and not aircraft_name:find("WB", 1, true) then if light == 5 then -- pedestral lights calc_code = percent .. " s0 (>L:LIGHTING_PEDESTRAL_1) l0 1 (>K:2:PEDESTRAL_LIGHTS_POWER_SETTING_SET) l2 ! 1 l0 (>K:2:PEDESTRAL_LIGHTS_SET)" ipc.execCalcCode(calc_code) end end
  17. Great! Thank you, Karl
  18. Can't get it to work. I'll do it using the other software, but I would prefer to be able to do it with FSUIPC as I love the possibilities lua scripting gives me. Maybe you consider to implement this in the future, that would be great. Karl
  19. Thank you John, I will give this a try. Karl
  20. I want to set the pedestral lights for the Asobo classic C172. I got word from someone (not using FSUIPC but something else) that the event PEDESTRAL_LIGHTS_POWER_SETTING_SET works, but needs two parameters. One parameter is the number 1 and the other is the percentage of the light intensity. Now, with FSUIPC I can only give one parameter: ipc.control(67211, x) where x is the percentage. Regardless what value I use for x, the pedestral lights get always switched off. Same goes for GLARESHIELD_LIGHTS_POWER_SETTING_SET (67212). Is there something I miss? Karl
  21. I also had the stuttering with SU12, but 7.3.19 cured it. Karl
  22. Ok, understood. Thank you, John! Karl
  23. Yes, the script is running. I just extracted the relevant lines to a .txt file. Karl ini_log.zip
  24. John, I now removed the profile specific axis assignments and made none profile specific ones, see attached screenshot. But now the offset event does not fire anymore. There must be something I still don't get. Karl
  25. Thank you! Karl
×
×
  • 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.