• 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 Script syntax

Messages
1,564
Country
thailand
<Position X="150" Y="10"/>

I would like to control the position of an element using a L:Var. What is the proper script syntax to substitute "150" and "10" with L:Vars?

I would normally dig around and experiment more before asking, but seems 2014 is starting out a bit lazy. Apologies :o

Thanks in advance

Bob
 
Bob,

Simply answer: you can't :(

But you could try using <Shift X> and <Shift Y> to displace an image from its fixed-defined position according to certain conditions.

Tom
 
Bob,

Happy New Year to you ! Here is a blank template you can use. This is for moving in both the X and Y axis. If you are only moving in one axis remove the complete other <Shift> section.

I do not remember, but I do believe if using 2 <Shift> sections per <Element> you cannot use a <Nonlinearity> table to replace the <Scale> section. Using only one <Shift> you can..

Roman

Code:
<Element Name="">
<Image Name="">
   <Axis X="" Y=""/> <!-- The AXIS of the image where movement is applied -->
</Image>
<Shift>
   <Value Minimum="" Maximum="">(LVARRESULT, Y)</Value>
   <Scale Y=""/> <!-- L:Var*This number = pixel movement -->
   <Delay PixelsPerSecond=""/> <!-- If necessary -->
   <!--
      <Failures>
          Failures for the Y Movement, if necessary
      </Failures>
   -->
</Shift>
<Shift>
   <Value Minimum="" Maximum="">(LVARRESULT, X)</Value>
   <Scale X=""/> <!-- L:Var*This number = pixel movement -->
   <Delay PixelsPerSecond=""/> <!-- If necessary -->
   <!--
      <Failures>
          Failures for the X Movement, if necessary
      </Failures>
   -->
</Shift>
</Element>


<! -- OPTION - replace the complete <Scale> entry with this (and more "<Item Vlues" if needed) if non-linearity is needed. In this case it will move along the Y axis.
 
<Nonlinearity>
   <Item Value="" X="0" Y=""/>
   <Item Value="" X="0" Y=""/>
   <Item Value="" X="0" Y=""/>
</Nonlinearity>

-->
 
Thanks Tom and Roman,

I must be thinking about something else.

I know about Shift and I use it a lot in my map work, for example, the TCAS display. The issue I'm working at present is a CustomDraw Approach popup where CenterX and Y are the equivalent.

Actually, I had always thought what I asked could not be done, as Tom advises, but I could swear I remember seeing someone use a script substitution to enable use of a variable in a X="150" Y="10" type structure, which would have other uses besides X=" " and Y=" " (e.g., Width, Height, etc).

Obviously I'm wrong and now I wonder what I was thinking about. Probably in an old thread of mine in this forum. I need to dig deeper.

Sawasdee pee mai,

Bob
 
Here is what I was thinking about.

First of all, to better explain my topic, this has to do with replacing a value inside double quotes with a variable rather than a fixed value.

My example deals with strings, not numbers, so I need to test this further with X=" " and Y=" " and other parameters.

Depending upon the numerical value of XMLVar Intruder_Symbol_0, Color=" " is either Color="#111111", Color="gold", or Color="red". This replaces a static string value inside double quotes like Color="#FF00FF" by a variable, which is my goal.

Code:
[COLOR="Blue"]<Polyline[/COLOR] [COLOR="Red"]Color[/COLOR]=[COLOR="DarkOrchid"]"%(4 8 'Intruder_Symbol_0' @FIRString rng 
if{ '#111111' } 'Intruder_Symbol_0' @FIRString 16 == 
if{ 'gold' } 'Intruder_Symbol_0' @FIRString 32 == 
if{ 'red' }"[/COLOR] 
[COLOR="Red"]LineWidth[/COLOR]=[COLOR="DarkOrchid"]"1.25"[/COLOR] [COLOR="Red"]Bright[/COLOR]=[COLOR="DarkOrchid"]"Yes"[/COLOR][COLOR="Blue"]>[/COLOR]

I need to test for myself of course. Maybe it depends upon the specific parameter? Do you think it would work for X=" " Y=" " ???

Bob

By the way, @FIRString is a macro using Tom's XMLVars (Find Index Read String)

Code:
<Macro Name="FIRString">(>C:XMLVARS:SearchVarName, string) (C:XMLVARS:StringValue, string)</Macro>
 
Last edited:
Bob,

I have never been able to get any variable to work in a X=""/Y="" attribute for anything. Colors OTH are available but the only ways I've been able to get them to work is by using the simple if/else operator "?" or by using "case". I have never been able to get if{ } els{} to work when sending strings in an expression to replace a Color="" string. Ex. ( all this in FS9 schema & tested, FSX schema may work differently, including headaches LOL! )

simple macro call
Code:
<Macro Name="RED">%('0x00006f' '0x00007b' '0x000087' '0x000093' '0x00009f' '0x0000ab' '0x0000b7' '0x0000c3' '0x0000cf' '0x0000db' '0x0000e7' '0x0000f3' '0x0000ff' '0x0c0cff' '0x1818ff' '0x2424ff' '0x3030ff' '0x3c3cff' 18 (L:LCOSS_RET, number) case)</Macro>

<Polyline LineWidth="7" Color="@RED" Bright="Yes">

complex if/else (?) with a case included as macro
Code:
<Macro Name="GREEN">%('0x006f00' '0x007b00' '0x008700' '0x009300' '0x009f00' '0x00ab00' '0x00b700' '0x00c300' '0x00cf00' '0x00db00' '0x00e700' '0x00f300' '0x00ff00' '0x0cff0c'  14 (L:LCOSS_CMD, number) case)</Macro>
 
<Polyline LineWidth="8" Color="%(@GREEN '0x000000' (L:AP_FD_ROLL, number) 200 != ? )%{end}%" Bright="Yes">

So, to do your example, maybe something like ?? (Not tested)
Code:
<Gauge>
.. 
<Macro Name="Color">'red' 'gold' '#111111'  14 @1 case)</Macro>
<Macro Name="FIRString">(>C:XMLVARS:SearchVarName, string) (C:XMLVARS:StringValue, string)</Macro>
.. 
<Update>
 4 8 'Intruder_Symbol_0' @FIRString rng if{ 0 sp29 }
 'Intruder_Symbol_0' @FIRString 16 == if{ 1 sp29 } 
'Intruder_Symbol_0' @FIRString 32 == if{ 2 sp29 }
</Update>
..
<Polyline Color="@Color(l29)" LineWidth="1.25" Bright="Yes">
..
</Gauge>

Hope this helps,
Roman
 
Thanks, Roman,

I guess you're right about X="", Y="" though I have not yet tested the approach I posted above with those.

For colors (strings), at least, the code I posted above works fine - it's from one of my own gauges. I knew I had seen it somewhere ... how quickly I forget :o

But, your macro plus case example might be simpler than the code I ended up with. I will revise my gauge ... thanks

Thanks again,

Bob
 
Last edited:
rpmc;658233 I need to test for myself of course. [B said:
Maybe it depends upon the specific parameter? Do you think it would work for X=" " Y=" " ???[/B]

Bob,

Position and size of an element are fixed-defined when it is instantiated, before its own XML scripts are instantiated, so is my guess the reason they can't be manipulated by those scripts. Other child properties, like Color, work fine though.

Tom

BTW, you are comparing:

'Intruder_Symbol_0' @FIRString 16 ==

but @FIRString is actually returning a string; is that working fine?
 
Last edited:
Position and size of an element are fixed-defined when it is instantiated, before its own XML scripts are instantiated, so is my guess the reason they can't be manipulated by those scripts. Other child properties, like Color, work fine though.

Tom, thanks. Now I understand.

but @FIRString is actually returning a string; is that working fine?

Yes, it's working fine. Even though I should stick with XMLVar numbers when dealing with numbers, things like

<Value>'Intruder_GaugeX_0' @FIRString</Value>

are ok. In fact, I think it was you that told me some time ago that string would still be fine when expecting a number.

But, point taken. My XML Q/C isn't always thorough enough.

Bob
 
Last edited:
I should really change the title of this thread - would be helpful in later searches. Possible?
 
Re: Off topic of thread

Bob,

Of topic somewhat.. Cool that the if{} els{} works in an evaluation towards a string. Maybe I just made a simple mistake or gave up - or - tried something beyond like if{ if{ } els{} } els{ } and it just didn't work...

Anyhow, this is a response to one of your previous posts that was edited.. Had to do it! :D

The Niners are now favored by 2.5 - 3.0 from Vegas (Where it's warm)
Projected forecast for Sunday around game time, -11F to -9F with winds 15 to 25 from the north-northwest = Wind Chill -65F to -50F. It just may be one to watch, maybe you can get it?

Thanks as always,
สวัสดีปีใหม่กับคุณเกินไปอาจ '14 จะดีกับคุณ

Roman

P.S. Wish I was Thailand right now. BRRR.
 
Projected forecast for Sunday around game time, -11F to -9F

Aren't you concerned that the TV camera, or cameraman, might be frozen? Packers fans are a little nuts.

Khop khun makk khrab
 
Last edited:
Aren't you concerned that the TV camera, or cameraman, might be frozen?
Camera - NO
Cameraman -YES
If either fail it will not matter (except camera man/woman) as I listen to the game (~2 seconds quicker) on a rebuilt early 60's Magnavox AM/FM radio. (Tubes) It sounds soo good with the AM crackle. Hosts Larry McCarren & Wayne Larrivee do a spectacular job when it comes to US football whereas our usual TV hosts (names withheld) pretty much ..........

Packers fans are a little nuts. - Thank - You, Proud of it.

Roman

P.S. I really do want to go to Thailand... NOW!
 

Attachments

  • newest.png
    newest.png
    140.8 KB · Views: 455
Last edited:
Yes, it's working fine. Even though I should stick with XMLVar numbers when dealing with numbers, things like

<Value>'Intruder_GaugeX_0' @FIRString</Value>

are ok. In fact, I think it was you that told me some time ago that string would still be fine when expecting a number.

Yeah Bob, you're right. I forgot the point that values are placed on the stack as bytes :eek:.

Now, in Thailand I guess you use °F? So then you were at 32, the same as I was that time, but mine was °C !!

Saludos
Tom
 
Ah ok, then we were rosting together at 32 °C ! :D

Hope to visit Bangkok some day...

Cheers,
Tom
 
Back
Top