MSFS2020 NXI VNAV

Peer support for Air Manager desktop users

Moderators: russ, Ralph

Post Reply
Message
Author
kansas_plane
Posts: 12
Joined: Tue Dec 22, 2020 1:38 am

MSFS2020 NXI VNAV

#1 Post by kansas_plane »

Has anyone figured out how to to map the overlay for the VNAV G1000 button to the "new" NXI G1000?

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

Re: MSFS2020 NXI VNAV

#2 Post by Ralph »

You might be able to find the event in the developer menu.

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

Re: MSFS2020 NXI VNAV

#3 Post by Crunchmeister »

Yes, I got it working. It doesn't use an event, but rather, uses an LVAR

You need to read the current state of the LVAR via a subscription and toggle it appropriately. This is the code I came up with to do it. I'm not a lua expert by any means, and if someone has a more efficient method for doing this, I'll gladly take the input. But this works exactly as it's supposed to with the WOrking Title G1000 NXi. Just replace the code for the current VNAV button with this and it should work.

If you also use X-Plane, you may want to put the existing XP event call back in there. I removed it from my code as I don't personally use XP, so it was superfluous code for me.

Code: Select all

-- G1000 NXi VNAV

function vnv_state_callback(vnvval)
    VNAVState = vnvval
    return VNAVState
end
fs2020_variable_subscribe("L:XMLVAR_VNAVButtonValue", "number", vnv_state_callback)

function vnv_click()
    if VNAVState == 1 then
      fs2020_variable_write("L:XMLVAR_VNAVButtonValue", "Number", 0)
    else
      fs2020_variable_write("L:XMLVAR_VNAVButtonValue", "Number", 1)
    end
    sound_play(click_snd)
end

button_vnv = button_add(nil,"vnv_button.png", 98,570,54,32, vnv_click)
visible(button_vnv, user_prop_get(bezel_prop))
-- END G1000 NXi VNAV

I struggled with this initially as I was using boolean and it didn't work. Then I spoke with Matt from WT over on their Discord and he told me it was a 1 or 0 NUMERICAL value instead of a boolean type. Switched from Bool to Number as a variable type and it started working. That doesn't make sense to me as to why it would be done this way for an on/off thing, but then again, not much about MSFS seems to make sense when you look under the hood.
- Ryzen 5950x, 64GB 3600MHz RAM, RTX3070Ti

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

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: MSFS2020 NXI VNAV

#4 Post by Keith Baxter »

Hi,

@Corjan
Similar issues keep popping up. A helpful debug tool might be something along the lines of a print() statement in code. Maybe subscribe_type(). Something to determine the dataref/event type and value expected. Also if in fact the dataref/event is recognized by the sim.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

Post Reply