Board index FlightGear Development Nasal

index not scalar at __dlg:radios, line 5  Topic is solved

Nasal is the scripting language of FlightGear.

index not scalar at __dlg:radios, line 5  

Postby kuifje09 » Thu Jun 05, 2014 11:31 am

Some time before I already asked about this error: "Nasal runtime error: container index not scalar
at __dlg:radios, line 5"
But no solution was givven.
Maby it is related to the airplane you fly on, but with the Ctation-II it is there.
It is caused by a prop not set at start : '/instrumentation/transponder/inputs/knob-mode'
Solution :
Add this code in the radios.xml at : fgdata/gui/dialogs/
after :
Code: Select all
var modes = ['OFF', 'STANDBY', 'TEST', 'GROUND', 'ON', 'ALTITUDE'];
           var v = getprop('/instrumentation/transponder/inputs/knob-mode');

enter:
Code: Select all
if( v == nil){
            setprop('/instrumentation/transponder/inputs/knob-mode',0);
            v=0;
        }


Then the error is gone and even no warning is displayed.
kuifje09
 
Posts: 596
Joined: Tue May 17, 2011 9:51 pm

Re: index not scalar at __dlg:radios, line 5

Postby Hooray » Thu Jun 05, 2014 11:34 am

the code should be fixed to use value-defaulting: http://wiki.flightgear.org/Nasal_Conditionals

Also note that you can simply tell getprop() to assign a default value through its 2nd argument
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: 12707
Joined: Tue Mar 25, 2008 9:40 am
Pronouns: THOU

Re: index not scalar at __dlg:radios, line 5

Postby kuifje09 » Fri Jun 06, 2014 5:36 pm

Hello Hooray,

I know, but this was not my code... Only to let "someone" know.
Because I see this message already for such a long time ....
kuifje09
 
Posts: 596
Joined: Tue May 17, 2011 9:51 pm

Re: index not scalar at __dlg:radios, line 5

Postby TheTom » Sat Jun 21, 2014 11:21 am

TheTom
 
Posts: 322
Joined: Sun Oct 09, 2011 11:20 am

Re: index not scalar at __dlg:radios, line 5

Postby kuifje09 » Thu Jul 31, 2014 8:56 pm

Ah, thanks TheTom, it will be fixed soon then...
kuifje09
 
Posts: 596
Joined: Tue May 17, 2011 9:51 pm


Return to Nasal

Who is online

Users browsing this forum: No registered users and 4 guests