Can’t seem to subscribe to a certain LVAR

Peer support for Air Manager desktop users

Moderators: russ, Ralph

Message
Author
SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: Can’t seem to subscribe to a certain LVAR

#11 Post by SimPassion »

Sling wrote: Wed Mar 22, 2023 1:29 am Yes the sim uses 0 or 1 as it’s Boolean states.
What I meant, was : the solution is we have to read them as numeral not boolean and it works

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Can’t seem to subscribe to a certain LVAR

#12 Post by Sling »

SimPassion wrote: Wed Mar 22, 2023 10:30 am
Sling wrote: Wed Mar 22, 2023 1:29 am Yes the sim uses 0 or 1 as it’s Boolean states.
What I meant, was : the solution is we have to read them as numeral not boolean and it works
I know that. It’s why i said use Enum or number. What I meant was It would be nice if AM did that for us. We just use type Bool and if it’s MSFS AM would translate that to/from 0 or 1. It matters not a lot to me but I can see how it trips people up as was the case here.

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: Can’t seem to subscribe to a certain LVAR

#13 Post by SimPassion »

Sling wrote: Wed Mar 22, 2023 12:31 pm
SimPassion wrote: Wed Mar 22, 2023 10:30 am
Sling wrote: Wed Mar 22, 2023 1:29 am Yes the sim uses 0 or 1 as it’s Boolean states.
What I meant, was : the solution is we have to read them as numeral not boolean and it works
I know that. It’s why i said use Enum or number. What I meant was It would be nice if AM did that for us. We just use type Bool and if it’s MSFS AM would translate that to/from 0 or 1. It matters not a lot to me but I can see how it trips people up as was the case here.
+1
Agree, I think AM is able to know or predict variable types better than ourselves, so this feature would become handy 👍

User avatar
Ralph
Posts: 7876
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Can’t seem to subscribe to a certain LVAR

#14 Post by Ralph »

How should AM know that it is a boolean? You can subscribe as a boolean, but what if it returns 10 for example?

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: Can’t seem to subscribe to a certain LVAR

#15 Post by SimPassion »

Ralph wrote: Wed Mar 22, 2023 1:07 pm How should AM know that it is a boolean? You can subscribe as a boolean, but what if it returns 10 for example?
So AM switch automatically to numeral in such case and still forward value to user instrument

User avatar
Ralph
Posts: 7876
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Can’t seem to subscribe to a certain LVAR

#16 Post by Ralph »

That would be very confusing, since in Lua you subscribed to a boolean. And then you'll still be getting a double? :?

SimPassion
Posts: 5336
Joined: Thu Jul 27, 2017 12:22 am

Re: Can’t seem to subscribe to a certain LVAR

#17 Post by SimPassion »

Ralph wrote: Wed Mar 22, 2023 1:46 pm That would be very confusing, since in Lua you subscribed to a boolean. And then you'll still be getting a double? :?
Would requires a new "unknown" or "uncertain" variable type, or something like this.
This is not for me, just a suggestion to help and avoid simmers wondering on not having values on subscribe ...

User avatar
Crunchmeister
Posts: 222
Joined: Tue Aug 10, 2021 2:06 pm

Re: Can’t seem to subscribe to a certain LVAR

#18 Post by Crunchmeister »

I've found Number or Enum will typically work for "boolean" lvars. Never encountered one that required a double as of yet though. I'd prefer if I could use a bool as a bool, but in the end, as long as it works, I'm good. It's not a huge workaround.
- Ryzen 5950x, 64GB 3600MHz RAM, RTX3070Ti

Simstrumentation Instrument dev
Free Air Manager instruments for MSFS available at http://www.simstrumentation.com

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Can’t seem to subscribe to a certain LVAR

#19 Post by Sling »

Ralph wrote: Wed Mar 22, 2023 1:07 pm How should AM know that it is a boolean? You can subscribe as a boolean, but what if it returns 10 for example?
You tell it in the subscribe or the write. If it’s got the possibility to return 10 then it isn’t a Boolean and clearly another type should be used. It’s the same as subscribing to an Avar really. If it’s not a Bool then using Bool will not work. You still have to use the correct type as always.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Can’t seem to subscribe to a certain LVAR

#20 Post by jph »

Sling wrote: Wed Mar 22, 2023 9:24 pm
Ralph wrote: Wed Mar 22, 2023 1:07 pm How should AM know that it is a boolean? You can subscribe as a boolean, but what if it returns 10 for example?
You tell it in the subscribe or the write. If it’s got the possibility to return 10 then it isn’t a Boolean and clearly another type should be used. It’s the same as subscribing to an Avar really. If it’s not a Bool then using Bool will not work. You still have to use the correct type as always.
:? that wasn't what was asked.....
Joe. CISSP, MSc.

Post Reply