Nevermind.  I found the Nasal docs.

----- Original Message ----- From: <[EMAIL PROTECTED]>
To: "FlightGear developers discussions" <flightgear-devel@flightgear.org>
Sent: Thursday, June 09, 2005 4:26 PM
Subject: Re: [Flightgear-devel] NASAL error


I know this is an incredibly dumb question.. but in Nasal an "elseif" conditon is expressed as "elsif"?


----- Original Message ----- From: "Josh Babcock" <[EMAIL PROTECTED]>
To: "FlightGear developers discussions" <flightgear-devel@flightgear.org>
Sent: Thursday, June 09, 2005 3:59 PM
Subject: [Flightgear-devel] NASAL error


OK, this works great: (other than the fact that it doesn't actually do
anything yet)

gearLightCheck = func {
   for (i=0; i<3; i=i+1) {
       thisProp = "/gear/gear[" ~ i ~ "]/position-norm";
       if ( getprop(thisProp) == 1 ) {
           print("green");
       } elsif ( getprop(thisProp) == 0 ) {
           print("off");
       } else {
           print("red");
       }
   }
   settimer(gearLightCheck, 5);
}

but this

gearLightCheck = func {
   for (i=0; i<3; i=i+1) {
       thisProp = "/gear/gear[" ~ i ~ "]/position-norm";
       if ( getprop(thisProp) == 1 ) {
           print("green");
       } elsif ( getprop(thisProp) < 1 ) {          <---- Line 143
           print("red");
       } else {
           print("off");
       }
   }
   settimer(gearLightCheck, 5);
}

produces this error:
Nasal runtime error: nil used in numeric context
  at /usr/local/share/FlightGear/data/Aircraft/b29/b29.nas, line 143

I know these props are set, because I put the following in the set.xml file:

<controls>
 <gear>
  <nosewheel-caster type="bool" archive="y">true</nosewheel-caster>
  <antiskid type="bool" archive="y">false</antiskid>
  <gear num="0">
   <position-norm>0</position-norm>
  </gear>
  <gear num="1">
   <position-norm>0</position-norm>
  </gear>
  <gear num="2">
   <position-norm>0</position-norm>
  </gear>
  <gear num="3">
   <position-norm>0</position-norm>
  </gear>
 </gear>
</controls>

As an aside, the initial output looks like this:
b29-common.xml initialized
0: red
1: red
2: red
3: red
WARNING: Legacy engine definition in YASim configuration file. Please fix. WARNING: Legacy engine definition in YASim configuration file. Please fix. WARNING: Legacy engine definition in YASim configuration file. Please fix. WARNING: Legacy engine definition in YASim configuration file. Please fix.
0: green
1: green
2: green
3: green
0: green
1: green
2: green
3: green

Any thoughts?

Josh

_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d


_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@flightgear.org
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to