Page 2 of 2

Re: Custom expression help !

Posted: 14 Jan 2019, 14:37
by jojo86
Yesterday I went sleeping very late.
I have to look angain this evening, but I’m pretty sure that my last formulea works.
So I’ll come back to confirm that the less or more symbols can be used.

See you!

Re: Custom expression help !

Posted: 14 Jan 2019, 22:11
by Oz Flyer
thedazman wrote:
14 Jan 2019, 11:55
You can’t use < and > in xml they are reserved for xml tags and as all the programming is stored in xml profiles I’m not sure you can use <> ?

I haven’t done much expression programming with is why I said I can’t advise about expression syntax but would be interested to know if <> works

Daz
I did try it before posting and it worked as it was my first try at programming expressions had to play with it for some time to get it to work.
Did the lower side first then added the upper after getting one working.

Re: Custom expression help !

Posted: 14 Jan 2019, 22:32
by jojo86
Yes, I confirme that"s works fine like that :

Code: Select all

If ( [SIMCONNECT:INDICATED ALTITUDE]  >=  [SIMCONNECT:AUTOPILOT ALTITUDE LOCK VAR] - 60 
  &&
 [SIMCONNECT:INDICATED ALTITUDE]<= [SIMCONNECT:AUTOPILOT ALTITUDE LOCK VAR] + 60
  , 1, 0)
 

Re: Custom expression help !

Posted: 14 Jan 2019, 23:47
by thedazman
Totally different formatting to gauge expressions, I’ll think I’ll stick to gauge xml :-)

I did say I didn’t know SPAD expression syntax but glad I was at least right about using less and greater than over equals.

I did briefly mess with expressions and struggled, but SPAD then added expressions into gauges so I no longer needed to use them in SPAD ergo I’m very rusty

Daz

Daz

Re: Custom expression help !

Posted: 14 Jan 2019, 23:55
by jojo86
Hi,
What did you mean from this subject ?
And yes thanks for lower and greater than idea.
thedazman wrote:
14 Jan 2019, 23:47
but SPAD then added expressions into gauges

Re: Custom expression help !

Posted: 15 Jan 2019, 17:25
by c0nnex

Code: Select all

If ( [SIMCONNECT:AUTOPILOT ALTITUDE LOCK VAR] > 0 
&&
ABS([SIMCONNECT:AUTOPILOT ALTITUDE LOCK VAR] - [SIMCONNECT:INDICATED ALTITUDE]) <= 50,
1, 
0
)
Documentation about the expression syntax can be found here: https://github.com/ncalc/ncalc/wiki

Expressions have nothing to do with xml btw

Re: Custom expression help !

Posted: 15 Jan 2019, 17:49
by thedazman
Good to know, I know all your config files including profiles are xml based.

Is confusing having two different programming syntax to deal with, I’m still struggling with gauge xml :-)

Daz

Re: Custom expression help !

Posted: 15 Jan 2019, 18:06
by c0nnex
There is a general diffrence.

Gauges use Polish Notaion ( Operands first then operator e.g. 1 3 > ) , I just use that becasue FSX uses it to stay compatible to standard gauges. I might change this somewhen in future to something more convinient and provide an editor for gauges. As gauges are pure XML currently, you cannot use <> in it.

SPAD.neXt Expressions use normal notation (Evaluated left to right according to binding priority e.g. 1 > 3 )
How thsoe are represented in the Profile-XML is totally irrelevant.

Re: Custom expression help !

Posted: 17 Jan 2019, 17:46
by thedazman
I do have SPAD expression in my gauges too so I do have a mix of code but I can’t code them straight out of my head even though they make more logical sense than the Polish notation. I have to cut and paste example formats and modify them.

Having the same fun with vb.net which I’m teaching myself currently (finally ditched vb6 lol). Written a couple of functional apps in vb.net

I like the idea of the syntax of gauges matching expressions, but the switchover is always a headache to support the transition from old to new.

AND as I’m aging badly I’m struggling to pick up new ways of coding :-)

Daz