Jump to content

Search the Community

Showing results for tags 'code'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General X-Plane Discussion
    • General Discussion
    • File Library Submissions
    • Help!?!
    • Communal Links
    • Screenshots
    • Videos
    • X-Plane News [Official News]
    • X-Pilot Features
  • Developers
    • Plugin Development
    • UDP Development
    • Aircraft Development
    • Scenery Development
  • Freeware Projects
    • XMidiCtrl
  • Commercial Vendors
    • 4Forces
    • Attitude Simulations
    • Hot Start
    • ITX-Designs (Formerly Icarus)
    • IXEG
    • JGX-Designs
    • JRollon
    • Leading Edge Simulations
    • Maxx-XP
    • PilotEdge
    • RealScenery
    • RealSimGear
    • Real Environment Simulations
    • TOGA Simulations
    • TorqueSim/AFM
    • Uncle Jack Simulations
    • X-Plugins
  • Miscellaneous
    • Hardware
    • Software
  • X-Plane 101
    • I'm New To X-Plane!
    • Best of the Best!
  • Workshop
    • 3D Shop
  • Add-On Reviews
    • Reviews

Categories

  • News
  • Aircraft
  • Scenery
  • Plugins
  • X-Pilot Website
  • Sales & Deals
  • General Information

Categories

  • Aircraft
    • Experimental
    • Fighters
    • General Aviation
    • Gliders
    • Heavy Metal
    • Helicopters
    • Mega-Planes
    • Seaplanes
    • VTOL
    • X-Planes
  • Scenery
    • DSF Scenery Packages
    • Objects
    • Misc Scenery Resources
  • Liveries
    • Business Aviation
    • Experimental
    • Fighters
    • General Aviation
    • Helicopters
    • Heavy Metal
    • Vintage
  • Plugins and Utilities

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. As some might noticed, I'm working on updating the Avanti II with more functionality using Gizmo. I came up to something a bit challenging (at least for my limited skills) and thought to share the code if any one want to use it. Please free to comment or indicated a better way of doing this. The challenge: Avanti's AP annunciates on PFD if the selected nav source is FMC or NAV or LOC, and if the nav/loc is active. For example, if you set as source a VOR frequency and it is not in reach you get no indication. What might is the challenging part is to check is the nav frequency is a VOR or ILS. Good thing, that makes things easier, is that VORs and ILSs are using different frequencies. Note: I'm using Columbia 400 as a testbed to check the code before transferring it to Avanti. Here we go: nav1_act=dref.getDataref("sim/cockpit/radios/nav1_freq_hz") -- Read the nav1 frequency. loc_is_alive=dref.getDataref("sim/cockpit2/radios/indicators/nav1_display_horizontal") --Check if we have a valid VOR/LOC signal. loc_or_nav=dref.newInt("columbia/datarefs/loc_or_nav") --Custom dataref to set to NAV or LOC. font1 = font.getFont(xp.getFolder() .."Aircraft/General Aviation/Columbia-400/scripts/fonts/display_f1.ttf", 20) --Our font to use for drawing text. function nav_is_loc() -- our function to check for NAV or LOC frequncy. local Localizer_freq = {10810,10815,10830,10835,10850,10855,10870,10875,10890,10895, 10910,10915,10930,10935,10950,10955,10970,10975,10990,10995, 11010,11015,11030,11035,11050,11055,11070,11075,11090,11095, 11110,11115,11130,11135,11150,11155,11170,11175,11190,11195} --This table contains all the ILS possible frequencies. for _,loc_val in ipairs(Localizer_freq) do --Here we are doing our check against the table of frequencies. if loc_val==dref.getInt(nav1_act) then dref.setInt(loc_or_nav, 1) break --If the nav1 frequncy exists in the table set our custom dataref to 1. else dref.setInt(loc_or_nav, 0) --otherwise set it to 0. end --of if. end --of do. end --of function. function main() nav_is_loc() -- We put our function here to do the check every frame (right???). end function OnDraw_Gauges_3D() --Now we are going to draw on our 3D cockpit displays. gfx.setState( 0, --fog 0, --numTexUnits, 0, --lighting, 1, --alphaTest, 1, --alphaBlend, 0, --depthTest, 0 --depthWrite ) gfx.texOff() if (dref.getInt(loc_is_alive)==1) then --Now we check if you are getting VOR or LOC signal. if (dref.getInt(loc_or_nav)==1) then --If our custom dataref is 1 (as setted by our function...on top). gfx.setColor(1.0,0.0,1.0,1.0) -- Magenta color font.drawString(font1, "LOC", 450, 350) --Draw the "LOC" on the coords. else gfx.setColor(0.0,1.0,0.0,1.0) -- In any other case, set color to green font.drawString(font1, "NAV", 450, 350) -- and draw "NAV". end --of 2nd if. end --end of 1st if. end --OnDraw_Gauges_3D
×
×
  • Create New...