Jump to content
The simFlight Network Forums

How to set Lvars with Lua Scripts in A32NX from FlyByWireSim?


Airbuspilot
 Share

Recommended Posts

Hello,
maybe someone could provide a Solution for my Problem. Involved is the A32NX from FlybywireSim.
If possible, please have a look at the attached Script. It is real small and there are three Things, i want to do. The first Thing is to turn on the External Power. That works.
The second Thing is to turn the Knob of the Cockpit Air Condition into the 40% Position. If i do this in the WASM Module via the Set Lvar Option, the Knob turns into the desired Position. At Least i want to read out the Value to the Variable eCon. That also doesn't work.

I would be very glad, if someon could take the Time to look into the little Script and describes what is needed to successful execute it.
If you need more Infos, please let me know.

Many Thanks in Advance, Joachim

FlightLog.lua

Link to comment
Share on other sites

  • Airbuspilot changed the title to How to set Lvars with Lua Scripts in A32NX from FlyByWireSim?
1 hour ago, Airbuspilot said:

I would be very glad, if someon could take the Time to look into the little Script and describes what is needed to successful execute it.
If you need more Infos, please let me know.

I think you need to add a delay between the write the read. The write takes a round-trip to MSFS, and then the updated values need to be sent back to FSUIPC7. If you write, then read directly, you will be getting the old value back as the internal values have not yet been received from the server. It shouldn't take too long for this, but this also depends on the update frequency set for the lvar values (defaults on every frame at the moment).

Anyway, as you have just written the value, if its a writeable lvar then you can just set eCon to that value (40). Otherwise, try adding an ipc.sleep call between the writing and reading, starting with 100ms and adjust as needed.

Link to comment
Share on other sites

22 hours ago, John Dowson said:

I think you need to add a delay between the write the read. The write takes a round-trip to MSFS, and then the updated values need to be sent back to FSUIPC7. If you write, then read directly, you will be getting the old value back as the internal values have not yet been received from the server. It shouldn't take too long for this, but this also depends on the update frequency set for the lvar values (defaults on every frame at the moment).

Anyway, as you have just written the value, if its a writeable lvar then you can just set eCon to that value (40). Otherwise, try adding an ipc.sleep call between the writing and reading, starting with 100ms and adjust as needed.

Thanks for your Help. ipc.sleep(500) solved the Problem.
I wil try some other Variables and will be back, if there are Problems again.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • 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.