• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FS2004 Controlling L:Vars by key?

Heretic

Resource contributor
Messages
6,830
Country
germany
Since the default spoiler keys are deliberately broken in my B737-200, I can only control the spoilers by dragging the levers.
Having an additional possibility to control the spoiler lever by keys might be a plus for users and this post implies that it can be done.

Hence:

1) Are there any other hindrances (apart from finding a key combination not already in use) and/or caveats?

2) What is the best method to obtain the key code used in EduHir's example above?

3) Can I use this for 3D model and 2D panel code alike?
 
Last edited:
No, I am not looking for a gauge, I am only looking for more information on assigning key bindings to L: vars.
 
Huuuch,

in former days i looked into gauges to learn and understand XML- programming.
Sometimes i also do it in nowadays!

Everthing is explained in the gauge.

Otherwise look into the avsim - form.
Rob Barentregt did some very nice interesting explanations.

How was it said: 90 percent can be found in forums!
 
By Mr. Rob B.

Years ago!

The old avsim - links don't work!

With a little educated guessing, I found the answer to my
question: "How to trap Shifted/Controlled keystrokes in
XML"

I discovered, that instead of using:

<On Key="Z">...</On>

FS also accepts

<On Key="90">...</On>

with '90' being the Windows keycode for the 'Z' key.

Now, since keycodes are ranging from 0-255, I wondered how MS
would internally store the value for shift/control sequences.
I took an educated guess, by adding multiples of 256 to the
keycode; and behold: IT WORKED !!

Iow:

- <On Key="90">...</On> traps "Z"

- <On Key="346">...</On> traps "Shift-Z" 256 + 90 = 346

- <On Key="602">...</On> traps "Control-Z" 512 + 90 = 602

- <On Key="858">...</On> traps "Shift-Control-Z" 768 + 90 = 858

FYI: A list of all Windows keycodes can o.a. be found in
Peter Dowson's FSUIPC Userguide. An extract of that info is
attached to this post..

---------------------------------------------------------------------------------------------------

<!-- Crtl plus Key Left arrow 512 plus 37 -->
<On Key="549">
(&gt;K:VOR1_OBI_DEC,degree)
</On>

<!-- Crtl plus Key Right arrow 512 plus 39-->
<On Key="551">
(&gt;K:VOR1_OBI_INC,degree)
</On>

---------------------------------------------------------------------------------------------------


<On Event="AXIS_ELEVATOR_SET">
(L:Flight Controls Press Avail, bool) !
if{
(L:Elevator Deflection, percent) 163.83 /-/ * (>K:ELEVATOR_SET)
}
els{
(A:Elevator Position, percent) (>L:Elevator Deflection, percent)
}
</On>


Will let you move the elevators free as long as you have hyd press.
When you have none, it freezes in the last known position.
This is a basic example, but indeed very powerful.

-------------------------------------------------------------------------------------------------

<Keys>
<On Key="AlphaNumeric">
<Visible>10 19 (C:fs9gps:enteringInput) rng 31
(C:fs9gps:enteringInput) == or</Visible>

(M:Key) chr (>C:fs9gps:IcaoSearchEnterChar) @InitBlinker
</On>

<On Key="Ascii">
<Visible>110 119 (C:fs9gps:enteringInput) rng 131
(C:fs9gps:enteringInput) == or</Visible>
(M:Key) chr (>C:fs9gps:NameSearchEnterChar) @InitBlinker
</On>

<On Key="Backspace">
<Visible>(C:fs9gps:enteringInput)</Visible>
10 19 (C:fs9gps:enteringInput) rng 31
(C:fs9gps:enteringInput) ==
||
if{
-1 (>C:fs9gps:IcaoSearchBackupChar) @InitBlinker quit
}
110 119 (C:fs9gps:enteringInput) rng 131
(C:fs9gps:enteringInput) ==
||
if{
-1 (>C:fs9gps:NameSearchBackupChar) @InitBlinker quit
}
</On>
</Keys>


--------------------------------------------------------------------------------------------------------

I tested this one and it works, only full screen.
Panel, ID-400, always visible.

<Keys>
<On Event="VIEW_MODE">
400 (>K:PANEL_ID_OPEN)
</On>
<On Event="VIEW_MODE_REV">
400 (>K:PANEL_ID_OPEN)
</On>
</Keys>
 
Just found the ASCII-code.

The following list was originally compiled by Rob Barendregt
Original source from Pete Dowson


8 Backspace
12 NumPad 5 (NumLock OFF)
13 Enter
19 Pause
32 Space bar
33 Page Up
34 Page Down
35 End
36 Home
37 Left arrow
38 Up arrow
39 Right arrow
40 Down arrow
45 Insert
46 Delete
48 0 on main keyboard
49 1 on main keyboard
50 2 on main keyboard
51 3 on main keyboard
52 4 on main keyboard
53 5 on main keyboard
54 6 on main keyboard
55 7 on main keyboard
56 8 on main keyboard
57 9 on main keyboard
65 A
66 B
67 C
68 D
69 E
70 F
71 G
72 H
73 I
74 J
75 K
76 L
77 M
78 N
79 O
80 P
81 Q
82 R
83 S
84 T
85 U
86 V
87 W
88 X
89 Y
90 Z
96 NumPad 0 (NumLock ON)
97 NumPad 1 (NumLock ON)
98 NumPad 2 (NumLock ON)
99 NumPad 3 (NumLock ON)
100 NumPad 4 (NumLock ON)
101 NumPad 5 (NumLock ON)
102 NumPad 6 (NumLock ON)
103 NumPad 7 (NumLock ON)
104 NumPad 8 (NumLock ON)
105 NumPad 9 (NumLock ON)
106 NumPad *
107 NumPad +
109 NumPad -
110 NumPad .
111 NumPad /
112 F1
113 F2
114 F3
115 F4
116 F5
117 F6
118 F7
119 F8
120 F9
121 F10
122 F11
123 F12
135 NumPad Enter
144 NumLock
145 ScrollLock
186 ; : Key*
187 = + Key*
188 , < Key*
189 - _ Key*
190 . > Key*
191 / ? Key*
192 # ~ Key*
219 [ { Key*
220 \ | Key*
221 ] } Key*
222 ' @ Key*
223 ` ¦ Key*


* The following keys are keyboard dependant:

223 ` ¦ is top left, just left of the main keyboard 1 key
189 - _ is also in the top row, just to the right of the 0 key
187 = + is to the right of 189
219 [{ is in the 2nd row down, to the right of the alpha keys.
221 ]} is to the right of 219
186 ; : is in the 3rd row down, to the right of the alpha keys.
222 ' @ is to the right of 186
192 # ~ is to the right of 222 (tucked in with the Enter key)
220 \ | is in the 4th row down, to the left of all the alpha keys
188 , < is also in the 4th row down, to the right of the alpha keys
190 . > is to the right of 188
191 / ? is to the right of 190



Another example by Rob B.

Yes and No :-)

As said above, the VC-View is coded in the model and cannot
be omitted from the view cycle sequence on a per-aircraft
basis.

But if you add a little xml gauge with the contents below to
the panel.cfg: when the VC view is detected, the gauge
automatically selects the next view in the cycle (depending
if you use cycle view forward or backward).


<Gauge Name="VCViewSkip"
Version="1.0">
<Keys>
<On Event="VIEW_MODE">
1 (&gt;G:Var1)
</On>
<On Event="VIEW_MODE_REV">
0 (&gt;G:Var1)
</On>
</Keys>
<Element>
<Select>
<Value>
(P:ACTIVE VIEW MODE,enum) 2 ==
if{
(G:Var1)
if{ (&gt;K:VIEW_MODE) }
els{ (&gt;K:VIEW_MODE_REV) }
}
</Value>
</Select>
</Element>
</Gauge>

Cheers, Rob Barendregt

Oh, sorry, that's an event and not key!
But nevertheless it was very interessting in the younger days.
 
Last edited:
Panel.cfg:
Place it somewhere on-screen (preferably at x,y = 1,1) with a size of 1,1.
Preferably in the [VCockpit01] section to have it constantly running.


Gauge:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<Gauge Name="Control Spoilers By Key" Version="1.0">
  <Keys>
    <On Key="374">
    <!-- Shift + F7 -->
    (L:SPOILER LEVER,number) 13 &lt;
    if{ 13 (&gt;L:SPOILER LEVER,number) }
    els{ (L:SPOILER LEVER,number) 5 + 100 min (&gt;L:SPOILER LEVER,number) }
    </On>
    <On Key="373">
    <!-- Shift + F6 -->
    (L:SPOILER LEVER,number) 5 - 0 max (&gt;L:SPOILER LEVER,number)
    </On>
    <On Key="372">
    <!-- Shift + F5 -->
    0 (&gt;L:SPOILER LEVER,number)
    </On>
    <On Key="375">
    <!-- Shift + F8 -->
    100 (&gt;L:SPOILER LEVER,number)
    </On>
  </Keys>
</Gauge>

Shift+F7 moves the lever to the "Armed" position befoe you can freely move it, hence the weird value.
 
Back
Top