Current SPAD.neXt Release: 0.9.12.123

This forum has closed. Please join our Discord Community.

SPAD.neXt online services are no longer available for SPAD.neXt Versions < 0.9.11.5

Custom expression help !

General Discussions
jojo86
Passenger
Posts: 8
Joined: 12 Nov 2018, 19:51
Status: Offline

Re: Custom expression help !

Post by jojo86 » 14 Jan 2019, 14:37

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!

User avatar
Oz Flyer
Betatester
Posts: 741
Joined: 23 Sep 2015, 10:10
Location: YMMB, Melbourne, Australia
Contact:
Status: Offline

Re: Custom expression help !

Post by Oz Flyer » 14 Jan 2019, 22:11

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.
David
OZ Flyer
Near YMMB
40+ year of Flight Siming.
Sim: subLOGIC/Microsoft Flight Sim's/DTG FSX, Microsoft Flight, DTG Filght School/FSW/Train Sim/TSW, ETS2 & ATS.
Hardware: Logitech, Saitek, Arduino 2560's & Leo's, BBI-32, PAC LED.

jojo86
Passenger
Posts: 8
Joined: 12 Nov 2018, 19:51
Status: Offline

Re: Custom expression help !

Post by jojo86 » 14 Jan 2019, 22:32

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)
 

User avatar
thedazman
Betatester
Posts: 1808
Joined: 28 Mar 2015, 10:47
Location: United Kingdom
Contact:
Status: Offline

Re: Custom expression help !

Post by thedazman » 14 Jan 2019, 23:47

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
"theDAZman" aka "theGFXguy"
Image
https://fipgauges.com

jojo86
Passenger
Posts: 8
Joined: 12 Nov 2018, 19:51
Status: Offline

Re: Custom expression help !

Post by jojo86 » 14 Jan 2019, 23:55

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

User avatar
c0nnex
Site Admin
Posts: 5469
Joined: 10 Mar 2015, 21:52
Location: Munich, Germany
Contact:
Status: Offline

Re: Custom expression help !

Post by c0nnex » 15 Jan 2019, 17:25

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

User avatar
thedazman
Betatester
Posts: 1808
Joined: 28 Mar 2015, 10:47
Location: United Kingdom
Contact:
Status: Offline

Re: Custom expression help !

Post by thedazman » 15 Jan 2019, 17:49

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
"theDAZman" aka "theGFXguy"
Image
https://fipgauges.com

User avatar
c0nnex
Site Admin
Posts: 5469
Joined: 10 Mar 2015, 21:52
Location: Munich, Germany
Contact:
Status: Offline

Re: Custom expression help !

Post by c0nnex » 15 Jan 2019, 18:06

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.

User avatar
thedazman
Betatester
Posts: 1808
Joined: 28 Mar 2015, 10:47
Location: United Kingdom
Contact:
Status: Offline

Re: Custom expression help !

Post by thedazman » 17 Jan 2019, 17:46

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
"theDAZman" aka "theGFXguy"
Image
https://fipgauges.com

Locked