Panel script not starting

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

Panel script not starting

#1 Post by Detlef »

Hi,

maybe somebody can help me with this. I have a panel with a panel script:

Code: Select all

local THIS_PANEL = 1

local gGroup = group_add()

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

AddInstrument("Flight Control", "2fa3c344-3e29-444d-8966-a146d3147619")
AddInstrument("Fuel Pump Switches", "5f3fdf98-cf3f-47de-b7b5-9b4e13175dc9")
AddInstrument("Standby Power", "518ebdb0-4a93-4477-01bd-514db3230904")
AddInstrument("Generator Switches", "3172aa53-47b5-415e-3366-878815a98a49")
AddInstrument("Pitot and Window Heat", "62f80aa5-b789-4ac3-3963-44fbce630aaf")
AddInstrument("Anti-Ice", "429f27b5-848e-4e9d-b27b-5d77ffa9a720")
AddInstrument("Hydraulics Switches", "fe61bfa7-21f8-4b7e-a4d3-045a198707cf")
AddInstrument("Doors", "283b8204-1550-4770-313b-9591e7ce92b7")
AddInstrument("Bleed", "94fa5175-840e-47c1-2c74-651487865d74")

visible(gGroup, false)

si_variable_subscribe("sivar_activate_panel", "INT", function(v) log("selected: "..v); visible(gGroup, v==THIS_PANEL) end)

log("I'm running happily")
If I start that panel in the create/panel tab, it starts and I see that happy message in the logfile. However, if I start that panel from the Home tab, the script is not running.

Why is that?

Thank you
Detlef

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

Re: Panel script not starting

#2 Post by Sling »

Because they are not the same actual panel even though they may look the same. To make sure you have them the same, load a new one in the Home tab from the one you see listed in the choice of panels. This basically creates it from the create/edit tab version. Once done remove the old one from the Home tab. Now any changes in the script will be reflected in this new Home tab panel.

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

Re: Panel script not starting

#3 Post by Detlef »

Ah, that was very helpful, thank you. It is not really easy with the panel interface. Because I made the panel on the create/edit panel tab from the one on the home tab. And yet afterwards I have to create a new panel, this time from the home tab and selecting the very panel that was created originally from the panel on the home tab...

Thank you
Detlef

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

Re: Panel script not starting

#4 Post by Sling »

When you create a new panel in this way a new UUID is allocated just like with instruments so all you are doing by following my instructions is making the UUID’s the same.

Hopefully that explains why it’s like this.

Post Reply