Jump to content
The simFlight Network Forums

Recommended Posts

Posted
Quote

so I use  MSFSVariableServices.IsRunning , but it always return true. even I 'm not running MSFS2020.

Yes I can see that here as well. My DLL is just returning the value from the WASM module which seems to be wrong. I've asked John to take a look at this. 

Paul

  • 1 month later...
Posted

There should be a section on the download page for "MSFSVariableServices Example Code". Expanding that, you should see buttons for the C# and VB download. 

If not, press [CTRL-F5] for force the browser to download the new version of the page. It may be using a cached version.

Paul 

Posted

Paul,

I hope you're doing well, my friend.  I have a question pertaining to FBWA320 HVARs; specifically, I can manipulate all variable except for two:

H:A320_Neo_FCU_HDG_INC

H:A320_Neo_FCU_HDG_DEC

            FsHVar hvar = this.VS.HVars[H:A320_Neo_FCU_HDG_INC];
            if (hvar != null)
            {
                hvar.Set();
            }

Do you have any thoughts why these won't work?  They're included in the A320.hvar module file.  Any thoughts would be greatly appreciated   

Posted

I don't know sorry. I can only suggest trying to set them with John's WASMClient.exe (from the FSUIPC WASM Module 0.5.5a.zip on fsuipc.com). If it doesn't work from there either then maybe ask John about it in the FSUIPC7/MSFS forum. 

If FBW have a support forum you might try asking there as well.

Paul

  • 1 month later...
Posted

@Paul HentyI want to try the MSFS_VariableServices_CSharp, but I get no LVARS. If I press "Start MSFSVariableServices", I seem to be successfully connected to MSFS. But pressing "Log LVars" gives me "We have 000 lvars". "Reload Variables" doesn't help.

When I started, I first installed the latest version of FSUIPC7. This seems to install the WASM version 0.5.5 (manifest.json shows 0.5.5), which seems not compatible with the MSFSVariableServices example code. I get the error "**** Incompatible WASM version: The WASM version is 0.5.5 while the WAPI version is 0.5.3. Cannot...." (rest is hidden, and I can not make it visible).

I stopped FS2020, and copied an earlier version of the WASM module, and started all over again. The manifest.json of this FSUIPC WASM shows 0.1.0, and now I don't get any error. Although, still no LVars 😪

I tried with the native A320_Neo, and with the FBW A32NX, but same results.

So I assume that 0.1.0 is too old to work with this Example? Is there a way to get 0.5.3 somewhere?

Posted

@Paul Henty What a fast service!!! It works as a charm! Thanks a million!

I have also downloaded the FSUIPCExampleCode_CS, and this also seems to work. Although there were a few roadblocks. Maybe worth to mention it somewhere? Might be that the third one is related to my settings.

  1. FSUIPC7 needs to be running as well. I assume you can use the WASM module without it, but for these examples it is required, right?
  2. FSUIPC_WAPID.dll was not included - I copied it from the other download and put it in the main folder and added it in the project (right click on the project, Add/Existing item..., filter Executable files, and choose the dll).
  3. There were 4 "*.resx" files for which I needed to remove "the mark of the web". You can do this easily by closing VS2019, go to each file, right click it and select properties, and in the General tab enable "Unblock" at the bottom right.image.png.a8d07c4b1e1071df8d14c1daec6965a6.png

After that I could build and run it, and the first examples seemed to work perfectly.

Just one more question. Is the "FSUIPC_WAPID.dll" related to the "using FSUIPC;"? If the dll is not there, then the "using FSUIPC;" is grayed out. I'm sure you have somewhere included a list with all the functions with their parameters, or are the examples meant for that?

Thanks again!

Posted

Hi Hans,

The two projects demonstrate two different ways of communicating with the Flight Sim. (Before MSFS there was just one - FSUIPC).

FSUIPC - Shown in the FSUIPCExampleCode project.

This doesn't require the WAPID DLL and doesn't use the WASM module. This allows getting and setting data via 'offsets', and sending actions to the Sim known as 'Controls' (some people call them  'events'). This does of course require FSUIPC to be running as that's what the DLL talks to. It can be any version of FSUIPC from 3 to 7 running in any supported flight sim (FSX, P3D, MSFS, XPlane). 

WASM - Shown in the MSFS_VariableServices project.

This is only applicable to MSFS and requires both the WASM module to be installed in MSFS and the WAPID DLL on the client machine. This is limited to getting LVars (local panel variables) and setting LVars and HVars in MSFS.

My FSUIPCClient library allows you to use one or both of these methods together to build your application. Which you use depends on what data you want to read/write from the sim and where that data can found (e.g. Offsets/LVars).

If you only want LVars you don't need FSUIPC running. If you only use offsets you don't need the WASM module or the WAPID dll.

Quote

FSUIPC_WAPID.dll was not included 

There is no need as this example project is not using the WASM module, only FSUIPC.

Quote

There were 4 "*.resx" files for which I needed to remove "the mark of the web"

I think this depends on what folder you downloaded them to. Some folders are marked as 'trusted' but some are not. If you download to an untrusted folder you just need to mark them as trusted as you have done.

Quote

I'm sure you have somewhere included a list with all the functions with their parameters, or are the examples meant for that?

The example projects are the main documentation as they show you all the features available and how to use them. There is reference documentation (links in the top right corner of most examples) but I don't think this is the easiest way to see what's available or learn how to use the library.

The library has intellisense documentation that tells you what properties/methods/parameters exist while you're coding.

Paul

Posted

Hi Paul,

I start getting it. I'm looking through the documentation provided on the website, and I'm impressed with the quality and completeness, even for a not that experienced guy like me. I realize that 2 out of the 3 questions I asked would already have been answered. You could have said "read the f.... manual!", but I appreciate your patience😁

I think that your tool is exactly what I need!

Hans

Posted

@Paul Henty Hello Paul,

Not sure if I should ask questions in this thread, or should I create a separate post. Just let me know, ok?

The MSFSVariableServices works great. I am able to set and get LVars and set HVars on the FBW A32NX. Because I'm working on the FCU, I'm experimenting to control the SPD, HDG, ALT and V/S.

But if I want to use other variable types, like A:, K:, etc..., I assume I need to use the FSUIPC part, right? But is everything controlled through Offsets? Or are there ways to control things by name?

And does that require a second SimConnect connection? Meaning that MSFSVariableServices is one SimConnect client (because you can't talk directly to WASM, you do that through a SimConnect connection, right?), and FSUIPC will us a second connection. Or is there a way to use the SimConnect connection of MSFSVariableServices to also get control the other variables?

Is there also a function "Execute_Calculator_Code", which seems makes it very easy to work with other variables then LVars and HVars? Ok, Execute_Calculator_Code doesn't return any values, but still, it would allow to experiment a lot easier.

Is the sourcecode of your C# implementation available somewhere?

Posted

Hi Hans,

Probably best to make new threads. It's easier for others to search for specific problems.

Quote

But if I want to use other variable types, like A:, K:, etc..., I assume I need to use the FSUIPC part, right? But is everything controlled through Offsets? Or are there ways to control things by name?

Yes you need FSUIPC for A and K. FSUIPC uses 'offsets' for reading and writing A variables. It uses 'Controls' to write to the K variables. 

FSUIPC has no way of using names; offsets and controls are numbers. My DLL does however have an enum for the Controls, so you can use names for controls via the enum, but I don't know if these names are the same as the underlying K variable.

Quote

And does that require a second SimConnect connection?

I would think so, but you'd have to ask John. Both FSUIPC and the WASM interface do use SimConnect. I assume they make their own separate connections.

Quote

Is there also a function "Execute_Calculator_Code", 

Yes, use the method ExecuteCalculatorCode() on your MSFSVariableServices object.

Quote

Is the sourcecode of your C# implementation available somewhere?

No, the DLL is closed source.

Paul

  • 2 weeks later...
Posted (edited)

Hi Paul,

 

First of all thx for the great FSUIPC wasm module. I am now using it to control axes for the B274D for MSFS that just came out. I use LVars for that. I run into a weird issue. The program works fine when running in Visual Studio debug mode. But when it runs in release without Visual Studio, I will get an error after a while like this:

[ERROR]: Error setting Client Data lvar value 295=58.039216

However, up to that point, the program has been succesfully able to set the same lvar repetitively. 

Do you have any idea what can cause this behaviour?

I am running SU9 beta, with the Boeing 247D as aircraft (not sure it might be the aircraft, it has quite a different structure with really many many custom Lvars, when doing Debug Logging I see Lvar ID nrs up to 1168 or so passing).

The code is here: https://github.com/TheFlyingDutchman77/EasyControlsMSFS

Any assistance would be much appreciated.

 

Edited by FlyingDutchman77
Posted
[ERROR]: Error setting Client Data lvar value 295=58.039216

This error is being generated by @John Dowson's WASMIF module. Looking at his source code it's generated when a  SimConnect call fails when trying to write the LVar value.

John might have some ideas about why this could happen.

Quote

. The program works fine when running in Visual Studio debug mode. But when it runs in release without Visual Studio, I will get an error after a while like this:

The main difference would be the speed your application runs at. It will be much faster in release. Maybe the writes are too fast and SimConnect is getting overwhelmed. It would depend on how you're controlling the timing though.

Most of the .NET timers only tick as fast as the code running on the Tick event can complete. It could be that in debug mode the timer is running slower than your timer interval setting. But in release the timer tick code runs faster and the timer ticks AT the timer interval setting.

Paul

Posted
11 minutes ago, Paul Henty said:

John might have some ideas about why this could happen.

I can only think this can be do with the speed you are calling this function, as Paul says. The simconnect call to set the value in the client data area is failing (as the message indicates), but there is no way that i can think of to get further details on why this is failing. Did you try continuing to see if subsequent calls succeed? If you can continue, see what %age if errors you get, and try throttling your requests accordingly (i.e. until you don't get any errors).

John

 

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.