Board index FlightGear Development Aircraft Systems

Implementing light-manager.nas in the PC-9M  Topic is solved

Modeling aircraft systems, like electrical stuff, hydraulics, pneumatics? Feel free to ask support.

Implementing light-manager.nas in the PC-9M

Postby skipper0802 » Tue Sep 18, 2018 4:20 am

Greetings All,
I've managed to get my landing lights somewhat sorted out in contrast to using the ALS Secondary Lights. The subject light-manager.nas file allows me a bit of flexibility in configuration. However, I've found some odd details that I've not found a solution for yet. :? So, in no particular order:
    [1] I believe light[0] is the external landing light per the property tree; light[1] is the external taxi light
    [2] I've adjusted properties for both of these lightspots in the init: "define your lights here" section of the light-manager.nas file. In the screen pic below, you'll see that both lights have a different size, shape, and direction when they should conform per my config. Additionally, both lights should have an RGB test color of .9 .9 .9. However, light[0] has .5 .5 .5, and light[1] has .4 .4 .4. :roll: Furthermore, I think the direction variable (dir and dir[1]) should hold the same value, again per my config.
    [3] Isn't the initial properties hash missing a closing curly brace and comma (just before the init: function in the light-manager.nas file?
    [4] Last, does any of these issues have anything to do with inherited effects?
Here's the console dialog contents:
Code: Select all
        option:console =
        option:prop = /sim/rendering/shadows/enabled=0
        option:prop = /sim/rendering/multi-sample-buffers=1
        option:prop = /sim/rendering/multi-samples=2
        option:disable-rembrandt =
        option:prop = /sim/rendering/shaders/skydome=true
        option:enable-terrasync =
        option:prop = /nasal/local_weather/enabled=false
        option:metar = XXXX 012345Z 15003KT 19SM FEW072 FEW350 25/07 Q1028 NOSIG
        option:prop = /environment/weather-scenario=Core high pressure region
        option:aircraft = org.flightgear.fgaddon.PC-9M
        option:fg-aircraft = C:/Users/erica/Documents/FlightGear/Aircraft/org.flightgear.fgaddon/Aircraft/PC-9M
        option:airport = KBFI
        option:parkpos = A8_Run_Up
        option:launcher =
Using default download dir: Path "C:/Users/erica/Documents/FlightGear"
read-allowed path not found:Path "C:/Users/erica/Documents/FlightGear/AI"
read-allowed path not found:Path "C:/Users/erica/Documents/FlightGear/Liveries"
Using TerraSync dir: Path "C:/Users/erica/Documents/FlightGear/TerraSync"
EmbeddedResourceManager: selected locale 'en-US'
Using stock OSG implementation of GraphicsWindow
StatsHandler::StatsHandler() Setting up GL2 compatible shaders
initializing cloud layers
Enabling ATI/AMD viewport hack
Configuration State
======= ==============
aircraft-dir = "C:/Users/erica/Documents/FlightGear/Aircraft/org.flightgear.fgaddon/Aircraft/PC-9M"
fghome-dir = "Path "C:/Users/erica/AppData/Roaming/flightgear.org""
download-dir = "C:/Users/erica/Documents/FlightGear"
terrasync-dir = "C:/Users/erica/Documents/FlightGear/TerraSync"
aircraft-search-paths =
        C:/Users/erica/Documents/FlightGear/Aircraft/org.flightgear.fgaddon
        C:/Users/erica/Documents/FlightGear/Aircraft/org.flightgear.fgaddon/Aircraft/PC-9M
scenery-search-paths =
        C:/Users/erica/Documents/FlightGear/TerraSync
        C:/Program Files/FlightGear 2018.2.2/data/Scenery
ATI Technologies Inc.
AMD FirePro M4000
4.5.13506 Compatibility Profile Context FireGL 23.20.15018.1002
4.50
Splash screen progress loading-aircraft-list
Starting automatic scenery download/synchronization to 'C:/Users/erica/Documents/FlightGear/TerraSync'.
Splash screen progress loading-nav-dat
Splash screen progress init-scenery
picking entry # 0, server is https://mpserver16.flightgear.org/scenery
terrasync scenery provider of the day is 'https://mpserver16.flightgear.org/scenery'
General Initialization
======= ==============
FG_ROOT = "Path "C:/Program Files/FlightGear 2018.2.2/data""

Reading timezone info from: Path "C:/Program Files/FlightGear 2018.2.2/data/Timezone/zone.tab"
Selected scenery is tilecache
FGStgTerrain::init - init tilemgr
Initializing Tile Manager subsystem.
Initializing the tile cache.
  max cache size = 100
  current cache size = 0
  done with init()
Splash screen progress finalize-position
Splash screen progress creating-subsystems
Creating Subsystems
========== ==========
Reading materials from C:/Program Files/FlightGear 2018.2.2/data/Materials/regions/materials.xml
Reading systems from Path "C:/Program Files/FlightGear 2018.2.2/data/Aircraft/Generic/generic-systems.xml"
Initializing HUD Instrument
Reading sound sound from Path "C:/Users/erica/Documents/FlightGear/Aircraft/org.flightgear.fgaddon/Aircraft/PC-9M/Sounds/PC-9M-sound.xml"
Creating subsystems took:4112
Splash screen progress binding-subsystems
FGPropertyManager::GetNode() No node found for /ai/submodels/contrails
osgDB ac3d reader: could not find texture "/export/fgfs/flightgear-fgaddon/Aircraft/PC-9M/Models/Liveries/Factory.png"
osgDB ac3d reader: could not find texture "Factory.png"
osgDB ac3d reader: could not find texture "/export/fgfs/flightgear-fgaddon/Aircraft/PC-9M/Models/grey-blue-flood.png"
osgDB ac3d reader: could not find texture "grey-blue-flood.png"
osgDB ac3d reader: could not find texture "torque.rgb"
Failed to load file: "Aircraft/PC-9M/Models/Pilots/Pilot.xml"
Failed to load file: "Aircraft/PC-9M/Models/Pilots/Pilot.xml"
osgDB ac3d reader: could not find texture "/export/fgfs/flightgear-fgaddon/Aircraft/b1900d/Models/interior.png"
osgDB ac3d reader: could not find texture "interior.png"
osgDB ac3d reader: could not find texture "/export/fgfs/flightgear-fgaddon/Aircraft/b1900d/Models/interior.png"
osgDB ac3d reader: could not find texture "interior.png"

Volcanic activity off.
*** light.nas...finished
AFDS System ... check
VHF-22 ... OK
VIR-32 ... OK

Here's the file content of light-manager.nas:
Code: Select all
# provides relative vectors from eye-point to aircraft lights
# in east/north/up coordinates the renderer uses

var light_manager = {

    lat_to_m: 110952.0,
    lon_to_m: 0.0,

    light1_xpos: 0.0,
    light1_ypos: 0.0,
    light1_zpos: 0.0,
    light1_r: 0.0,
    light1_g: 0.0,
    light1_b: 0.0,
    light1_size: 0.0,
    light1_stretch: 0.0,

    light2_xpos: 0.0,
    light2_ypos: 0.0,
    light2_zpos: 0.0,
    light2_r: 0.0,
    light2_g: 0.0,
    light2_b: 0.0,
    light2_size: 0.0,
    light2_stretch: 0.0,

    light3_xpos: 0.0,
    light3_ypos: 0.0,
    light3_zpos: 0.0,
    light3_r: 0.0,
    light3_g: 0.0,
    light3_b: 0.0,
    light3_size: 0.0,

    light4_xpos: 0.0,
    light4_ypos: 0.0,
    light4_zpos: 0.0,
    light4_r: 0.0,
    light4_g: 0.0,
    light4_b: 0.0,
    light4_size: 0.0,
                                                                 ### no closing curly brace and comma here?
    init: func {
        # define your lights here

        # light 1 ##################################
        # offsets to aircraft center
        me.light1_xpos = -0.3; #original 1.0
        me.light1_ypos =  1.2; #original 1.2
        me.light1_zpos =  -0.5; #original 2.0

        # color values
        me.light1_r = 0.9;
        me.light1_g = 0.9;
        me.light1_b = 0.9;

        # spot size
        me.light1_size = 15.0;
        me.light1_stretch = 1.25;

        # light 2 ##################################
        # offsets to aircraft center
        me.light2_xpos = -0.3; #original 1.0
        me.light2_ypos = -1.2; #original -1.2
        me.light2_zpos =  -0.5; #original 2.0

        # color values
        me.light2_r = 0.9;
        me.light2_g = 0.9;
        me.light2_b = 0.9;

        # spot size
         me.light2_size = 15.0;
         me.light2_stretch = 1.25;

        # light 3 ##################################
        # offsets to aircraft center
        me.light3_ypos = -6.0;
        me.light3_zpos = 2.0;

        # color values
        me.light3_r = 0.0;
        me.light3_g = 0.5;
        me.light3_b = 0.0;

        # spot size
         me.light3_size = 5.0;

        # light 4 ##################################
        # offsets to aircraft center
        me.light4_ypos = 6.0;
        me.light4_zpos = 2.0;

        # color values
        me.light4_r = 0.5;
        me.light4_g = 0.0;
        me.light4_b = 0.0;

        # spot size
        me.light4_size = 5.0;
       
        me.light_manager_timer = maketimer(0.0, func{me.update()});
       
        me.start();
    },

    start: func {
        setprop("/sim/rendering/als-secondary-lights/num-lightspots", 4);

        setprop("/sim/rendering/als-secondary-lights/lightspot/size", me.light1_size);
        setprop("/sim/rendering/als-secondary-lights/lightspot/size[1]", me.light2_size);
        setprop("/sim/rendering/als-secondary-lights/lightspot/size[2]", me.light3_size);
        setprop("/sim/rendering/als-secondary-lights/lightspot/size[3]", me.light4_size);

        setprop("/sim/rendering/als-secondary-lights/lightspot/stretch", me.light1_stretch);
        setprop("/sim/rendering/als-secondary-lights/lightspot/stretch[1]", me.light2_stretch);

        me.light_manager_timer.start();
    },

    stop: func {
        me.light_manager_timer.stop();
    },

    update: func {

        var apos = geo.aircraft_position();
        var vpos = geo.viewer_position();

        me.lon_to_m = math.cos(apos.lat()*math.pi/180.0) * me.lat_to_m;

        var heading = getprop("/orientation/heading-deg") * math.pi/180.0;

        var lat = apos.lat();
        var lon = apos.lon();
        var alt = apos.alt();

        var sh = math.sin(heading);
        var ch = math.cos(heading);

        # light 1 position ################################################################
        var alt_agl = getprop("/position/altitude-agl-ft");

        var proj_x = alt_agl;
        var proj_z = alt_agl/10.0;

        apos.set_lat(lat + ((me.light1_xpos + proj_x) * ch + me.light1_ypos * sh) / me.lat_to_m);
        apos.set_lon(lon + ((me.light1_xpos + proj_x)* sh - me.light1_ypos * ch) / me.lon_to_m);

        var delta_x = (apos.lat() - vpos.lat()) * me.lat_to_m;
        var delta_y = -(apos.lon() - vpos.lon()) * me.lon_to_m;
        var delta_z = apos.alt()- proj_z - vpos.alt();

        setprop("/sim/rendering/als-secondary-lights/lightspot/eyerel-x-m", delta_x);
        setprop("/sim/rendering/als-secondary-lights/lightspot/eyerel-y-m", delta_y);
        setprop("/sim/rendering/als-secondary-lights/lightspot/eyerel-z-m", delta_z);
        setprop("/sim/rendering/als-secondary-lights/lightspot/dir", heading);

        # light 2 position ################################################################
        var alt_agl = getprop("/position/altitude-agl-ft");

        var proj_x = alt_agl;
        var proj_z = alt_agl/10.0;

        apos.set_lat(lat + ((me.light2_xpos + proj_x) * ch + me.light2_ypos * sh) / me.lat_to_m);
        apos.set_lon(lon + ((me.light2_xpos + proj_x)* sh - me.light2_ypos * ch) / me.lon_to_m);

        var delta_x = (apos.lat() - vpos.lat()) * me.lat_to_m;
        var delta_y = -(apos.lon() - vpos.lon()) * me.lon_to_m;
        var delta_z = apos.alt()- proj_z - vpos.alt();

        setprop("/sim/rendering/als-secondary-lights/lightspot/eyerel-x-m[1]", delta_x);
        setprop("/sim/rendering/als-secondary-lights/lightspot/eyerel-y-m[1]", delta_y);
        setprop("/sim/rendering/als-secondary-lights/lightspot/eyerel-z-m[1]", delta_z);
        setprop("/sim/rendering/als-secondary-lights/lightspot/dir[1]", heading);                 ### this line originally didn't have the "[1]" designator (unless it was originally intended for lights 1 and 2 to have the same heading.

        # light 3 position ################################################################
        apos.set_lat(lat + (me.light3_xpos * ch + me.light3_ypos * sh) / me.lat_to_m);
        apos.set_lon(lon + (me.light3_xpos * sh - me.light3_ypos * ch) / me.lon_to_m);

        delta_x = (apos.lat() - vpos.lat()) * me.lat_to_m;
        delta_y = -(apos.lon() - vpos.lon()) * me.lon_to_m;
        delta_z = apos.alt() - vpos.alt();

        setprop("/sim/rendering/als-secondary-lights/lightspot/eyerel-x-m[2]", delta_x);
        setprop("/sim/rendering/als-secondary-lights/lightspot/eyerel-y-m[2]", delta_y);
        setprop("/sim/rendering/als-secondary-lights/lightspot/eyerel-z-m[2]", delta_z);

        # light 4 position ################################################################
        apos.set_lat(lat + (me.light4_xpos * ch + me.light4_ypos * sh) / me.lat_to_m);
        apos.set_lon(lon + (me.light4_xpos * sh - me.light4_ypos * ch) / me.lon_to_m);

        delta_x = (apos.lat() - vpos.lat()) * me.lat_to_m;
        delta_y = -(apos.lon() - vpos.lon()) * me.lon_to_m;
        delta_z = apos.alt() - vpos.alt();

        setprop("/sim/rendering/als-secondary-lights/lightspot/eyerel-x-m[3]", delta_x);
        setprop("/sim/rendering/als-secondary-lights/lightspot/eyerel-y-m[3]", delta_y);
        setprop("/sim/rendering/als-secondary-lights/lightspot/eyerel-z-m[3]", delta_z);

    },   
        ##############################################################################
    switch_position: func(light, lightr, lightg, lightb) {
        setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-r["~light~"]", lightr);
        setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-g["~light~"]", lightg);
        setprop("/sim/rendering/als-secondary-lights/lightspot/lightspot-b["~light~"]", lightb);
    },

    enable_or_disable: func (enable, light_num) {
        if (enable) {
            if (light_num == 0)
                me.switch_position(light_num, me.light1_r, me.light1_g, me.light1_b);
            if (light_num == 1)
                me.switch_position(light_num, me.light2_r, me.light2_g, me.light2_b);
            if (light_num == 2)
                me.switch_position(light_num, me.light3_r, me.light3_g, me.light3_b);
            if (light_num == 3)
                me.switch_position(light_num, me.light4_r, me.light4_g, me.light4_b);
        } else {
            me.switch_position(light_num, 0.0, 0.0, 0.0);
        }
    },

};

setlistener("/sim/signals/fdm-initialized", func {

    light_manager.init();
   
    setlistener("/sim/rendering/als-secondary-lights/use-landing-light-ext", func (node) {
        light_manager.enable_or_disable(node.getValue(), 0);
    }, 1, 0);

    setlistener("/sim/rendering/als-secondary-lights/use-taxi-light-ext", func (node) {
        light_manager.enable_or_disable(node.getValue(), 1);
    }, 1, 0);
   
    setlistener("/sim/model/c172p/lighting/nav-lights/right-on", func (node) {
        light_manager.enable_or_disable(node.getValue(), 2);
    }, 1, 0);
   
    setlistener("/sim/model/c172p/lighting/nav-lights/left-on", func (node) {
        light_manager.enable_or_disable(node.getValue(), 3);
    }, 1, 0);
     
});

Here's the file content of light.nas:
Code: Select all
beacon_switch = props.globals.getNode("controls/switches/beacon", 2);
var beacon = aircraft.light.new( "/sim/model/lights/beacon", [0.4, 0.4], "/controls/lighting/beacon" );
strobe_switch = props.globals.getNode("controls/switches/strobe", 2);
var strobe = aircraft.light.new( "/sim/model/lights/strobe", [0.05, 0.05, 0.05, 1], "/controls/lighting/strobe" );

### control via keyboard.xml except for sun-angle autoswitch. Function commented-out for now.
#controls.toggleLandingLights = func
#{
#    var state = getprop("controls/lighting/landing-lights");
#    setprop("controls/lighting/landing-lights",!state);
#};

setprop("/systems/electrical/outputs/strobe-norm", 1.0);
setprop("/systems/electrical/outputs/nav-lights-norm", 1.0);
setprop("/systems/electrical/outputs/taxi-light", 30);
setprop("/controls/lighting/landing-lights", 0);
setprop("/controls/lighting/strobe", 1);

### the following listener monitors the sun's angle and switches the external ALS secondary spot lights automatically

setlistener("/sim/signals/fdm-initialized", func {
    setlistener("/sim/time/sun-angle-rad", func {
       if ( getprop("/sim/time/sun-angle-rad") > 1.4) {
       #print( getprop("/sim/time/sun-angle-rad") );
       setprop("/sim/rendering/als-secondary-lights/use-landing-light-ext",1);
       setprop("/sim/rendering/als-secondary-lights/use-taxi-light-ext",1);
       }
       else if ( getprop("/sim/time/sun-angle-rad") < 1.4) {
       #print( getprop("/sim/time/sun-angle-rad") );
       setprop("/sim/rendering/als-secondary-lights/use-landing-light-ext",0);
       setprop("/sim/rendering/als-secondary-lights/use-taxi-light-ext",0);
       }
    }, 1, 0);   
});   

print("*** light.nas...finished");

My eyes are starting to cross from looking at the code, studying wiki sections, and doing forum searches for relevant information. :shock: Can anyone offer hints as to why these two lights are not conforming? I apologize in advance for not seeing something obvious. :oops:
V/r,
Eric
*******************************************************************
Intel Core i7-3520M CPU @ 2.9GHz, 16 GB RAM, 64-bit OS, x64-based processor
HP EliteBook 8770W
AMD FirePro M4000 1GB
Windows 10 Home
Flightgear 2018.2.2
skipper0802
 
Posts: 24
Joined: Tue Apr 24, 2018 3:12 pm
Location: Seattle, Washington, USA
Callsign: 0802SK, skipper0802
Version: 2018.2.2
OS: Windows10 Home

Re: Implementing light-manager.nas in the PC-9M

Postby wlbragg » Tue Sep 18, 2018 4:28 am

The }; immediately before the
Code: Select all
setlistener("/sim/signals/fdm-initialized", func

is the closing for the light manager code block and it looks correct.

There is a comma after light4_size: 0.0 which is also correct
Code: Select all
    light4_b: 0.0,
    light4_size: 0.0,
                                                                 ### no closing curly brace and comma here?
    init: func {



I'm looking at the rest now.
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 4914
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Implementing light-manager.nas in the PC-9M

Postby skipper0802 » Tue Sep 18, 2018 4:31 am

Hey wlbragg,
Thanks for diving-in. Let me know if you need more info. Very appreciated.
Thanks man,

[Edit] Somewhere out there in the web ether is the author of the .nas file. Can't remember how I found him last week :(
V/r,
Eric
*******************************************************************
Intel Core i7-3520M CPU @ 2.9GHz, 16 GB RAM, 64-bit OS, x64-based processor
HP EliteBook 8770W
AMD FirePro M4000 1GB
Windows 10 Home
Flightgear 2018.2.2
skipper0802
 
Posts: 24
Joined: Tue Apr 24, 2018 3:12 pm
Location: Seattle, Washington, USA
Callsign: 0802SK, skipper0802
Version: 2018.2.2
OS: Windows10 Home

Re: Implementing light-manager.nas in the PC-9M

Postby wlbragg » Tue Sep 18, 2018 4:48 am

Is your registration of light-manager.nas in the set file correct?
Make sure your calling your light manager and not that of the c172p. That is my guess, because 0.4 and 0.5 is what the c172p is using and it looks like you got your example from that source.

After refreshing my memory, I don't know what this would do, so that may not be the issue.
Code: Select all
<nasal>
        <c172p>
            <file>Nasal/light-manager.nas</file>
        </c172p>
</nasal>
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 4914
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Implementing light-manager.nas in the PC-9M  

Postby skipper0802 » Tue Sep 18, 2018 4:54 am

Ahhhh. I have the <file> reference in the section of the PC-9M-shared.xml file:
Code: Select all
<PropertyList>

  <sim>

    <!--Info -->

    <author>Erik Hofman, Petar Jedvaj, Ernest Teuscher, David Culp, Johan G, Gary Brown and FlightGear UK</author>
    <status>1.4.0</status>

    <flight-model>jsb</flight-model>
    <aero>PC-9M</aero>

    <startup>
     <splash-logo-image>gplv3_logo.png</splash-logo-image>    # original was .svg
     <splash-logo-width>0.2</splash-logo-width>
     <splash-logo-x-norm>0.1</splash-logo-x-norm>
     <splash-logo-y-norm>0.1</splash-logo-y-norm>
    </startup>
    <previews>
      <preview>
        <type>exterior</type>
        <path>Preview/PC-9M.jpg</path>
        <splash type="bool">true</splash>
      </preview>
      <preview>
        <type>exterior</type>
        <path>Preview/Military.jpg</path>
        <splash type="bool">true</splash>
      </preview>
      <preview>
        <type>exterior</type>
        <path>Preview/Startup.jpg</path>
        <splash type="bool">true</splash>
      </preview>
    </previews>

    <!--Systems -->

    <systems>
      <autopilot>
        <path>Aircraft/PC-9M/Systems/autopilot.xml</path>
      </autopilot>
     
      <electrical>
        <path>Aircraft/PC-9M/Systems/electrical.xml</path>
      </electrical>

      <pitot>
        <name>pitot</name>
        <number>0</number>
      </pitot>

      <static>
        <name>static</name>
        <number>0</number>
      </static>

      <property-rule n="101">
        <path>Aircraft/PC-9M/Systems/shadow.xml</path>
      </property-rule>
    </systems>

    <sound>
      <path>Aircraft/PC-9M/Sounds/PC-9M-sound.xml</path>
    </sound>

    <model>
      <path archive="y">Aircraft/PC-9M/Models/PC9M.xml</path>
      <livery>
        <file type="string"/>
        <shininess type="float">-0.85</shininess>
      </livery>
    </model>

    <virtual-cockpit archive="y">true</virtual-cockpit>
    <allow-toggle-cockpit archive="y">false</allow-toggle-cockpit>

    <!--Views -->

    <view n="0">
      <internal archive="y">true</internal>
      <config>
        <pitch-offset-deg>-14.0</pitch-offset-deg>
        <default-field-of-view-deg type="double">89.1</default-field-of-view-deg> #original: 89.1
        <x-offset-m archive="y"> 0.00</x-offset-m>
        <y-offset-m archive="y"> 0.96</y-offset-m>
        <z-offset-m archive="y">-0.37</z-offset-m>
      </config>
    </view>

    <view n="100">
      <name>Instructor</name>
      <enabled type="bool">true</enabled>
      <type>lookfrom</type>
      <internal type="bool">true</internal>
      <internal archive="y">true</internal>
      <config>
        <from-model type="bool">true</from-model>
        <from-model-idx type="int">0</from-model-idx>
        <default-field-of-view-deg type="double">72.0</default-field-of-view-deg>
        <default-pitch-deg type="double">0</default-pitch-deg>
        <default-heading-deg type="double">0</default-heading-deg>
        <x-offset-m archive="y"> 0.00 </x-offset-m> 
        <y-offset-m archive="y"> 0.96 </y-offset-m>
        <z-offset-m archive="y"> 1.12 </z-offset-m>
        <pitch-offset-deg> -10.0</pitch-offset-deg>
        <dynamic-view type="bool">true</dynamic-view>
      </config>
    </view>

    <view n="101">
      <name>Pilot cam</name>
      <internal archive="y">false</internal>
      <config>
        <from-model type="bool">true</from-model>
        <from-model-idx type="int">0</from-model-idx>
        <x-offset-m archive="y"> 0.00</x-offset-m>
        <y-offset-m archive="y"> 1.28</y-offset-m>
        <z-offset-m archive="y">-1.0</z-offset-m>
        <pitch-offset-deg>0</pitch-offset-deg>
        <heading-offset-deg>180</heading-offset-deg>
        <default-field-of-view-deg>95</default-field-of-view-deg>
      </config>
    </view>

    <rendering>
      <redout>
        <parameters>
            <blackout-onset-g type="double">4.5</blackout-onset-g>
            <blackout-complete-g type="double">7.0</blackout-complete-g>
            <redout-onset-g type="double">-2.25</redout-onset-g>
            <redout-complete-g type="double">-3.5</redout-complete-g>
        </parameters>
      </redout>
      <als-secondary-lights>
        <landing-light1-offset-deg type="double">5</landing-light1-offset-deg>
        <landing-light2-offset-deg type="double">-5</landing-light2-offset-deg>
        <use-landing-light-ext>0</use-landing-light-ext>
        <use-taxi-light-ext>0</use-taxi-light-ext>
      </als-secondary-lights>
      <sim>
          <model>
              <c172p>
                  <lighting>
                      <nav-lights>
                          <left-on type="bool">0</left-on>
                          <right-on type="bool">0/</right-on>
                      </nav-lights>
                  </lighting>
              </c172p>
          </model>
      </sim>
    </rendering>

    <chase-distance-m type="double" archive="y">-20.0</chase-distance-m>

    <!-- Menu -->

    <menubar>
      <default>
        <menu n="100">
          <item>
            <label>Autostart</label>
            <binding>
              <command>property-toggle</command>
              <property>controls/engines/start1</property> 
            </binding>
            <binding>
              <command>property-toggle</command>
              <property>controls/engines/run1</property> 
            </binding>
            <binding>
              <command>property-toggle</command>
              <property>controls/engines/abort1</property>
            </binding>
            <mod-up>
              <binding>
                <command>null</command>
              </binding>
            </mod-up>   
          </item>
          <item>
            <label>Select Livery</label>
            <binding>
              <command>nasal</command>
              <script>aircraft.livery.dialog.toggle()</script>
            </binding>
          </item>
          <enabled type="bool">true</enabled>
        </menu>
      </default>
    </menubar>

    <!-- Help -->

    <help>
      <title>Pilatus PC-9M</title>
      <key>
        <name>c</name>
        <desc>Open/close canopy</desc>
      </key>
      <key>
        <name>Ctrl+b</name>
        <desc>Toggle speedbrake</desc>
      </key>
      <key>
        <name>m</name>
        <desc>Nose wheel steering</desc>
      </key>
      <key>
        <name>l</name>
        <desc>Toggle Landing Lights (non-ALS rendering)</desc>
      </key>
      <key>
        <name>;</name>
        <desc>Toggle Landing Lights (ALS secondary lights)</desc>
      </key>
      <line>Click on engine panel to Start/Run/Abort or use Autostart</line>
    </help>

    <!-- Persistent data between sessions -->
        <aircraft-data>
            <path>/instrumentation/comm/frequencies/selected-mhz</path>
            <path>/instrumentation/comm/frequencies/standby-mhz</path>
            <path>/instrumentation/comm[1]/frequencies/selected-mhz</path>
            <path>/instrumentation/comm[1]/frequencies/standby-mhz</path>
           
            <path>/instrumentation/nav/frequencies/selected-mhz</path>
            <path>/instrumentation/nav/frequencies/standby-mhz</path>
            <path>/instrumentation/nav[1]/frequencies/selected-mhz</path>
            <path>/instrumentation/nav[1]/frequencies/standby-mhz</path>
            <path>/instrumentation/nav/radials/selected-deg</path>
            <path>/instrumentation/nav[1]/radials/selected-deg</path>
           
            <path>/instrumentation/adf/frequencies/selected-khz</path>
            <path>/instrumentation/adf/frequencies/standby-khz</path>
            <path>/instrumentation/adf/rotation-deg</path>
            <path>/instrumentation/adf[1]/frequencies/selected-khz</path> #future extensible
            <path>/instrumentation/adf[1]/frequencies/standby-khz</path> #future extensible
            <path>/instrumentation/adf[1]/rotation-deg</path>
           
            <path>/instrumentation/transponder/inputs/digit[3]</path> # model-to-object mapping is off-sequence for all digits (right to left)/
            <path>/instrumentation/transponder/inputs/digit[2]</path>
            <path>/instrumentation/transponder/inputs/digit[1]</path>
            <path>/instrumentation/transponder/inputs/digit</path>
            <path>/instrumentation/transponder/inputs/knob-mode</path>
            <path>/instrumentation/transponder/inputs/ident-btn</path>
           
            <path>/instrumentation/tacan/frequencies/selected-channel[1]</path>
            <path>/instrumentation/tacan/frequencies/selected-channel[2]</path>
            <path>/instrumentation/tacan/frequencies/selected-channel[3]</path>
            <path>/instrumentation/tacan/frequencies/selected-channel[4]</path>
        </aircraft-data>
       
  </sim>

  <!--Engine -->

  <controls>
    <engines>
      <run1 type="bool">true</run1>
      <start1 type="bool">false</start1>
      <abort1 type="bool">false</abort1>     
    </engines>
 
    <gear>
      <brake-parking type="double">1</brake-parking>
    </gear>
   
    <lighting>
        <nose-light type="bool">1</nose-light>
    </lighting>
  </controls>

  <!-- Keyboard Shortcuts -->

  <input>
    <keyboard include="keyboard.xml"/>
  </input>

  <!-- Settings -->

  <fdm>
    <jsbsim>
      <systems>
        <canopy>
          <command type="double">0</command>
          <position type="double">0</position>
        </canopy>
      </systems>
      <propulsion>
        <engine>
          <thrust-coefficient type="double">0</thrust-coefficient>
        </engine>
      </propulsion>
    </jsbsim>
  </fdm>

  <systems>
    <electrical>
      <outputs>
        <comm n="0" type="float">28</comm>
        <comm n="1" type="float">28</comm>
      </outputs>
    </electrical>
  </systems>

  <consumables>
    <fuel>
      <tank n="0">
        <level-gal_us archive="y">118</level-gal_us>
      </tank>
      <tank n="1">
        <level-gal_us archive="y">118</level-gal_us>
      </tank>
    </fuel>
  </consumables>

  <!--Instruments -->

  <instrumentation>
    <audio-panel>
         <serviceable type="bool">1</serviceable>
    </audio-panel>
   
    <transponder> #originally had input tag within
        <serviceable type="bool">1</serviceable>
    </transponder>
   
    <nav n="0">
      <serviceable type="bool">1</serviceable>
    </nav>
   
    <nav n="1">
      <serviceable type="bool">1</serviceable>
    </nav>
   
    <comm n="0">
      <serviceable type="bool">1</serviceable>
    </comm>
   
    <comm n="1">
      <serviceable type="bool">1</serviceable>
    </comm>
   
    <airspeed-indicator>
      <limit-indicated-speed-kt type="double">280</limit-indicated-speed-kt> 
      <index n="0" type="double">95</index>
      <index n="1" type="double">145</index>
    </airspeed-indicator>
   
    <g-meter>
      <g-max archive="y" type="double">1</g-max>
      <g-min archive="y" type="double">1</g-min>
    </g-meter>
  </instrumentation>

  <!--Effects -->

  <gear>
    <gear n="0">
      <tyre-smoke type="int">0</tyre-smoke>
      <sprayspeed-ms type="double">0</sprayspeed-ms>
      <spray-density type="double">0</spray-density>
      <caster-angle-deg-damped type="double">0</caster-angle-deg-damped>
    </gear>
    <gear n="1">
      <tyre-smoke type="int">0</tyre-smoke>
      <sprayspeed-ms type="double">0</sprayspeed-ms>
      <spray-density type="double">0</spray-density>
    </gear>
    <gear n="2">
      <tyre-smoke type="int">0</tyre-smoke>
      <sprayspeed-ms type="double">0</sprayspeed-ms>
      <spray-density type="double">0</spray-density>
    </gear>
  </gear>

  <engines>
    <engine n="0">
      <fuel-flow_pph type="float">0</fuel-flow_pph>
      <running>false</running>
    </engine>

    <engine n="0">
      <rpm type="double">1000</rpm>
    </engine>
  </engines>

  <!--Nasal -->
  <nasal n="0">
    <PC9M>
      <file>Aircraft/PC-9M/Nasal/AFDS.nas</file>
      <file>Aircraft/PC-9M/Nasal/systems.nas</file>
      <file>Aircraft/PC-9M/Nasal/liveries.nas</file>
      <file>Aircraft/PC-9M/Nasal/light.nas</file>
      <file>Aircraft/PC-9M/Nasal/limits.nas</file>
      <file>Aircraft/PC-9M/Nasal/vhf22.nas</file>
      <file>Aircraft/PC-9M/Nasal/vir32.nas</file>
      <file>Aircraft/PC-9M/Nasal/crash.nas</file>
      <file>Aircraft/PC-9M/Nasal/rain.nas</file>
      <file>Aircraft/PC-9M/Nasal/light-manager.nas</file>
      <file>Aircraft/PC-9M/Nasal/math_ext.nas</file> # not certain if this file is needed
      <file>Aircraft/PC-9M/Nasal/logger.nas</file> # not certain if this file is needed
    </PC9M>
    <dialogs>
      <file>Aircraft/PC-9M/Nasal/dialogs.nas</file>
    </dialogs>
    <engine_panel>
      <file>Nasal/engines.nas</file>
    </engine_panel>
    <dmesw>
      <file>Aircraft/PC-9M/Nasal/dmesw.nas</file>
    </dmesw>
    <tyresmoke>
      <file>Aircraft/PC-9M/Nasal/tyresmoke.nas</file>
    </tyresmoke>
    <pc-engine>
      <file>Aircraft/PC-9M/Nasal/pc-engine.nas</file>
      <module>pc</module>
    </pc-engine>
  </nasal>

</PropertyList>

Should I have used a more explicit file path?
V/r,
Eric
*******************************************************************
Intel Core i7-3520M CPU @ 2.9GHz, 16 GB RAM, 64-bit OS, x64-based processor
HP EliteBook 8770W
AMD FirePro M4000 1GB
Windows 10 Home
Flightgear 2018.2.2
skipper0802
 
Posts: 24
Joined: Tue Apr 24, 2018 3:12 pm
Location: Seattle, Washington, USA
Callsign: 0802SK, skipper0802
Version: 2018.2.2
OS: Windows10 Home

Re: Implementing light-manager.nas in the PC-9M

Postby skipper0802 » Tue Sep 18, 2018 5:15 am

Oh Crap I think I found the problem...I've been editing the light-manager.nas in my local c172p file instead of the light-manager.nas file in the PC-9M directory. Sorry in advance for wasting everyone's time. Noob error. The file path doesn't show in my "file open" area of my code editor unless I hold my mouse cursor over it. Jeez.
Sorry again
Using the correct .nas file now...https://www.dropbox.com/s/v4fz2c9dfzr3siv/UsingtheRIGHTFILE.png?dl=0
Much better now.
V/r,
Eric
*******************************************************************
Intel Core i7-3520M CPU @ 2.9GHz, 16 GB RAM, 64-bit OS, x64-based processor
HP EliteBook 8770W
AMD FirePro M4000 1GB
Windows 10 Home
Flightgear 2018.2.2
skipper0802
 
Posts: 24
Joined: Tue Apr 24, 2018 3:12 pm
Location: Seattle, Washington, USA
Callsign: 0802SK, skipper0802
Version: 2018.2.2
OS: Windows10 Home

Re: Implementing light-manager.nas in the PC-9M

Postby wlbragg » Tue Sep 18, 2018 5:17 am

:D
Kansas(2-27-15)/Ohio/Midwest scenery development.
KEQA (2-27-15), 3AU, KRCP Airport Layout
User avatar
wlbragg
 
Posts: 4914
Joined: Sat Aug 25, 2012 11:31 pm
Location: Kansas (Tornado Alley), USA
Callsign: WC2020
Version: next
OS: Win10/Debain/nVGT640

Re: Implementing light-manager.nas in the PC-9M

Postby skipper0802 » Fri Sep 21, 2018 2:19 am

Until I further refine the light setup...this works for me at KBFI :D

Image
V/r,
Eric
*******************************************************************
Intel Core i7-3520M CPU @ 2.9GHz, 16 GB RAM, 64-bit OS, x64-based processor
HP EliteBook 8770W
AMD FirePro M4000 1GB
Windows 10 Home
Flightgear 2018.2.2
skipper0802
 
Posts: 24
Joined: Tue Apr 24, 2018 3:12 pm
Location: Seattle, Washington, USA
Callsign: 0802SK, skipper0802
Version: 2018.2.2
OS: Windows10 Home

Re: Implementing light-manager.nas in the PC-9M

Postby Thorsten » Fri Sep 21, 2018 5:13 am

Oh Crap I think I found the problem...I've been editing the light-manager.nas in my local c172p file instead of the light-manager.nas file in the PC-9M directory.


Happens to all of us...
Thorsten
 
Posts: 11106
Joined: Mon Nov 02, 2009 8:33 am


Return to Systems

Who is online

Users browsing this forum: No registered users and 1 guest