• 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.

Xml gauge limits in FSX

Messages
300
Country
unitedkingdom
Hi all,

I have been working on replacing existing xml gauge mouse clicks with Lvars so that they can be operated with external switches. In particular I am modelling a Garmin GCU477 which has a number/keypad to input flight plan data.

I had the keypad and number pad working fine, then I upgraded my aircraft (Carenado Phenom 300) which added a full navigation database. This update came with new gauges which meant that i needed to update my code as the macros were different.

The problem have is this....I started adding my code to the new gauge by starting on the letters of the keypad. I put in the code for the letter "A" then tested it to make sure it worked. It did.

Then i added more letters. All was well until I got to the letter "E" then my FSX wouldn't startup due to lack of virtual memory(the dreaded out of memory error).

My code sits in a new loop which i put into the existing VC gauge.

What is causing this when it worked before the aircraft update? Is there a size limit on xml gauges?
Would the update have brought FSX close to its virtual memory limit?

Is there a way i can get around this problem?

Would including my code into one of the gauges existing update loops make a difference?
Would it be better to create a new gauge with my code in and if so would i also have to put the macros in my gauge or would it cross reference to the macros in the carenado gauge?

Sorry, lots of questions there!

Thanks for looking
Stinger

Sent from my SM-T813 using Tapatalk
Code:
<Update id="GCU477">
     <Script>
       (L:GCU477_A,bool) 1 == if{ @G1000INPUT(65) 0 (>L:GCU477_A,bool) }
       (L:GCU477_B,bool) 1 == if{ @G1000INPUT(66) 0 (>L:GCU477_B,bool) }
       (L:GCU477_C,bool) 1 == if{ @G1000INPUT(67) 0 (>L:GCU477_C,bool) }
       (L:GCU477_D,bool) 1 == if{ @G1000INPUT(68) 0 (>L:GCU477_D,bool) }
       (L:GCU477_E,bool) 1 == if{ @G1000INPUT(69) 0 (>L:GCU477_E,bool) }
     </Script>
</Update>
 
Last edited:

taguilo

Resource contributor
Messages
1,585
Country
argentina
Hi,
You’ve reached a limit in the size of the <Update> script.
Just split the macros in different <Element> scripts and it will work fine.

Tom
 
Messages
300
Country
unitedkingdom
Hi,
You’ve reached a limit in the size of the script.
Just split the macros in different scripts and it will work fine.

Tom
Mmmm, not sure i understand (xml noob). Doesn't each letter call the same macro (G1000INPUT) ? So i'm not sure what you nean by splitting it into Elements?

Stinger

Sent from my SM-T813 using Tapatalk
 

=rk=

Resource contributor
Messages
4,450
Country
us-washington
To me, the message implies
XML:
<Update id="GCU477">
     <Script>
       (L:GCU477_A,bool) 1 == if{ @G1000INPUT(65) 0 (>L:GCU477_A,bool) }
     </Script>
     <Script>
       (L:GCU477_B,bool) 1 == if{ @G1000INPUT(66) 0 (>L:GCU477_B,bool) }
     </Script>
     <Script>
       (L:GCU477_C,bool) 1 == if{ @G1000INPUT(67) 0 (>L:GCU477_C,bool) }
     </Script>
     <Script>
       (L:GCU477_D,bool) 1 == if{ @G1000INPUT(68) 0 (>L:GCU477_D,bool) }
     </Script>
     <Script>
       (L:GCU477_E,bool) 1 == if{ @G1000INPUT(69) 0 (>L:GCU477_E,bool) }
     </Script>
</Update>
will work.
 
Messages
300
Country
unitedkingdom
To me, the message implies
XML:
will work.
Ah, i see what you mean now, thanks. I wasn't aware that one could have more than one script within an Update loop.

I will give it a try

Much appreciated
Thank you all
Stinger

Sent from my SM-T813 using Tapatalk
 

tgibson

Resource contributor
Messages
11,327
Country
us-california
If this doesn't work (and I'm not sure it will), Tom was saying you instead need to move at least some of the code from the Update section to their own Elements, outside any Update section:

Code:
<Element">
     <Script>
       (L:GCU477_A,bool) 1 == if{ @G1000INPUT(65) 0 (>L:GCU477_A,bool) }
     </Script>
</Element>

If the Script command does not work inside an Element (I've never tried that) a workaround is:

Code:
<Element>
     <Select>
           <Value>
                 (L:GCU477_A,bool) 1 == if{ @G1000INPUT(65) 0 (>L:GCU477_A,bool) }
           </Value>
     </Select>
</Element>

Hope this helps,
 
Messages
300
Country
unitedkingdom
If this doesn't work (and I'm not sure it will), Tom was saying you instead need to move at least some of the code from the Update section to their own Elements, outside any Update section:

Code:

If the Script command does not work inside an Element (I've never tried that) a workaround is:

Code:
(L:GCU477_A,bool) 1 == if{ @G1000INPUT(65) 0 (>L:GCU477_A,bool) }

Hope this helps,
Thanks. Are Element sections continually checked for Lvar changes in the same way that Update loops are?


Cheers
Stinger

Sent from my SM-T813 using Tapatalk
 

tgibson

Resource contributor
Messages
11,327
Country
us-california
Yes. The major difference is that you cannot set an update interval in Elements. AFAIK they run at 18 times a second.
 

Heretic

Resource contributor
Messages
6,830
Country
germany
Element-Select-Value is the only way to go. Element-Script will not work.
 
Messages
300
Country
unitedkingdom
Element-Select-Value is the only way to go. Element-Script will not work.
Hi,

Would you mind giving me a short example of the structure with this method please? Perhaps using the first line of my code.

Thanks
Stinger

Sent from my SM-T813 using Tapatalk
 
Messages
300
Country
unitedkingdom
Element-Select-Value is the only way to go. Element-Script will not work.

Ok,
so I tried this but it although the sim started up fine the code doesn't work in as much as
if I trigger the Lvar externally the code does not enter the letter A. (It does if i enclose the
same code in an <Update> <script>

cheers
Stinger

Heres the code I tried......
Code:
<Element id="GCU477">
     <Select>
      <Value>
       (L:GCU477_A,bool) 1 == if{ @G1000INPUT(65) 0 (>L:GCU477_A,bool) }
      </Value>
     </Select>
</Element>
 
Messages
1,564
Country
thailand
Hi Keith,

The Lua script you wrote to interface with your gcu 477 hardware, it returns the ascii code number for each key pressed, isn't that right?

So, if I correctly understand how you have set up your gcu 477, then please try the recommendation by Roman found in this thread. This will eliminate the Update size limit issue and enable you to keep it within the Update section rather than needing to use Elements.

Something like this:

XML:
<Update id="GCU477">
    <Script>
        (L:GCU477_Key, enum) 0 != if{ @G1000INPUT(L:GCU477_Key, enum) 0 (>L:GCU477_Key, enum) }
    </Script>
</Update>


where (L:GCU477_Key, enum) is the Lua script result of the gcu477 keypad press, e.g., when you press "A", the lua script yields (L:GCU477_Key, enum) = 65. That's all the code you need in the Update section.

Earlier, you questioned, "Doesn't each letter call the same macro (G1000INPUT) ? " Note that XML macros aren't functions or routines that are called by the xml script. Rather, they are a form of 'shorthand', designed to allow you to shortcut the need to type identical blocks of script over and over in the same gauge.

When the gauge loads, the xml parser copies all of the lines of the G1000INPUT macro and pastes it everywhere it finds @G1000INPUT in your gauge, whether it be in an Update section, of Element, or Mouse, or Key section. That's how your Update quickly gets large enough to exceed the Update size limit.

Hope this helps,

Bob
 
Messages
300
Country
unitedkingdom
Hi Keith,

The Lua script you wrote to interface with your gcu 477 hardware, it returns the ascii code number for each key pressed, isn't that right?

So, if I correctly understand how you have set up your gcu 477, then please try the recommendation by Roman found in this thread. This will eliminate the Update size limit issue and enable you to keep it within the Update section rather than needing to use Elements.

Something like this:

XML:


where (L:GCU477_Key, enum) is the Lua script result of the gcu477 keypad press, e.g., when you press "A", the lua script yields (L:GCU477_Key, enum) = 65. That's all the code you need in the Update section.

Earlier, you questioned, "Doesn't each letter call the same macro (G1000INPUT) ? " Note that XML macros aren't functions or routines that are called by the xml script. Rather, they are a form of 'shorthand', designed to allow you to shortcut the need to type identical blocks of script over and over in the same gauge.

When the gauge loads, the xml parser copies all of the lines of the G1000INPUT macro and pastes it everywhere it finds @G1000INPUT in your gauge, whether it be in an Update section, of Element, or Mouse, or Key section. That's how your Update quickly gets large enough to exceed the Update size limit.

Hope this helps,

Bob
Thanks for that great explanation Bob. It entirely makes sense. I will try it out and report back.

Regards
Stinger

Sent from my SM-G935F using Tapatalk
 
Messages
300
Country
unitedkingdom
Mmm, i tried your suggestion Bob without success. Although i will look further into the idea as it seems the way to go. I had been trying to think of a way to get more of of the work done on the fsuipc/LINDA side of things.

Cheers
Stinger

Sent from my SM-G935F using Tapatalk
 
Messages
300
Country
unitedkingdom
Hi all,

I am getting close but could do with further help please.

The attached image shows my xml Update script and also my Lua functions
for the letters. At the moment when I key in the letter A or B or C etc I see the
letter "A" appear in my flightplan window as expected as I have as a test put the number 65 in
my script. If however I replace the (65) in my script with (L:GCU477_Key, enum) i hear the sound
of the button being pressed (i.e it is calling part of the macro) but no letter appears in my flightplan
window.

Any thoughts appreciated.

regards
Stinger

Script.jpg
 
Messages
440
Country
us-wisconsin
Try the following for possibilities in the xml gauge script -
IIRC registers can be used in a macro call but a l:var cannot.
If an l:var can (??), make sure you have the proper amount of parentheses.
XML:
<Update id="GCU477">
      <Script>
            (L:GCU477_key, enum) s1 0 != if{ @G1000INPUT(l1) 0 (>L:GCU477_key, enum) }
      </Script>
</Update>
- OR -
XML:
<Update id="GCU477">
      <Script>
            (L:GCU477_key, enum) 0 != if{ @G1000INPUT((L:GCU477_key, enum)) 0 (>L:GCU477_key, enum) }
      </Script>
</Update>
 
Messages
1,564
Country
thailand
If an l:var can (??), make sure you have the proper amount of parentheses.
L:Vars work for me, as do single parentheses if only one argument is used. Double sets if there is more than one argument. Same for FSX and FS9 xml schema.
 
Last edited:
Messages
300
Country
unitedkingdom
Try the following for possibilities in the xml gauge script -
IIRC registers can be used in a macro call but a l:var cannot.
If an l:var can (??), make sure you have the proper amount of parentheses.
XML:
<Update id="GCU477">
      <Script>
            (L:GCU477_key, enum) s1 0 != if{ @G1000INPUT(l1) 0 (>L:GCU477_key, enum) }
      </Script>
</Update>
- OR -
XML:
<Update id="GCU477">
      <Script>
            (L:GCU477_key, enum) 0 != if{ @G1000INPUT((L:GCU477_key, enum)) 0 (>L:GCU477_key, enum) }
      </Script>
</Update>

Many thanks. The second option did the trick, using double parentheses. Annoyingly I had experimented with different
positions for the parentheses but I hadn't thought of doubling up around the Lvar.

You are a star Sir!
thanks again
Stinger
 

taguilo

Resource contributor
Messages
1,585
Country
argentina
L:Vars work for me, as do single parentheses if only one argument is used. Double sets if there is more than one argument. Same for FSX and FS9 xml schema.

Macro call parameters are simply text scripts. What those scripts contain depend exclusively on how that text is "received" and interpreted in the macro itself.
We can pass any script as a parameter providing it does not contain a comma, as it is used as a separator between parameters - MacroCall(Param1,Param2, etc) -

For Example
Code:
<Macro Name="MacroCall1"> 5 @1 + (>L:MyVar,number)</Macro>

<Script> 30 sp1 MacroCall1(l1)<Script>
<Script> MacroCall1(30)<Script>
<Script> MacroCall1(10 10 + 10 +)<Script>
<Script>30 (>L:Var1,number)  MacroCall1((L:Var1,number))<Script>

All three assign same result  (35) to  (L:MyVar,number)

<Macro Name="MacroCall2"> 5 @1 + (>L:@2,number)</Macro>

<Script>MacroCall2(30,MyVar)<Script>  also assigns 35 to  (L:MyVar,number)

Tom
 
Top