Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Prior to FSUIPC7 Lvars were saved in file lvars.lst which is used by LINDA for monitoring and setting their values. Would it be possible to copy the list of current Lvars and Hvars to lvars.lst and hvars.lst respectively? The files should be populated when the aircraft is loaded based on the WASM.ini LvarScanDelay variable.

Posted
11 hours ago, Scotfleiger said:

Prior to FSUIPC7 Lvars were saved in file lvars.lst

Really? Where is this file created, and how? This is news to me, so can you let me know how you generate that file (or if its automatic) and where it is located. O have never heard of such a file.

11 hours ago, Scotfleiger said:

Would it be possible to copy the list of current Lvars and Hvars to lvars.lst and hvars.lst respectively?

If you are doing this from code (C/C++), can you just not use the WAPI interface, the following functions:
            void getLvarList(unordered_map<int, string >& returnMap); // Returns a list of lvar names keyed on the lvar id
        void getHvarList(unordered_map<int, string >& returnMap); // Returns a list of hvar names keyed on the lvar id

		void getLvarList(unordered_map<int, string >& returnMap); // Returns a list of lvar names keyed on the lvar id
		void getHvarList(unordered_map<int, string >& returnMap); // Returns a list of hvar names keyed on the hvar id

Alternatively, Hvars are loaded from a .hvar file anyway, so for hvars can you not just use the same file?
For lvars, I guess I could add a lua function to list them to a file (also for hvars I guess) if really needed.

John
 

Posted

Hi John

Thanks for your help again. The lvars.lst is generated by LINDA using calls to ipc.getLvarName(id). It is likely that this ipc call was not implemented when I first modified LINDA with an early version FSUIPC7 as I had to comment out the calls and, hence, no list was created. I have now have a list.

LINDA uses Delphi/Pascal and not C/C++ so calling WAPI is not an option. Without an ipc call I will look at accessing the .hvar lists directly.

Posted

Hi Andrew.

27 minutes ago, Scotfleiger said:

Without an ipc call I will look at accessing the .hvar lists directly.

I will add an ipc.getHvarName(id) function. This should have been added when I added the ipc.activateHvar(“name”) function but seems to have been missed.
I can post a version here for you to test if you like - may take me a day or two.

John

 

Posted
55 minutes ago, John Dowson said:

I will add an ipc.getHvarName(id) function.

Thank you so much. There is also the paired ipc.getHvarId("name") that would replicate those for Lvars.

Posted

V7.2.15a tested.

ipc.getHvarName(n) returns the expected Hvar name and allows me to extract a full list of Hvars. I can also read and write to these Lvars as before.

ipc.getHvarId("name") returns a very large number. For example, for the FlyByWire A32nx:

n = ipc.getHvarId("H:A320_Neo_PFD_BTN_LS_1")
_log ('Hvar = ' .. tostring(n))

returns
Hvar = 1.844674407371e+19

 

Posted
9 minutes ago, Scotfleiger said:

pc.getHvarId("name") returns a very large number. For example, for the FlyByWire A32nx:

n = ipc.getHvarId("H:A320_Neo_PFD_BTN_LS_1")
_log ('Hvar = ' .. tostring(n))

returns
Hvar = 1.844674407371e+19

Hmm, strange. I presume that hvar exists....I will take a look - tomorrow now.

  • Upvote 1
Posted

It is the same and valid as I fed the results of one into the other.

function test()
    m= ipc.getHvarName(5)
    _log ('Hvar = ' .. m)

    n = ipc.getHvarId(m)
    _log ('Hvar = ' .. tostring(n))

end

returned

:  [EVNT] Execute Command = "test"
:  Hvar = H:A320_Neo_PFD_BTN_LS_1
:  Hvar = 1.844674407371e+19

Good night.

Posted

Hi John, the latest build (version no unchanged) works for both ipc.getHvarName() and ipc.getHvarId(). The correct values are returned. When first run I got a nil error and had to click on Add-ons/WASM/List Hvars to 'load' the Hvars for use.

I am still confused on the difference in use of the Hvars to the traditional Lvars. ipc.activateHvar is said to 'write' to Hvar but takes no parameter. How does this differ from ipc.writeLvar("name", n)? Is there any case for adding ipc.readHvar("name"), ipc.readHvarSTR("name","value"), ipc.writeHvar("name", n) and ipc.writeHvarSTR("name","value")?

Thanks again.

Posted
11 hours ago, Scotfleiger said:

I am still confused on the difference in use of the Hvars to the traditional Lvars. ipc.activateHvar is said to 'write' to Hvar but takes no parameter. How does this differ from ipc.writeLvar("name", n)? Is there any case for adding ipc.readHvar("name"), ipc.readHvarSTR("name","value"), ipc.writeHvar("name", n) and ipc.writeHvarSTR("name","value")?

As far as I am aware, hvars have no associated value and are basically JS / HTML events, and should probably be called H:Events (I have seen this term also used).
The FSUIPC WASM just uses the H:varName to execute the calculator code:
      (>H:varName)

I have seen examples where an actual value has been set. However, I don't thing this is an associated value to the hvar, but more like a parameter to an event. There is no way that I know of to actually read the value of a hvar.
If needed, I could allow a parameter to set on a hvar, but up to now I have not seen a need and no one has requested such a feature. This can currently be achieved by using the ipc.execCalcCode(“code”) function, if needed.

12 hours ago, Scotfleiger said:

When first run I got a nil error and had to click on Add-ons/WASM/List Hvars to 'load' the Hvars for use.

Thats strange - I can only assume that you made the call too soon. Hvars won't be available until a number of seconds AFTER the aircraft has loaded, defined by the LvarScanDelay parameter, which has a default value of 5. However, I recommend increasing this to around 45 if using complex aircraft, such as the FBW A320.
If you check your FSUIPC7.log, you should see when the lvars/hvars are available and if you made the request too soon. I can think of no other cause of such behaviour.

12 hours ago, Scotfleiger said:

Thanks again.

No problem.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.