Jump to content
The simFlight Network Forums

kaha

Members
  • Posts

    124
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by kaha

  1. kaha

    BVars support?

    Ah, ok, didn't know that.
  2. kaha

    BVars support?

    In 7.4.0 the file "Controls List for MSFS.txt" is missing. Is there a reason?
  3. kaha

    BVars support?

    Thank you for the explanation, John. Karl
  4. Hi, what's the state about BVar support in FSUIPC? Or are there any plans for future versions? Thx, Karl
  5. For buttons I can always add non profile specific entries to the [Buttons] section and all aircraft will utilize it. If I do that for an axis in the [Axes] section only aircraft that have no profile specific section will know about it.
  6. I understand that. but please let me explain. It works differently for axes and buttons. This is part of my .ini file: [Axes] PollInterval=10 RangeRepeatRate=10 0=BS,256,F,66162,66163,66164,66165 -{ TO SIM: COWLFLAP1_SET, COWLFLAP2_SET, COWLFLAP3_SET, COWLFLAP4_SET }- 1=CZ,256,F,x020025F2,0,0,0 -{ FSUIPC: offset word set, offset 25F2 }- [Buttons] PollInterval=25 ButtonRepeat=20,10 18=P72,19,C66080,0 -{GEAR_DOWN}- 19=P72,18,C66079,0 -{GEAR_UP}- I now make profile specific assignments for button and an axis for a specific aircraft. After that I have: [Axes] PollInterval=10 RangeRepeatRate=10 0=BS,256,F,66162,66163,66164,66165 -{ TO SIM: COWLFLAP1_SET, COWLFLAP2_SET, COWLFLAP3_SET, COWLFLAP4_SET }- 1=CZ,256,F,x020025F2,0,0,0 -{ FSUIPC: offset word set, offset 25F2 }- [Buttons] PollInterval=25 ButtonRepeat=20,10 18=P72,19,C66080,0 -{GEAR_DOWN}- 19=P72,18,C66079,0 -{GEAR_UP}- [Axes.Beaver] RangeRepeatRate=10 0=BS,256,F,66162,66163,66164,66165 -{ TO SIM: COWLFLAP1_SET, COWLFLAP2_SET, COWLFLAP3_SET, COWLFLAP4_SET }- 1=CZ,256,F,x020025F2,0,0,0 -{ FSUIPC: offset word set, offset 25F2 }- 2=KR,R0,F,67011,0,0,0 -{ TO SIM: ANTI_ICE_GRADUAL_SET }- [Buttons.Beaver] 1=PC,11,CL30:R,1 -{Lua Beav_TankSelect}- 7=PC,15,CL31:R,0 -{Lua Beav_FuelPump}- All the default axis assignments go into the Beaver axis section (which I don't want), but none of the default button assignments go to the Beaver button assignments. Now I change the default axis assignment from offset 25F2 to 25F4 and the button for gear down also changes from 19 to 13: [Axes] PollInterval=10 RangeRepeatRate=10 0=BS,256,F,66162,66163,66164,66165 -{ TO SIM: COWLFLAP1_SET, COWLFLAP2_SET, COWLFLAP3_SET, COWLFLAP4_SET }- 1=CZ,256,F,x020025F2,0,0,0 -{ FSUIPC: offset word set, offset 25F4 }- [Buttons] PollInterval=25 ButtonRepeat=20,10 18=P72,13,C66080,0 -{GEAR_DOWN}- 19=P72,18,C66079,0 -{GEAR_UP}- [Axes.Beaver] RangeRepeatRate=10 0=BS,256,F,66162,66163,66164,66165 -{ TO SIM: COWLFLAP1_SET, COWLFLAP2_SET, COWLFLAP3_SET, COWLFLAP4_SET }- 1=CZ,256,F,x020025F2,0,0,0 -{ FSUIPC: offset word set, offset 25F2 }- 2=KR,R0,F,67011,0,0,0 -{ TO SIM: ANTI_ICE_GRADUAL_SET }- [Buttons.Beaver] 1=PC,11,CL30:R,1 -{Lua Beav_TankSelect}- 7=PC,15,CL31:R,0 -{Lua Beav_FuelPump}- Now gear down still works for all aircraft. If I would want to have a different button for a specific aircraft I would assign it profile specific. The axis that now goes to offset 25F4 only works for aircraft that do not have profile specific axes assignments. I think the way it works for buttons is the better one.
  7. Yes, but the other way, if I want to change an axis assignment that is not profile specific, I have to load an aircraft that does not have any profile specific axis assingments. Then I change the axis assignment and it goes to the [AXIS] section. Now, all aircraft that do have profile specific axis assignments will not see the change, I have to manually update all [Axis.xx] sections in the .ini file.
  8. If I change an axis assignment which is not profile specific it gets updated in the [Axis] section. I then have to update all [Axes.xx] sections with manually in the .ini file? Or is there another way to do it from the GUI? Karl
  9. Thank you. I will inform you whenever I see irregularities. Best, Karl
  10. 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?
  11. 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?
  12. 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"
  13. 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;
  14. 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
  15. 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
  16. 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
  17. 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
  18. 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?
  19. 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
  20. 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
  21. 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
  22. 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
×
×
  • 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.