Jump to content
The simFlight Network Forums

Can't Get Some K Events to Fire with FSUIPC


Recommended Posts

Posted

I have FSUIPC v7.5.4 installed along with MSFS 2024.

I am working with someone on the Just Flight forums to help them bind a few things with FSUIPC, and for the life of me I cannot get Magneto1_Incr or Magneto1_Decr to work, at least in the new Black Square Bonanza Pro.  I've not yet tried with other aircraft, that's been the one I've been focused on for the past few days.  I suppose that's probably the next step.

Magneto1_Incr is one of the stock FS Controls offered by FSUIPC, so it should be as simple as binding that to a button, but for some reason the magnetos in the aircraft are not responding.  I have tried doing it via the Asobo control binding, and it works if I bind the button to Increase Magneto 1 there, but for this other user's purposes that's not a solution.  There is also a Magneto 1 Incr event included in the Mobiflight presets that also does not work, which is probably unsurprising as I'm sure it does the same thing.  Since it works via the Asobo bindings I'm very surprised it doesn't work via the FS Controls (I remove any conflicting bindings between tests).

Even using Execute Calculator Code with (>K:MAGNETO1_INCR) is not working (again, perhaps unsurprisingly), but I have been able to manipulate other K events through FSUIPC, such as the Kollsman increase/decrease, the battery switch via BATTERY1_SET, so I don't think it's a problem with my technique.

Black Square is fantastic about documenting his usage of variables in his manuals, and K:MAGNETO1_INCR is specifically called out for magneto control, along with an LVar for setting it to a specific position instead of just up or down.  Since it also works through the Asobo bindings, and I dug through the online SDK to confirm that K:MAGNETO1_INCR is what it should be, I feel pretty confident that calling Magneto1_Incr or the premade event through FSUIPC should also do the trick, and yet it isn't.

For both this other fellow to refuses to use anything but FSUIPC for controller bindings, and my own budding understanding of how to do advanced (and perhaps basic) functions in FSUIPC, does anyone have any thoughts on why certain K events are not working?

 

Semi-related: what language or formatting are events written in?  I am familiar with the RPN portion for at least math, but my eyes very quickly glaze over when I get to some of the examples with various if statements or even simple things like one that had "near" before the min and max.  I assume that's some sort of rounding function, but any pointers to what language or style, or some documentation there of would be appreciated.

Thanks!

  • jsmarko3 changed the title to Can't Get Some K Events to Fire with FSUIPC
Posted
13 minutes ago, jsmarko3 said:

Since it works via the Asobo bindings I'm very surprised it doesn't work via the FS Controls (I remove any conflicting bindings between tests).

Some standard controls don't work when assigned externally, and this is aircraft-dependent and I assume an issue with the event implementation in the aircraft. I cannot do anything about this in FSUIPC.

17 minutes ago, jsmarko3 said:

I cannot get Magneto1_Incr or Magneto1_Decr to work, at least in the new Black Square Bonanza Pro

There are no MF presets for this yet. The presets for the magneto in the BS Bonanza G36 use the lvar  L:BKSQ_IgnitionPosition_1 with a parameter of 0, 1 or 3 (for off/right/left), so maybe try them - check to see if those lvars exist or if there are similar ones for this aircraft.

20 minutes ago, jsmarko3 said:

Semi-related: what language or formatting are events written in?  I am familiar with the RPN portion for at least math, but my eyes very quickly glaze over when I get to some of the examples with various if statements or even simple things like one that had "near" before the min and max.  I assume that's some sort of rounding function, but any pointers to what language or style, or some documentation there of would be appreciated.

See the MSFS documentation: https://docs.flightsimulator.com/msfs2024/html/6_Programming_APIs/Reverse_Polish_Notation.htm

John

Posted
51 minutes ago, John Dowson said:

There are no MF presets for this yet. The presets for the magneto in the BS Bonanza G36 use the lvar  L:BKSQ_IgnitionPosition_1 with a parameter of 0, 1 or 3 (for off/right/left), so maybe try them - check to see if those lvars exist or if there are similar ones for this aircraft.

John

For the Black Square Bonanza Pro specifically, no, but in the events.txt file I did find one for just MagnetoIncrease#(>K:MAGNETO1_INCR) or named similarly, I don't have it handy in front of me to look.  The same LVar does exist in the new one, but I'm not knowledgeable about about scripting with RPN to try to make an increase/decrease function while having to set specific positions.

Thanks for the link to the RPN part of the SDK, I'll have a look, and I'll talk more to Nick at Black Square about event implementation.

Posted
4 minutes ago, jsmarko3 said:

For the Black Square Bonanza Pro specifically, no, but in the events.txt file I did find one for just MagnetoIncrease#(>K:MAGNETO1_INCR) or named similarly,

Did you try the MAGNETO_INCR k-event instead of the MAGNETO1 one? But I don't think that will work either...
If the BS Bonanza G36 uses an lvar, I would have thought the Pro would use something similar. Have you tried listing the lvars to see if anything looks appropriate? Also maybe try looking at the Input Events - you can list these, and also log any changes. Set logging for Input Events, (Log->Input Events) open the logging console (Log->Open Console) and turn the magneto in the virtual cockpit (VC) to see if anything is logged.

You can also examine the behavior of the switch using the MSFS dev tools to see how it is controlled - see this MF documentation: https://docs.mobiflight.com/guides/input-events-2024/

You can assign to input events in FSUIPC in two ways:
   1. Using Input Event assignments directly
   2. via calculator code and using them as B events (MSFS2024 only - doesn't work in MSFS2020)

John 

 

Posted
15 minutes ago, John Dowson said:

Did you try the MAGNETO_INCR k-event instead of the MAGNETO1 one? But I don't think that will work either...

I did and you are correct, it did not work either.

15 minutes ago, John Dowson said:

If the BS Bonanza G36 uses an lvar, I would have thought the Pro would use something similar. Have you tried listing the lvars to see if anything looks appropriate?

I edited the post a minute or so after I posted it to say this, but yes the Pro has the same named variable with a similar range.  That does work.  I have asked Nick on the Just Flight forums if he has any insight as to why the magneto K event would not work while I have a handful of other ones I tried that do work.  Using the LVar is possible; I could write something right now to set it to a specific value, and I may do that myself in a few days when my button box and key switch arrive, but for an increase/decrease function I would need to get smart on scripting to check what it is set to and where it should go.

I will likely put some thought and man-hours into trying to log it as you suggest; someone in a different topic on the JF forums mentioned he used some in-game developer tools to see what variables are changing, so I have a few options to go down that rabbit hole.

B events are something I never touched, but I see there are few listed in various Black Square manuals as variables you can manipulate, so I may end up needing or wanting to learn them down the road.

 

EDIT: and as always, thanks for the help.

Posted
1 hour ago, jsmarko3 said:

I could write something right now to set it to a specific value, and I may do that myself in a few days when my button box and key switch arrive, but for an increase/decrease function I would need to get smart on scripting to check what it is set to and where it should go.

You can do this easily in two ways:
   1. use a preset to increment using '++'. Also use min/max so it stays within range
   2. Add the lvar to an FSUIPC offset, then use the FSUIPC-added controls to inc/dec/cycle the offset. Changing the offset value in this way, when the offste holds an lvar, will send the new value to the FS.

1 hour ago, jsmarko3 said:

I have asked Nick on the Just Flight forums if he has any insight as to why the magneto K event would not work

Well, many standard events don't work for many add-on aircraft in MSFS, both MSFS2020 and MSFS2024. That is why you need to look into lvars, hvars, bvars, etc

1 hour ago, jsmarko3 said:

I will likely put some thought and man-hours into trying to log it as you suggest; someone in a different topic on the JF forums mentioned he used some in-game developer tools to see what variables are changing, so I have a few options to go down that rabbit hole.

Usually you can use FSUIPC logging - either events or input events. For lvars its more complicated - you have to find the lvars you want to monitor first (list them in FSUIPC), and then you can log the lvar changes to the lvars by adding a section to the FSUIPC7.ini file. This is documented in the WASM section of the Advanced User guide.

1 hour ago, jsmarko3 said:

B events are something I never touched, but I see there are few listed in various Black Square manuals as variables you can manipulate, so I may end up needing or wanting to learn them down the road.

B-events are Input Events, just via a different root - in FSUIPC, you can use input events directly via the Simconnect interface. B-events are only for use in gauge code, i.e. via valculator code or a preset. There is a mapping from B-events to input events, but not 1-1. For ecample, there may be just one input event which has a value (which you can change/set), but there may be several b-events associated to this input event, such as *_set, *_inc, *_dec. You won;t see these in the input event interface, just a variable with a value that you can control.

1 hour ago, jsmarko3 said:

EDIT: and as always, thanks for the help.

No problem!

Cheers,

John

Posted
1 hour ago, John Dowson said:

use a preset to increment using '++'. Also use min/max so it stays within range

I spent well over an hour learning a very valuable lesson on what exactly the leading > before an LVar means and does, but I think I'm well on my way.  Need some help from Nick at Black Square about the magnetos not responding appropriately, but once that's solved I think I'm pretty much set with this.

 

1 hour ago, John Dowson said:

Well, many standard events don't work for many add-on aircraft in MSFS, both MSFS2020 and MSFS2024. That is why you need to look into lvars, hvars, bvars, etc

That's why I'm surprised the in-sim bindings work, but sending the K events directly does not, but again, a question for Nick.

Posted

Stumped on the Input Event as Offset route.  Adding the Input Event as the Offset was easy enough, but I cannot get it to increment as I would expect it to.  Here is a screenshot of the console since it won't let me copy the text:

image.png.1e28f4493c4a0f47f3163507146ec0dc.png

This is what I have in my profile to add the Input Event Offset:

[InputEventOffsets]
0=BKSQ_MAGNETOCONTROLLER=F0xA0000

And here is the resulting button binding after trying to use the Float64 Offset Inc/1000

2=PA,7,Cx7C00A000,x00000001     -{offset float64 inc/1000, offset A000 (0.001000)}-

In this case, I copied the binding from my second attempt seen in the log, where I enter the parameter as 1 (which I want to increment by).  The first attempt had the parameter set to 1000 since it says it is going to divide by 1000 in both the Advanced Guide and the offset name itself.

The problem is that I cannot get it to increment by any sensible (to me) value.  I have tried all sorts of different values, trying to figure out how to convert floats to hex, etc., and I either get an increment value of 0, which seems to just set the MagnetoController back to 0, or some unholy large number which causes it to shoot all the way to the start position.

I need it to increment from 0.0 to 1.0, to 2.0, etc.

Posted
6 hours ago, jsmarko3 said:

Here is a screenshot of the console since it won't let me copy the text:

You can attach your FSUIPC7.log file, or copy the relevant text from there.

6 hours ago, jsmarko3 said:

[InputEventOffsets]
0=BKSQ_MAGNETOCONTROLLER=F0xA0000

And here is the resulting button binding after trying to use the Float64 Offset Inc/1000

2=PA,7,Cx7C00A000,x00000001     -{offset float64 inc/1000, offset A000 (0.001000)}-

But why are you using an 8-byte floating point number? Even though input events (and lvars) are always stored internally as 8-byte floats, they are often used as just integers, Booleans, etc. As this one has a fixed set of discrete values within the rang 0-255, you should add it as an unsigned byte (UB) and use  the Offset UByte Increment/Decrement controls (or Offset Byte Cyclic Increment/Decrement).
Always use the the type relating to how input events/lvars are used when adding to offsets, which is rarely a 64-bit float.

Note also you have an extra 0 - its A000 and not A0000.

Any further issues, please attach your log and ini files.

John

Posted
8 hours ago, John Dowson said:

Note also you have an extra 0 - its A000 and not A0000.

Whoops.  Thanks for the callout.

8 hours ago, John Dowson said:

But why are you using an 8-byte floating point number?

Sorry, first time using InputEvents, so I thought the fact that they were being called out as Float64s in the logging was significant despite the value being only 0-5.

I think my biggest holdup with the UBs was the limit; I saw the footnote in the advanced users guide but not any practical examples, but now I understand why when binding it through the UI it would add the /0 to my parameter and why the limit in the .ini file was saying 0 and why it failed to increment.

I can move the magnetos up and down at will.  I think I'm sorted, thanks again 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.