Jump to content
The simFlight Network Forums

FSUIPC WASM module + client-side API + lvar/hvar discussion topic


John Dowson

Recommended Posts

2 hours ago, John Dowson said:

You shouldn't need to restart the simulator. You can issue a reload, as I said.

This memory may be related to Mobiflight.

Done! I spent the whole day making adjustments and finally did a small test flight. All toggle switches, encoders and potentiometers work as expected. The flight was wonderful without the need to aim the cursor at the pixels! Thanks to dear developers!

A month ago, I would have given a lot for the previous page of this topic.

Link to comment
Share on other sites

Hi Guys,

i want to ask, if someone could do a favour to all of them, who didn't really understand all those technical Discussions here. So please could someone release a complete Step by Step Tutorial, about all the necessary Steps and File Settings to execute i.E. this Order in a Lua Script ipc.writeLvar("L:A320_Neo_AIRCOND_LVL_1", 40).

In my Opinion, such a complete Tutorial here in this Place would very, very helpful to People, who wants to do something in MSFS2020 by executing Lua Scripts. My self, i am an experienced Lua Programmer, but all those Things relating to WASM are simply a Book with seven Seals.

I hope, that somebody will take the Time to help those, who don't know, how they could help them selfs.

Thanks a lot in Advance
Joachim
 



 

Link to comment
Share on other sites

16 hours ago, Airbuspilot said:

So please could someone release a complete Step by Step Tutorial, about all the necessary Steps and File Settings to execute i.E. this Order in a Lua Script ipc.writeLvar("L:A320_Neo_AIRCOND_LVL_1", 40).

There aren't that many steps. If you have installed the 7.1.0f beta (including the WASM), then all you have to do is enable the WASM in FSUIPC7 - you do this once, from the Add-ons -> WASM -> Enable menu entry. Once thats done, you can write your lua scripts to use lvars/hvars and assign or auto-run as required. So it basically works out-if-the-box, once enabled, although you can tune/change certain aspects if required.

I have added some documentation for the WASM in the Advanced user guide, but I still need to add more, especially w.r.t hvars. I'll add more on this in the next update.

Link to comment
Share on other sites

So, I got to CRJ from Aerosoft. To control the scale of the map, it has an LVAR like this:
L: ASCRJ_LSP_RANGE_CHANGE
The scale change occurs when the command +1 or -1 is sent.
If I add lines like this
1=L:ASCRJ_LSP_RANGE_CHANGE=set,-1
2=L:ASCRJ_LSP_RANGE_CHANGE=set,+1
That switching is triggered only once. That is, there is no constant change in one direction. I can only switch between the two values.
I have also tried one command
L:ASCRJ_LSP_RANGE_CHANGE=set
And assigned it the values "1" and "-1", but the result is the same. What could be the reason?

Link to comment
Share on other sites

10 minutes ago, Eliagh said:

If I add lines like this
1=L:ASCRJ_LSP_RANGE_CHANGE=set,-1
2=L:ASCRJ_LSP_RANGE_CHANGE=set,+1

I have said this several  times to you now but you keep doing the same thing. The lvar name is the name of the macro. Due to this, you can only use any given lvar ONCE in any macro file (i.e. each macro name in a macro file must be unique), otherwise it will cause issues. Please stop doing this.

13 minutes ago, Eliagh said:

I have also tried one command
L:ASCRJ_LSP_RANGE_CHANGE=set
And assigned it the values "1" and "-1", but the result is the same. What could be the reason?

That should work. If it doesn't, I don't know why. Does setting these values (using the WASM ->Set Lvar... menu entry) work consistently? If so, then activate debug logging (in FSUIPC7 WAPI and in the WASM) and check the correct values are being sent - maybe compare the log output from 'Set Lvar' to that produced from activating the macro. You can post your log files here and I will take a look.

Link to comment
Share on other sites

8 minutes ago, John Dowson said:

Please stop doing this.

Has already stopped. These are just experiments and I'm just learning.
In any case, the reason was different. Many buttons in CRJ from Aerosoft that perform several sequential actions start working correctly only if you fill in the field that I highlighted in the screenshot.

Capture.JPG

Link to comment
Share on other sites

1 minute ago, Eliagh said:

In any case, the reason was different. Many buttons in CRJ from Aerosoft that perform several sequential actions start working correctly only if you fill in the field that I highlighted in the screenshot.

Ok, so its a momentary change. Yes, some lvars work this way - its really up to you to experiment to find out how these work especially for add-aircraft. Note that some lvars are also read-only, but FSUIPC has no way of knowing which. If you write to such lvars, they won't update.

Link to comment
Share on other sites

59 minutes ago, John Dowson said:

There aren't that many steps. If you have installed the 7.1.0f beta (including the WASM), then all you have to do is enable the WASM in FSUIPC7 - you do this once, from the Add-ons -> WASM -> Enable menu entry. Once thats done, you can write your lua scripts to use lvars/hvars and assign or auto-run as required. So it basically works out-if-the-box, once enabled, although you can tune/change certain aspects if required.

I have added some documentation for the WASM in the Advanced user guide, but I still need to add more, especially w.r.t hvars. I'll add more on this in the next update.

Hey John,
thanks for the Reply.
I have installed 7.1.0f incl. WASM 0.4.10. Also i enabled WASM in the Add-Ons Tab of FSUIPC7.
Unfortunatelly it seems not to work that easy. The Knob isn't turning.

Yes, i noticed your Words in the Advanced User Guide about WASM. Glad, you saw by your self, that those few Words aren't enough to explain, how to use WASM.

Greets Joachim

Link to comment
Share on other sites

2 hours ago, Airbuspilot said:

Unfortunatelly it seems not to work that easy. The Knob isn't turning.

You have to do more than just activate the WASM.... What knob/aircraft/hvar/lvar are you talking about? Have you checked, if an lvar, that it is writeable? FSUIPC provides the tools for you, you have to investigate what works and how to use the lvars/hvars. I cannot possibly provide support for all lvars in all aircraft, especially in add-ons that I don't have. If you have any issues with a particular assignment, best to raise a new topic detailing you issue, and make sure you specify the aircraft that you are using. Then, someone else who has looked ath this may be able to help you, otherwise, if its an MSFS default aircraft, I may take a look for you.

However, this support forum topic is for issues with the WASM and the lvar/hvar access in FSUIPC. It is  not meant for specific questions on using a particular lvar/hvar in a particular aircraft.

2 hours ago, Airbuspilot said:

Yes, i noticed your Words in the Advanced User Guide about WASM. Glad, you saw by your self, that those few Words aren't enough to explain, how to use WASM.

But there should be plenty of information there for advanced users who are already familiar with lvars/hvars. That is why this is currently a beta for advanced users. Even if I add more information, there won't be a 'how to use the WASM' section. That is in the background. The average user doesn't/shouldn't need to know much about the inner workings. You just need to know how to use lvars/hvars, and the documentation for this is already there in the relevant sections.

We are also always open to user contributions if anyone wants to provide a more detailed tutorial. I do not have the time for this.

Link to comment
Share on other sites

3 hours ago, John Dowson said:

You have to do more than just activate the WASM.... What knob/aircraft/hvar/lvar are you talking about? Have you checked, if an lvar, that it is writeable? FSUIPC provides the tools for you, you have to investigate what works and how to use the lvars/hvars. I cannot possibly provide support for all lvars in all aircraft, especially in add-ons that I don't have. If you have any issues with a particular assignment, best to raise a new topic detailing you issue, and make sure you specify the aircraft that you are using. Then, someone else who has looked ath this may be able to help you, otherwise, if its an MSFS default aircraft, I may take a look for you.

However, this support forum topic is for issues with the WASM and the lvar/hvar access in FSUIPC. It is  not meant for specific questions on using a particular lvar/hvar in a particular aircraft.

But there should be plenty of information there for advanced users who are already familiar with lvars/hvars. That is why this is currently a beta for advanced users. Even if I add more information, there won't be a 'how to use the WASM' section. That is in the background. The average user doesn't/shouldn't need to know much about the inner workings. You just need to know how to use lvars/hvars, and the documentation for this is already there in the relevant sections.

We are also always open to user contributions if anyone wants to provide a more detailed tutorial. I do not have the time for this.

okay, i understand your Policy of Software Development. I am also a Software Develeoper and as that i tell you, if i treat my Customers the Way you do, i haven't any Customer anymore. Okay, i didn't pay much for FSUIPC7, but i paid for it. And as a Customer i am looking for help from the Develepers. Simply senseless. Thanks, i learned my Lesson and give up with FSUIPC. There is no need to answer anymore John, because i have stolen enough of your Time.

 

Link to comment
Share on other sites

16 hours ago, Airbuspilot said:

And as a Customer i am looking for help from the Develepers. Simply senseless.

Sorry, I really don't understand your reply. You tell me 'The Knob isn't turning' and expect me to know what you are talking about? As I said in my response, firstly this is not the topic to post such requests. This topic is for questions relating to the WASM functionality and the use of the WAPI, and its integration into FSUIPC7. It is not meant to be for control of specific functions for specific aircraft. For such issues, you need to raise a separate support requests, detailing your issue, and including at least the aircraft (and mod, if applicable), and as well as the function you are trying to assign, together with maybe any attempts you have made. If you do this, and its a default aircraft, I would look into this when I have time. If its an add-on aircraft, then an appropriate title may attract other users with that aircraft that may be  able to help.

Link to comment
Share on other sites

On 4/20/2021 at 4:58 PM, Eliagh said:


Hi, can the wasm module (or FSUIPC) deals with O: variables ?
In the TBM, i can only find an O: variable for the bleed switch.

 

Edited by SAC002
Sorry...did not want to quote another post
Link to comment
Share on other sites

18 minutes ago, SAC002 said:

Hi, can the wasm module (or FSUIPC) deals with O: variables ? In the TBM, i can only find an O: variable for the bleed switch.

Sorry, I have no idea what O: variables are or how to use them. If you know how to use them, you could try in lua using the ipc.execCalcCode function.

John

Link to comment
Share on other sites

On 4/26/2021 at 1:25 PM, SAC002 said:

Hi, can the wasm module (or FSUIPC) deals with O: variables ?
In the TBM, i can only find an O: variable for the bleed switch.

 

On 4/26/2021 at 1:45 PM, John Dowson said:

Sorry, I have no idea what O: variables are or how to use them. If you know how to use them, you could try in lua using the ipc.execCalcCode function.

John

I am in the middle of learning how to...well actually mr.Dowson after a few years I'm back to studying the materials you provided related to the use of LUA in FSUIPC, what is the difference between Dword and Sword, etc...since didn't finish those parts, and actually there's still so much, so much more to all of this.

I also see the so called "O variables" and not only those, there are "M" and "U"  and "T", etc.
Those are actually not these variables we know and use (seems to me).
By looking at the source code of cockpit instruments and AC controls, I noticed Asobo resorted to using some kind of "templates" for every single event within an airplane. 

In a lot of situations, why is there no actual animation to the switch/whatever that we assigned a key or a button button, yet the command still works (for example the trim switch) ?
Because if we want that, it is not enough to activate only the Lvar for the trim down - we absolutely need the fully developed Hvar by the developer - but oftentimes we'll also have to tell the sim which animation to trigger and HOW (eg. left rocker switch pressed and held/released) - we also need to assign the proper code for that animation's sound - and more.
All that's performed by sending those internal simulator variable and event names in the proper formatting - and the formatting and the whole mechanism is contained within nice fat HTML <templates> .

Animations and sounds and millions of other things defined trough those M, G, Ж, Я "variables" within those templates that's part of (eg.) trim down - is handled by it's assigned JAVA script that executes everything the proper way, and in case of digital instruments with displays there's also CSS for the text formatting and styling, etc.

These airplanes....are very similar to a website !
And then some brand manufacturer makes a throttle quadrant for the MSFS and then does all that interfacing for their device and packs that within the driver package.
So a person buys it, then plugs it and hops into his/her favorite 747 to make barrel rolls above Berge Khalifa after a stressful day at work - and everything works out of the box !

(there's a guy who came here some time ago and asked Dowsons to show him how to use FSUIPC, then got pissed off and demanded a refund when the answer wasn't "you click there and here then plug your joystick and start your MSFS" and "no you cannot get a refund", that guy is such type of MSFS consumer)

Anyway, we are a different universe and so we deal with wasms, vars, utilities, etc.

That's why mr.Dowson provided us with a simple Web Server that a guy named Paul Henty took some time and wrote such awesome tutorials for beginners to use it.
I suggest you take a look at it, it will open up a whole new universe for controlling aircraft trough FSUIPC with the peripherals, there's so much more that is actually very hard to do by activating simvars trough FSUIPC WASM module.

  • Like 1
Link to comment
Share on other sites

Here's a reasonable description on the various varialbe types on the Asobo forums (https://forums.flightsimulator.com/t/demo-lvar-write-access-for-any-aircraft-control/353443/19?u=impolitegem5317😞
 

Quote

Variables

L: are the usual LVar from FSX. The “L” naming might be misleading, since it sounds a bit like “Local” vars, when in fact they are really global user variables.

A: are “Airplane” variables, however they work from other Simobjects like Ground Vehicles too, but not all kind of objects have the same variables available, the User airplane has all of them, AI airplanes have less, Ground Vehicles even less and SimpleObject have less than Ground vehicles. They are the “simulation” variables which you usually read only, because they are handled by the simulation so, even if some of them can be written, you’ll likely “fight” against the simulation which will write to them too. You usually change their values indirectly: by sending an EVENT which result in the simulation changing its state.

H: are new “Html” variables used by the new Html5/Javascript gauge system

O: variables are local variables that store some states of simobjects with an XML behavior

Events

K: are not variables, they are Events ( K as in “keyboard”, even if they might not be assigned to the keyboard at all ), so you SEND them to the sim to perform an action, which usually results in a related A: variable to change. So, for example, if you send the K: PARKING BRAKE event, it will affect the PARKING BRAKE POSITION A: variable.

Right now, you can access A: variables with Simconnect, even from an external .EXE written in any language that supports it ( usually C# or C++ ), but to access L: variables you must use a WASM module or gauge that will call the Panels interface which maps 1:1 the old Gauges SDK.

H: and O: variables are usually accessed from Html/JS code, there’s no documented way to access them with an API.

H variables can be used via the Panels execute_calculator_code function (which is what is used by FSUIPC7 for these variable types), so it may also be possible to do this with O: variables. However, as there is no direct support for O: variables in FSUIPC7 (as there is for H: and L: type variables), the only way to try would be to use the ipc.execCalcCode() function.

Link to comment
Share on other sites

Hey guys,

I already succeeded to read a lot and write some of the L:Vars and trigger a couple of H:Vars successfully. (A32nx)
unfortunately writing on a lot of L:Var starting with 

XMLVAR_ 

eg. 

XMLVAR_Momentary_PUSH_OVHD_FUEL_LTKPUMPS1_Pressed
...
XMLVAR_Momentary_PUSH_OVHD_ELEC_BAT1_Pressed
...
XMLVAR_Momentary_PUSH_OVHD_ANTIICE_ENG1_Pressed
...
XMLVAR_Momentary_PUSH_OVHD_FLTCTL_SEC2_Pressed
...

it fails.
But for the following ones it works great:

function A32nx_Autobreak_Off()
     A32nx_Autobreak_SET(0) 
end

function A32nx_Autobreak_Low()
     A32nx_Autobreak_SET(1) 
end

function A32nx_Autobreak_Mid()
     A32nx_Autobreak_SET(2) 
end

function A32nx_Autobreak_Max()
     A32nx_Autobreak_SET(3) 
end

function A32nx_Autobreak_SET(autoBreakLevel)
     ipc.writeLvar("L:XMLVAR_Autobrakes_Level", autoBreakLevel) 
     local autoBreakLevelText = {"off","low","mid","max"}
     DspShow ("A-BRK", autoBreakLevelText[autoBreakLevel+1])
end

Is that just FlyByWireSim specific?
Missing implementation?

 

Link to comment
Share on other sites

45 minutes ago, joeherwig said:

XMLVAR_Momentary_PUSH_OVHD_FUEL_LTKPUMPS1_Pressed ... XMLVAR_Momentary_PUSH_OVHD_ELEC_BAT1_Pressed ... XMLVAR_Momentary_PUSH_OVHD_ANTIICE_ENG1_Pressed ... XMLVAR_Momentary_PUSH_OVHD_FLTCTL_SEC2_Pressed

Those lvars are Momentary - they should/probably perform some action and then revert back to its original value.
Could that be what is happening?

Link to comment
Share on other sites

I have recently been pointed to WASM for accessing MSFS2020 Lvars and Hvars for integration into LINDA using LUA code. I am able to read and write to Lvars but the Hvars have got me confused. I have searched the documentation and thread for clues without success.

For the A320Neo both Lvars and Hvars lists are incomplete for full control of the aircraft (eg. MCP data output and buttons missing). As far as I understand, Hvars are related to events.

Can someone point me towards suitable notes on how to respond to and trigger Hvars in LUA?

Link to comment
Share on other sites

22 minutes ago, Scotfleiger said:

I have searched the documentation and thread for clues without success.

Yes, sorry - I still need to add the documentation for using hvars.

22 minutes ago, Scotfleiger said:

Can someone point me towards suitable notes on how to respond to and trigger Hvars in LUA?

To use hvars, you first have to let them be known by the FSUIPC WASM (and hence FSUIPC). You do this by adding a *.hvar file to the FSUIPC WASM module (under the modules folder). The current beta v7.1.0f only has 1 hvar file, for the A320, and this is quite old now and needs updating. I will do this at some point, and maybe provide some hvar files for other aircraft - I have asked users to supply these, when found, but have so far only received one for the DA40-NG, which I will add in the next release.

Only one *.hvar file is loaded per aircraft, which will be the first one found on a substring match to the aircraft title.
You can add hvars to the file when FSUIPC7 is running, and issue a Reload command (from the Add-ons->WASM-Reload option) which will reload hvar files and re-scan for lvars.

To use hvars, you can either use macros, in the same way you would use an lvar, except only the Set command is available. Otherwise you can use the ipc.activateHvar function.

I am planning to add some specific FSUIPC controls for lvars/hvars to make them easier to use, i.e. 'Lvar Set', 'Lvar Toggle', 'Lvar Increment', 'Lvar Decrement', 'Lvar Cycle', 'Hvar Activate'. There are a few complications with this (mainly that the IDs of lvars aren't consistent!) and I need to update the WASM /WAPI to enable callbacks, so this is going to take a while. I may also add a user facility to populate (user) offset with lvar values, to make them more accessible.

Link to comment
Share on other sites

8 minutes ago, Airbuspilot said:

How can i realize that? * is not possible as a Filename.
I am a german Citizen and have a german OS Layout. Do i have to change it, to name it *.hvar?

Replace the * by the substring match to the aircraft title

for example, TBM 930.hvar

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.