Air Manager Community Library

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Post Reply
Message
Author
User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Air Manager Community Library

#1 Post by Sling »

As promised. The start of a collection of useful functions designed to help community development of instruments. I've started things off in version 1.00 with the following couple of functions.

1. curved text on canvas
2. compass rose on canvas
Attachments
AM Community Library v1.00.siff
(9.68 KiB) Downloaded 369 times

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Air Manager Community Library

#2 Post by Keith Baxter »

Hi

Coordinate manipulation.
Going to add this one here so they are all in one place.
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Air Manager Community Library

#3 Post by Keith Baxter »

@Sling

Can you please do one based on date and time. The standard java string "date and time" formatting does not work in AM.

https://dzone.com/articles/java-string-format-examples

The one I am interested in is formatting decimal minuets into H:M:S

example
517.98 decimal seconds = 8:37:59

And then to show only H:M or only M:S when less than one hour.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Air Manager Community Library

#4 Post by Sling »

Had a few spare minutes so i added time formatting just for you @Keith Baxter .

Enjoy.

Tony

AM Community Library v1.01.siff
(11.55 KiB) Downloaded 346 times

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Air Manager Community Library

#5 Post by Keith Baxter »

Sling wrote: Tue Oct 27, 2020 11:29 am Had a few spare minutes so i added time formatting just for you @Keith Baxter .
Awesome Tony,

That would have taken me a few days to do. :mrgreen:
ice_screenshot_20201027-135011.png
No guessing what I want it for... Yes the ETE's and ETA's and FUEL REM.

Oh.. That compass rose will also find it's place in there.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Air Manager Community Library

#6 Post by Keith Baxter »

Hi,

This code by Corjan helps in reducing dataref fires.

Code: Select all

function xpl_dataref_subscribe_trottle(...)
    -- Local variables
    local args = {...}
    local user_callback = args[#args - 1]
    local delta_ms = table.remove(args, #args)
    local data = nil
    
    -- Replace the user callback with our own
    args[#args] = function (...)
        data = {...}
    end
    
    -- Do the actual subscribe
    xpl_dataref_subscribe(table.unpack(args))
    
    -- Start a timer that will fire the callback on requested interval
    timer_start(0, delta_ms, function()
        if data ~= nil then
            user_callback(table.unpack(data))
            data = nil
        end
    end)
end

function new_xpl_data(altitude, baro, battery, ap_altitude)
    print(altitude)
end

xpl_dataref_subscribe_trottle("sim/flightmodel/misc/h_ind", "FLOAT",
                              "sim/cockpit2/gauges/actuators/barometer_setting_in_hg_pilot", "FLOAT",
                              "sim/cockpit/electrical/battery_on", "INT", 
                              "sim/cockpit/autopilot/altitude", "FLOAT", new_xpl_data, 1000)
Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Air Manager Community Library

#7 Post by Keith Baxter »

@Ralph

Can we please make this thread a sticky. It is so hard to find and refer members to. I think it will attract air to other creatives


Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Air Manager Community Library

#8 Post by Keith Baxter »

@Ralph

Awesome. Thank you.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

Post Reply