Author Topic: MSFS 2020 Default Cockpit View /VA Commands  (Read 2865 times)

mje01

  • Newbie
  • *
  • Posts: 2
MSFS 2020 Default Cockpit View /VA Commands
« on: April 10, 2021, 09:27:56 AM »
Hi, Apologies to Mods and others, if this topic has been dealt with in the past, in which case a gentle steer in the direction of the relevant discussion would be much appreciated.
Also, as a new user of VA, please forgive me if my query has a very obvious solution.
I have created 9 custom cockpit views views in MSFS 2020, assigned to the NumPad keys 1-9 (0 is a default view).
And in VA I have created, commands to "voice call" the views and commands to interact interact with the instruments in each of the views.
My problem arises if and when a second "call" is made for the same view, either directly via the keyboard or via a VA command,the view reverts to default immediately (a subsequent keyboard or VA "call" will return the targeted view and another similar "call" will revert to default view and so it would go on). I have tried to correct this by setting a small integer variable on the first call and testing with a "Begin Compare " statement for any subsequent call, without success. I have also tried using "~" and ">" to change the scope of the small integer variable to no avail.
Your help would be much appreciated.
Regards,
mje01

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4785
  • RTFM
Re: MSFS 2020 Default Cockpit View /VA Commands
« Reply #1 on: April 10, 2021, 09:41:45 AM »
Would the key be pressed and released to switch to a given view, or held down?

In case of the former, you could use the "Device State" tab to check whether the key is still pressed.

In case of the latter, using a variable to keep track of the currently selected view would be an option, and can work when set up correctly.


Have you read the documentation on the features you've mentioned? The command scope, denoted by the "~" prefix, would not apply if the intent is to make a variable available to other commands, which it is by default.

These topics may be of use in addition to the official documentation:
Control flow (If, Else, ElseIf, Loop, Jump) basics
Variables and tokens summed up

As mentioned in the second topic, the Integer datatype would be most suitable to this application, given that the Small Integer datatype is essentially deprecated.


A basic setup could look something like
When I say: View 1
Code: [Select]
Begin Integer Compare : [currentView] Does Not Equal 1
    Press NumPad 1 key and hold for 0.1 seconds and release
    Set integer [currentView] value to 1
End Condition

Where each of your view commands (assuming they are separate) would contain the same actions, but with the numbers and key changed appropriately.

If preferred, a message could also be added to notify of a repeat call to the same view, E.G.
Code: [Select]
Begin Integer Compare : [currentView] Does Not Equal 1
    Press NumPad 1 key and hold for 0.1 seconds and release
    Set integer [currentView] value to 1
Else
    Say, 'View is already selected'
End Condition

mje01

  • Newbie
  • *
  • Posts: 2
Re: MSFS 2020 Default Cockpit View /VA Commands
« Reply #2 on: April 10, 2021, 11:35:25 AM »
Hi Pfeil,
Thank you for the very prompt response and thank you for the suggestions.
To answer your question (and please forgive me if I'm getting the "wrong end of the stick") the actual NumPad key is pressed and released immediately (there isn't a requirement in MSFS 2020 to hold the key down, as far as I'm aware although having said that, I believe the suggested method of calling the custom cockpit view is Left Alt + Numpad key. -  I opted for the simpler(?) single (NumPad) key option.
I will print off and study your response in more depth, but at first glance I dont think I'm too far removed from your suggestion, my use of the small integer variable notwithstanding.
Again many thanks for your assistance and I will report back on my progress.
Kind regards,
mje01