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

Problem with engine start gauge...

Heretic

Resource contributor
Messages
6,830
Country
germany
Oh gods of XML programming heareth my prayer!

For the last two days, I've tried to fix the engine startup of Milton Shupe's Dash 7 in FSX. Most of the time went into reverse-engineering the original startup gauge and trying to understand the logic working behind it...something I haven't quite fully achieved. What I could read from the XML jungle between those brackets was, that a certain N2 condition triggered the continuous toggling of the engine starter - something that FSX doesn't like. So I decided to rewrite the "guts" of the gauge, trying to retain three of the original aspects.

1) Engine selector knob determines which engine will be started. ((L:Start Selector, enum) ; Value can be "0" to "4"; "0" means its switched off "1" means engine 1 will be started, etc...))

2) Engine master switch permits engine start ((L:Start Master, bool); can be 0 or 1 ; 0 means On , 1 means off))

3) Presence of electric power permits engine start ((A:Circuit general panel on, bool); 0 or 1; 0 means no, 1 means yes)


And this is what I've come up with:

Code:
<Gauge Name="Starter1" Version="1.0">
   <Element>
      <Select>
         <Value>(G:Var1)==1 if{ (L:Start Selector, enum) 1 == (A:Circuit general panel on, bool) AND if{ (A:GENERAL ENG STARTER:1, bool) } els{(L:Start Selector, enum) 2 == (A:Circuit general panel on, bool) AND if{ (A:GENERAL ENG STARTER:2, bool) } els{(L:Start Selector, enum) 3 == (A:Circuit general panel on, bool) AND if{ (A:GENERAL ENG STARTER:3, bool) } els{(L:Start Selector, enum) 4 == (A:Circuit general panel on, bool) AND if{ (A:GENERAL ENG STARTER:4, bool) }}}}} els{0}</Value>
         <Case Value="0">
            <Image Name="Starter1_Off.bmp" ImageSizes="30,45"/>
         </Case>
         <Case Value="1">
            <Image Name="Starter1_On.bmp" ImageSizes="30,45"/>
         </Case>
      </Select>
   </Element>
   <Mouse>
      <Help ID="HELPID_GAUGE_STARTER_SWITCH"/>
      <Cursor Type="Hand"/>
      <Click>(L:Start Master, bool)==0 if{ 1 (&gt;G:Var1) }</Click>
   </Mouse>
</Gauge>

The theory behind it:
Upon clicking, the gauge determines whether the start master switch is set to 1 or 0. If it's 0, Var1 will be set to 1. Then, if Var1 is 1 the gauge checks which engine is selected and if there's any electricity and upon receiving the "go" from both starts the correspindent engine.


But somehow...it's not working.



What I shall scacrificeth for the Lordth to cometh and helpeth?!? Oh, whath!?! (:D)
 
Bjorn,

You need to flip the number and == sign around.

>(G:Var1)==1 if{

should be

>(G:Var1) 1 == if{

and

<Click>(L:Start Master, bool)==0 if{ 1 (&gt;G:Var1) }</Click>

should be

<Click>(L:Start Master, bool) 0 == if{ 1 (&gt;G:Var1) }</Click>

RPN is enter two values then do operation on two values. So 3 4 + in RPN is the same as 3 + 4. And then A:test 0 == in RPN is the same as A:test == 0 regular expressions.

Your logic is very complicated, but you may have shortened your code example.

I would test first if there is power then test each individual selector from 1 to 4. If there is no power no sense looking at the switches.

What you show will set bmp on for starter 1 - what about starter 2,3,4?
 
Last edited:
You need to flip the number and == sign around.

>(G:Var1)==1 if{

should be

>(G:Var1) 1 == if{

and

<Click>(L:Start Master, bool)==0 if{ 1 (&gt;G:Var1) }</Click>

should be

<Click>(L:Start Master, bool) 0 == if{ 1 (&gt;G:Var1) }</Click>

I knewit had to be something trivial! :banghead:

Thanks for pointing that out.


Your logic is very complicated, but you may have shortened your code example.

I didn't shorten it. It really was the only solution I could come up with.

I would test first if there is power then test each individual selector from 1 to 4. If there is no power no sense looking at the switches.

I did that via that Blackbox XML debugging gauge. Power and start master switches are working a-ok.


What you show will set bmp on for starter 1 - what about starter 2,3,4?

Hm. I haven't thought about that yet. But doesn't Var1 always stay "1" (provided the start master switch is in the correct position)?
The image should only be dependent from Var1 and only indicate whether any of the four engines is being started right now.



Unfortunately, I can't test the code for the next couple of days. So if anyone has Milton's Dash 7 installed and a few minutes to spare, feel free to test the gauge (name was "starter1.xml").

Thanks for the reply, Ron!
 
Okay, finally got around fixing and testing the switch aaaand - it's still not working. :(
 
the dash 7 plane is a huge file(s) - just to be sure I am looking at the same info - where did you download from - is it the FS9 version you are trying to get to work in FSX?
 
the dash 7 plane is a huge file(s) - just to be sure I am looking at the same info - where did you download from - is it the FS9 version you are trying to get to work in FSX?

Yes, since there is no FSX version, I'm trying to get the FS9 version to work in FSX.

I got the Dash from Sim-Outhouse, along with two minor panel fixes. Filenames are:
d7vcmdla.zip
d7vcmdla_update_1.zip
d7vcmdla_update_2.zip


Anyways, here is the "fixed" code:
Code:
<Gauge Name="Starter1" Version="1.0">
   <Element>
      <Select>
         <Value>(G:Var1) 1 == if{ (L:Start Selector, enum) 1 == (A:Circuit general panel on, bool) AND if{ (A:GENERAL ENG STARTER:1, bool) } els{(L:Start Selector, enum) 2 == (A:Circuit general panel on, bool) AND if{ (A:GENERAL ENG STARTER:2, bool) } els{(L:Start Selector, enum) 3 == (A:Circuit general panel on, bool) AND if{ (A:GENERAL ENG STARTER:3, bool) } els{(L:Start Selector, enum) 4 == (A:Circuit general panel on, bool) AND if{ (A:GENERAL ENG STARTER:4, bool) }}}}} els{0}</Value>
         <Case Value="0">
            <Image Name="Starter1_Off.bmp" ImageSizes="30,45"/>
         </Case>
         <Case Value="1">
            <Image Name="Starter1_On.bmp" ImageSizes="30,45"/>
         </Case>
      </Select>
   </Element>
   <Mouse>
      <Help ID="HELPID_GAUGE_STARTER_SWITCH"/>
      <Cursor Type="Hand"/>
      <Click>(L:Start Master, bool) 0 == if{ 1 (&gt;G:Var1) }</Click>
   </Mouse>
</Gauge>
 
Last edited:
Hi,

First of all, check for proper spacing in all of your if{ and els{
There MUST be a space before and after if{ and els{ ; and also before and after each closing }

For example, this will work :
if{ data1 } els{ data2 } ; els{ if{ a } els{ b } }

and this won't:
if{ data1} els{data2 } ; els{ if{ a } els{ b }}


Tom
 
Bjorn,

Let's try to analyze what is going to happen with your code.

First Tom is correct - check your spacing - you have an els{( that should be els{ (.

Code:
<Value>(G:Var1) 1 == if{ (L:Start Selector, enum) 1 == (A:Circuit general panel on, bool) AND 
if{ (A:GENERAL ENG STARTER:1, bool) } els{(L:Start Selector, enum) 2 == (A:Circuit general panel on, bool) AND 
if{ (A:GENERAL ENG STARTER:2, bool) } els{(L:Start Selector, enum) 3 == (A:Circuit general panel on, bool) AND 
if{ (A:GENERAL ENG STARTER:3, bool) } els{(L:Start Selector, enum) 4 == (A:Circuit general panel on, bool) AND 
if{ (A:GENERAL ENG STARTER:4, bool) }}}}} els{0}</Value>

Let's assume you click the mouse on the element and local variable
(L:Start Master, bool) is 0.

(L:Start Master, bool) 0 == if{ 1 (&gt;G:Var1) }

if Start Master is 0 then the if part is run - we put 1 into G:Var1.

With G:Var1 as 1 then (G:Var1) 1 == if{ part of the code says put G:Var1 on the stack then put 1 on the stack and then == says take the last two stack values and test for equality. Since we clicked the mouse and G:Var1 is 1 then they are equal and you execute the if{ part.

Now the
(L:Start Selector, enum) 1 == (A:Circuit general panel on, bool) AND
is executed. Place Start Selector on stack - I assume it's starter 1 so a 1 gets put on the stack, then the number 1 is put on the stack also and the == tests that they are equal. They are so a true or 1 is placed back on the stack and then "Circuit general panel on" bool value is placed on the stack - assume the panel is on and the value is 1. The operator ANDs the two values 1 AND 1 gives a 1 or true.

Now the if part is run

if{ (A:GENERAL ENG STARTER:1, bool) }

but this code just returns the GENERAL ENG STARTER:1 value - since the starter is not running then a 0 is placed on the stack. This becomes the <value> and the off bitmap is displayed. This is the end of the code since the els { part is not run due to the if { part running. If the selector was 2 then the els { code would run but the result is the same for every condition - you retrieve the GENERAL ENG STARTER:x value - the SDK says that this is not setable - so I assume you tried to get the starter going. If this code is just to display the bmp on or off, then fixing the spaces should work as long as the starter is run in some other code.

Looking at the original code there are a few K values that get set to trigger/toggle things to happen.

Hope I got this right.
 
Last edited:
Expanding and indenting your XML script, I see that there's no key_event to actually engage the starter at all. No wonder it doesn't work...

Code:
  <Value>
		(G:Var1) 1 == 
		if{ 
			(L:Start Selector, enum) 1 == 
				(A:Circuit general panel on, bool) 
				AND 
			if{ 
				(A:GENERAL ENG STARTER:1, bool) } 
			els{(L:Start Selector, enum) 2 == 
				(A:Circuit general panel on, bool) 
				AND 
				if{ 
					(A:GENERAL ENG STARTER:2, bool) } 
				els{
					(L:Start Selector, enum) 3 == 
						(A:Circuit general panel on, bool) 
						AND 
						if{ (A:GENERAL ENG STARTER:3, bool) } 
						els{
							(L:Start Selector, enum) 4 == 
								(A:Circuit general panel on, bool) 
								AND 
								if{ 
									(A:GENERAL ENG STARTER:4, bool) 
									}
						}
				}
			}
		} 
		els{ 0 }
	</Value>
 
Bjorn,

Let's try to analyze what is going to happen with your code.

First Tom is correct - check your spacing - you have an els{( that should be els{ (.

Checked, fixed.

Let's assume you click the mouse on the element and local variable
(L:Start Master, bool) is 0.

(L:Start Master, bool) 0 == if{ 1 (&gt;G:Var1) }

if Start Master is 0 then the if part is run - we put 1 into G:Var1.

Correct.

With G:Var1 as 1 then (G:Var1) 1 == if{ part of the code says put G:Var1 on the stack then put 1 on the stack and then == says take the last two stack values and test for equality. Since we clicked the mouse and G:Var1 is 1 then they are equal and you execute the if{ part.

Correct.

Now the
(L:Start Selector, enum) 1 == (A:Circuit general panel on, bool) AND
is executed. Place Start Selector on stack - I assume it's starter 1 so a 1 gets put on the stack, then the number 1 is put on the stack also and the == tests that they are equal. They are so a true or 1 is placed back on the stack and then "Circuit general panel on" bool value is placed on the stack - assume the panel is on and the value is 1. The operator ANDs the two values 1 AND 1 gives a 1 or true.

Correct.

Now the if part is run

if{ (A:GENERAL ENG STARTER:1, bool) }

but this code just returns the GENERAL ENG STARTER:1 value - since the starter is not running then a 0 is placed on the stack. This becomes the <value> and the off bitmap is displayed. This is the end of the code since the els { part is not run due to the if { part running. If the selector was 2 then the els { code would run but the result is the same for every condition - you retrieve the GENERAL ENG STARTER:x value - the SDK says that this is not setable - so I assume you tried to get the starter going.

Correct and yes, I wanted to get the starter going.
I've browsed through the variables in the SDK, but couldn't find anything suitable at first.

If this code is just to display the bmp on or off, then fixing the spaces should work as long as the starter is run in some other code.

Actually, from what I could read from the original code, it's for running the starters and displaying the bmp on or off.




Expanding and indenting your XML script, I see that there's no key_event to actually engage the starter at all. No wonder it doesn't work...

I have replaced the "A:..." stuff for the starters with "K:KEY_TOGGLE_STARTERn" (n= number), but it still won't work.

Do I have to change anything else as well?
 
Dash7 starter.....

Björn,

I just took a look at my Dash7 install and compared the
original CAB starter1 file against the one I am using
and they are significantly different.

I'm not sure if I made the mods or not. I was aware of
the toggle_starter issues with FSX from the beginning
with regards to FS9 port-overs and did alot of recoding
to get those aircraft to start properly in FSX.

In any case, I'm attaching the 'starter1.xml' file, zip'd,
that I am using. I've not flown the Dash7 in some time
so I'm not 100% certain everything works but the code
should give you an idea of MY methods :)

Paul
 

Attachments

I'm not sure if I made the mods or not.

Aww, what a pity.
Your Starter1.xml is working fine and I'm pretty sure it will prove very useful for a lot of FSX Dash pilots.

I didn't spend much time digging through the code though, but it seems that there were some modifications to the original starter code as well as some additional elements. A bit confusing to look at but somehow it is working.

Thanks, Paul!




P.S: I'd still like to get my code working though. ;) :D
 
I have replaced the "A:..." stuff for the starters with "K:KEY_TOGGLE_STARTERn" (n= number), but it still won't work.

Do I have to change anything else as well?

You need to use the middle column. The commands beginning with KEY_ are for C gauges only... ;)

The format for key_event (COMMANDS) is:

(>K:TOGGLE_STARTER1)
 
Thanks for the hint, Bill but again no joy.


Something about my code is dangerously flawed.
Even simple stuff like this won't work:
Code:
<Gauge Name="Starter1" Version="1.0">
   <Element>
      <Select>
         <Value>(G:Var1) if{ (>K:TOGGLE_STARTER1) }</Value>
         <Case Value="0">
            <Image Name="Starter1_Off.bmp" ImageSizes="30,45"/>
         </Case>
         <Case Value="1">
            <Image Name="Starter1_On.bmp" ImageSizes="30,45"/>
         </Case>
      </Select>
   </Element>
   <Mouse>
      <Help ID="HELPID_GAUGE_STARTER_SWITCH"/>
      <Cursor Type="Hand"/>
      <Click>(L:Start Master, bool) 0 == if{ (&gt;G:Var1) }</Click>
   </Mouse>
</Gauge>

I'm on the brink of giving up and spending my precious time with more important FS related things...
 
Thanks for the hint, Bill but again no joy.


Something about my code is dangerously flawed.
Even simple stuff like this won't work:
Code:
<Gauge Name="Starter1" Version="1.0">
   <Element>
      <Select>
         <Value>(G:Var1) if{ (>K:TOGGLE_STARTER1) }</Value>
         <Case Value="0">
            <Image Name="Starter1_Off.bmp" ImageSizes="30,45"/>
         </Case>
         <Case Value="1">
            <Image Name="Starter1_On.bmp" ImageSizes="30,45"/>
         </Case>
      </Select>
   </Element>
   <Mouse>
      <Help ID="HELPID_GAUGE_STARTER_SWITCH"/>
      <Cursor Type="Hand"/>
      <Click>(L:Start Master, bool) 0 == if{ (&gt;G:Var1) }</Click>
   </Mouse>
</Gauge>

I'm on the brink of giving up and spending my precious time with more important FS related things...

For FSX you need to send that (>K:TOGGLE_STARTER1) once
and only once for a given engine when the conditions
for starting are met.
Then, once the engine meets the 'started' conditions, you
send the (>K:TOGGLE_STARTER1) event once more to toggle
the starter off.
Sending it continuosly, as was the common case in FS9,
will not work in FSX.

That whole added bit of code in my example was there to
insure the key events were sent as I described.

So what you need to do is:
Test G:Var1
Non-Zero?
Yes
...Starter not active and Starting conditions met?
......Yes, send (>K:TOGGLE_STARTER1), Flag starter as active
......No, do nothing
No, Do nothing.

Engine started conditions met and starter active?
....Yes. Send (>K:TOGGLE_STARTER1), flag starter as inactive
....No. Do nothing

Mouse click ...Set G:Var1 to non-zero

Paul
 
Last edited:
Hello I need a help to understand what is a sequence of tokens that should be toggled in C gauge to start one single engine.
I tried toggle only KEY_MAGNETO1_START, but it doesn't work :( .
And one more question: How can I implement APU in FS2004? There is no APU tokens at all, in FSX I see them...
I have idea to use one of engines as APU ... but maybe you have better solution
 
Last edited:
Hello I need a help to understand what is a sequence of tokens that should be toggled in C gauge to start one single engine.
I tried toggle only KEY_MAGNETO1_START, but it doesn't work :( .
And one more question: How can I implement APU in FS2004? There is no APU tokens at all, in FSX I see them...
I have idea to use one of engines as APU ... but maybe you have better solution

Why are you asking a question about C gauges in a thread about XML gauges?

Also, you aren't clear on which version of FS you are wanting to code a stater for. This thread is marked FSX, but you are asking about APU for FS9 so it is not clear just what you want.

Please start a new thread with clear details on what you want to accomplish... :D
 
Back
Top