Jump to content
The simFlight Network Forums

Paul Henty

Members
  • Posts

    1,729
  • Joined

  • Days Won

    78

Posts posted by Paul Henty

  1. This control needs two parameters: the index of the source bus and the index of the circuit you want to connect to. (The 2 and 1 in the example code you posted).

    I don't think it's possible with FSUIPC to send two parameters to an event. Historically they've only allowed one.

    There are two alternative options I know of:

    1. Use the MSFSVariableServices class to execute the calculator code directly:

    MSFSVariableServices.ExecuteCalculatorCode("2 1 (>K:2:ELECTRICAL_BUS_TO_CIRCUIT_CONNECTION_TOGGLE)");

    There is an example project for getting started with MSFSVariableServices on the website:

    http://fsuipc.paulhenty.com/#downloads

     

    2. Use the 'presets' feature to execute the calculator code stored in the myevents.txt file. See the "FSUIPC7 for advanced users" pdf and offset 0x7C50.

    Paul

  2. Quote

    , but hangs when I try "Log LVars".

    Could be related to this:

    Quote

    Yesterday when I opened FSUIPC 7.5b from the Windows toolbar, and went to Add-Ons / WASM, I could see the LVars.
    Today if I try, FSUIPC crashes. 😞

    Could you please download the FSUIPC WASM Module 1.0.6 + WAPI 1.0.4 package from fsuipc.com. Inside is a WASMClient test program. Can you see if that will list the LVars? (File -> Start, then Control -> List LVars).

    If it does then this problem is with my code and I'll look into it some more.

    If that test client will not list LVars then it's a problem with the WASM modules and you'll need to ask John about that.

    Paul

     

  3. There's an example project that explains how to use it. It also explains where to get a required file called FSUIPC_WAPID.dll that you need, and how to include it in your project.

    http://fsuipc.paulhenty.com/#downloads

    The example project is a few years old now. If it includes a FSUIPC_WAPID.dll file it could be too old to work so you should get the latest. On the MSFS side you need to install the WASM module which is installed by the FSUIPC installer. So make sure you're also up-to-date with the latest FSUIPC7.

    MSFSVariableServices is a completely separate system from the normal connection used for offsets.

    It's the preferred way to work with LVars (and HVars) in MSFS as it's hundreds of times faster than FSUIPCConnection.ReadLVar(). 

    Paul

  4. 45 minutes ago, mroschk said:

    very short question, is it possible to create a LVar using C# ?

    If you're using FSUIPC7 (MSFS) and the new MSFSVariableServices class then yes, you can: 

    MSFSVariableServices.CreateLVar("L:NewLVar", 0); // (Name, Initial Value)

    If you're using FSUIPC6 (i.e. the legacy FSUIPCConnection.ReadLVar() method) it's possible (FSUIPC6 supports creates) but I haven't included it in the DLL. Let me know and I can a add it.

    For FSUIPC5 and earlier versions it's not possible to create LVars.

    Paul 

  5. Hi.

    Sorry for the delay in replying, I've only seen it today.

    The newer versions of the DLL only work with .NET Framework 4.6.2 or later. As the error message shows, your project is currently using Framework 4.5 which is not compatible.

    You need to upgrade the framework used by your project:

    1. Go to your project in the solutions explorer and double-click on the 'My Project' node. 
    2. In the "Application" tab, find the dropdown called "Target framework" and change it to 4.6.2 or later. You may need to install if if it's not in the list.
    3. Reload the project and then add the Nuget Package again.

    image.thumb.png.f8c1268bc2a2b9e1fd436c8e5499e238.png

    Paul 

  6. Hi Lolo,

    After you make changes to Payload Stations and Fuel Tanks you need to call WriteChanges() to send the changes to the Sim.

    I think in WinDev it will be something like:

    FSUIPCConnection.PayloadServices:WriteChanges()

    If you need to change many Fuel Tanks you just call this once at the end:

    oFuelTanks :get_Item(FSFuelTanks ::Centre_Main) :set_LevelPercentage(30)
    oFuelTanks :get_Item(FSFuelTanks ::Centre_Left) :set_LevelPercentage(50)
    oFuelTanks :get_Item(FSFuelTanks ::Centre_Right) :set_LevelPercentage(50)
    FSUIPCConnection.PayloadServices:WriteChanges()

    Paul

  7. Hi Brandon,

    I can't see anything wrong with the code you've pasted, but it doesn't show where you are calling Process().

    The built-in ValueChanged flag only tells you if the change happed on the last Process(), so if you're checking values on a different timer or thread than the Process() calls you could miss the change. (Two process calls go by between your checks for ValueChanged).

    Could that be what's happening? If so I could make it so that ValueChanged is preserved until you actually test for the change. The ValueChanged feature was added long before multi-threading and async programming was easy in .NET, so it's really designed for a single thread, synchornous application.

    If that's not the case and your checks are definitely made after every process() on a single thread, please let me know and paste the code where you call Process() and I'll look into it some more. 

    Paul 

  8. 34 minutes ago, lolowindev said:

    // Accès aux données des réservoirs
    ps est un PayloadServices    // -Erreur :PayloadServices' n'est pas public, la création d'une instance de 'PayloadServices' est interdite.
    ps = FSUIPCConnection.PayloadServices

    The error is correct; you can't create a new instance of it. It's a static class. I don't know wlanguage so I'm not sure how to get a reference to a static class. Maybe this...

    ps <- FSUIPCConnection.PayloadServices

    Does that assign a reference of an existing class?

    Maybe it's not possible and you need to use the full name instead of 'ps': e.g.

    FSUIPCConnection.PayloadServices:RefreshData()

    oFuelTanks = FSUIPCConnection.PayloadServices:FuelTanks

    Try that. Or look at the WLanguage documentation to see how to deal with static classes in .NET.

    Paul

  9. Hi,

    I don't know WLanguage so I'm going to put the C# and my attempt at WLanguage.

    You are missing a few steps:

    First you must get a reference to the PayloadServices:

    C#:

    PayloadServices ps = FSUIPCConnection.PayloadServices;

    Wlanguage?

    ps is a PayloadServices

    ps = FSUIPCConnection.PayloadServices;

     

    Then you need to call RefreshData to load the current payload information from the Sim:

    ps:RefreshData()

     

    Then you need to get the fuel tanks collection:

    C#:

    FsFuelTanksCollection fuelTanks = ps.FuelTanks;

    WLanguage?

    oFuelTanks is a FsFuelTanksCollection

    oFuelTanks = ps:FuelTanks

     

    From here the rest of your code should work. 

    Paul

  10. Hi Andy,

    When you call MoveAircraftToHere() the DLL moves it to whatever position is set in the StartLocation property of the FsRunway object.

    That comes from the MakeRunways file called Runways.xml. Within each <Runway> tag is <FSStartLat> and <FSStartLon>.

    If this file doesn't have the correct location for the start of the runway then there's nothing I can do to fix it.

    On my system (FS9) this location is correct and so I always get set up on the center line.

    Make sure your users have run MakeRunways and rebuilt their airports database recently. If it's out-of-date then the data will not line up with any new scenery they've installed.

    Is it okay on your system?

    Paul

  11. You will need need to attach the handlers after the 777 loading process. 

    I'm not clear on the specific sequence of events for your application. There will be a time when you don't want notifications and a later time when you do. When you do, that's when you attach the handlers. It's the handlers that are presumably producing the 'spam' when you don't want them to. If they are no attached yet they won't do anything.

    Paul

  12. The best way would be to delay attaching the event handlers until you need them. 

    At the moment you attach them in the constructor. You could take out the call to AttachEventHandlers() and make that method public or internal. Then you can call it when you're application is ready to receive the notifications.

    You could also have a corresponding DetachEventHandlers() if there will be a time where you want to ignore the notifications.

    Paul

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