Multiple panels using one Panel script

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Post Reply
Message
Author
Detlef
Posts: 304
Joined: Mon Nov 16, 2020 9:43 am
Location: Bavaria

Multiple panels using one Panel script

#1 Post by Detlef »

Hi,

I have created overhead instruments for the MSFS PMDG 737 and want to show them when I press a (AM instrument) button on my touch screen. So on the Airmanager Home tab I arranged all instruments I allways want to see for flying. Then I thought I could make a second panel on the Home tab with just the overhead instruments. In a panel script I want to be able to show the overhead instruments with the press of a button.

The only solution I found is to make one panel in the Home tab with all overhead insruments already arrange on top of the other instruments. That is very uncomfortable to do, for example if I want to change instruments below the overhead instruments. My script is:

Code: Select all

WIDTH = 1920
HEIGHT = 1080

local gGroupOverhead = group_add()
-- local gGroupBase = group_add()

local gFrame = canvas_add(0, 0, WIDTH, HEIGHT, function()
  _rect(0, 0, WIDTH, HEIGHT)
  _fill("gray")
end)
z_order(gFrame, 1000)

function AddInstrument(group, name, uuid, offset)
  group_obj_add(group, instrument_get(uuid, offset))
end

-- ================ instruments from overhead panel ====================

AddInstrument(gGroupOverhead, "Overhead Background", "80cd9ce8-3f03-49d9-137f-c5e39ad32f98")
AddInstrument(gGroupOverhead, "Flight Control", "2fa3c344-3e29-444d-8966-a146d3147619")
AddInstrument(gGroupOverhead, "Fuel Pump Switches", "5f3fdf98-cf3f-47de-b7b5-9b4e13175dc9")
AddInstrument(gGroupOverhead, "Standby Power", "518ebdb0-4a93-4477-01bd-514db3230904")
AddInstrument(gGroupOverhead, "Generator Switches", "3172aa53-47b5-415e-3366-878815a98a49")
AddInstrument(gGroupOverhead, "Pitot and Window Heat", "62f80aa5-b789-4ac3-3963-44fbce630aaf")
AddInstrument(gGroupOverhead, "Anti-Ice", "429f27b5-848e-4e9d-b27b-5d77ffa9a720")
AddInstrument(gGroupOverhead, "Hydraulics Switches", "fe61bfa7-21f8-4b7e-a4d3-045a198707cf")
AddInstrument(gGroupOverhead, "Doors", "283b8204-1550-4770-313b-9591e7ce92b7")
AddInstrument(gGroupOverhead, "Bleed", "94fa5175-840e-47c1-2c74-651487865d74")
AddInstrument(gGroupOverhead, "APU EGT", "15f05f56-760f-4068-af56-c3a0fd64fae8")
AddInstrument(gGroupOverhead, "ENGINE START", "11ae414a-51a7-4bdb-a0e6-bd54124ee5af")

z_order(gGroupOverhead, 99)
-- z_order(gGroupBase, 0)

visible(gFrame, false)
visible(gGroupOverhead, false)
-- visible(gGroupBase, true)

button_add("select-frame.png", nil, 1800, 1000, 60, 40, function() visible(gFrame, true); visible(gGroupOverhead, true) end, nil)
button_add("select-frame.png", nil, 1860, 1000, 60, 40, function() visible(gGroupOverhead, false); visible(gFrame, false) end, nil)
It does work but it is difficult to manage. So how can I get a separation into two panels, one for the forward glareshield instruments for example, and one for the overhead instruments?
I also tried to position all overhead instruments using a panel script. That did work but using viewport_rect on a group of instruments did not work correctly. So I forgot that.

(BTW: I did no see that using z_order had any effect.)

Thank you
Detlef

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

Re: Multiple panels using one Panel script

#2 Post by Sling »

Hi Detlef,

I’m not really sure what you want out of this but if you are set on controlling one panel from another you will need iic (inter instrument communication). The basics are covered on the wiki and the YouTube tutorial videos. I also have a video on my channel (linked below) about panel scripting if that helps at all.

Detlef
Posts: 304
Joined: Mon Nov 16, 2020 9:43 am
Location: Bavaria

Re: Multiple panels using one Panel script

#3 Post by Detlef »

Hi Tony,
thank you for your reply.
Doing inter instrument communication in panel scripts, I did not think of that. Maybe I try.

I think I do not fully understand the concept of the tab create/edit panels. Is it to start multiple panels at once? If so which one is on top? I cannot reorder them. And there is only one panel script per tree

If I use inter instrument communication as said above, I need to start two panel trees at once. I did not try that. I am not at home right now, will try later.

Thank you
Detlef

Post Reply