Board index FlightGear Development Canvas

Weird variable in canvas/map/navdisplay.mfd

Canvas is FlightGear's new fully scriptable 2D drawing system that will allow you to easily create new instruments, HUDs and even GUI dialogs and custom GUI widgets, without having to write C++ code and without having to rebuild FlightGear.

Weird variable in canvas/map/navdisplay.mfd

Postby Jabberwocky » Sat Aug 09, 2014 10:28 pm

I just found

Code: Select all
         var hdgBugRot = (vhdg_bug-userHdgTrk)*D2R;


in navdisplay.mfd ...
vhdg_bug-userHdgTrk seems to be defined nowhere and filled nowhere ... and that causes a Nasal runtime error in line 1007 ... "nil used in numeric context"
So, is this supposed to be supplied from the plane somehow, is this maybe a not fully spelled out property? What was the intention? Can any Canvas-able person help out with that?

J.
Jabberwocky
Retired
 
Posts: 1319
Joined: Sat Mar 22, 2014 7:36 pm
Callsign: JWOCKY
Version: 3.0.0
OS: Ubuntu 14.04

Re: Weird variable in canvas/map/navdisplay.mfd

Postby Hooray » Sat Aug 09, 2014 10:36 pm

disclaimer: I cannot currently run/test anything

Also, it's generally a good idea to post the FG version you're referring to - in fgdata/master, I am seeing both variables being initialized - even though there's some other weird stuff going on, such as lack of the "var" keyword - but otherwise, it seems to be "correct" at first glance - even though there's certainly some error-prone code involved here: https://gitorious.org/fg/fgdata/source/ ... isplay.mfd

And I don't quite undestand why we have several identically-named variables there, including one as a field ... but I guess it's a refactoring leftover :?

The line you mentioned, is #549 here: https://gitorious.org/fg/fgdata/source/ ... y.mfd#L549

And vhdg_bug, I can see initialized in line #529: https://gitorious.org/fg/fgdata/source/ ... y.mfd#L529

While the other is set up in line #434: https://gitorious.org/fg/fgdata/source/ ... y.mfd#L434

However, given that this involves quite a few conditionals, it is possible that you've come up with some use/case or scenario (i.e. a combination of certain settings/modes) that doesn't cover those conditionals, so that the variables are n/a.
To see if that's the case, you should post the aircraft or the integration logic so that we can take a look. I am sure that Gijs or Hyde can clarify if those conditionals are the only locations where those variables are initialized or not.

PS: For the sake of simplicity, and better troubleshootig, it's always a good idea to post gitorious URLs so that we can easily take a look

PS: navdisplay.mfd in fgdata/master doesn't have >= 1007 lines here ... so you must be referring to some other version ?
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11977
Joined: Tue Mar 25, 2008 8:40 am

Re: Weird variable in canvas/map/navdisplay.mfd

Postby Jabberwocky » Sat Aug 09, 2014 11:43 pm

It's the 3.0 and the plane is a DC-10-30, something originally from SkyOps, I guess. I stumbled only over it.
Jabberwocky
Retired
 
Posts: 1319
Joined: Sat Mar 22, 2014 7:36 pm
Callsign: JWOCKY
Version: 3.0.0
OS: Ubuntu 14.04


Return to Canvas

Who is online

Users browsing this forum: No registered users and 1 guest