How To Create a panel Script

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Post Reply
Message
Author
User avatar
Keith Baxter
Posts: 4671
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

How To Create a panel Script

#1 Post by Keith Baxter »

Hi

Where does one start?

A tutorial might assist ??? :D @Sling there is an appetite for this. @Ralph @Corjan

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
Ralph
Posts: 7867
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: How To Create a panel Script

#2 Post by Ralph »

Depends on what you want to do :)

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

Re: How To Create a panel Script

#3 Post by Keith Baxter »

Ralph wrote: Sat Jul 31, 2021 6:54 pm Depends on what you want to do :)
Create a panel script ? ;)

Perhaps how to create a 6 pack would be a good starting point.

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 

Tetrachromat
Posts: 236
Joined: Sun Feb 14, 2021 6:55 pm

Re: How To Create a panel Script

#4 Post by Tetrachromat »

Hi,

I would like to chime in here. Interested as well on the capabilities of the panel logic.

Question 1: Of the API functionality 'Instrument' and 'Layer' functions are marked explicitly as panel functions only. Does it mean all other API function are permitted in the panel logic?

Question 2: What is the scope of variables and functions declared in the panel logic, are they in scope of the panel logic only, or also in the scope of the contained instruments?

Paul

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

Re: How To Create a panel Script

#5 Post by Sling »

Hi,

This is indeed an interesting debate and one that is a little mysterious for most. I’d like to start by saying that these are my impressions and observations after having used panel scripting. It’s fair to say that all my panels have some scripting, a lot of it is the same common stuff for each. So on to the questions raised so far.

Can we have a tutorial for say a basic 6 pack? I think this is not really the purpose of panel scripting as this can easily be achieved but simply adding the instruments to a panel in the home tab and if required creating a panel in create/edit by using the hone tab panel. I already show how to do this in my panel creation/panel backup video. A better example would be where you have say one of more aircraft panel configurations and rather than create a duplicate panel and just change a couple of the instruments for alternatives you can just create one and use panel scripting to select the correct instruments based on the loaded aircraft. I’ve just completed a DR400 panel for the Xplane XPFR and FS2020 default aircraft that uses a single panel that uses panel scripting to select and move instruments based on the sim that’s currently running. I was planning to do a video of this at some point so you’ll get to see that in action at some point. Keith. I’d be happy to drop by Discord sometime to show how the basics of this can work if you’d like. Busy right now but down the track no worries.

Are all other API functions available in the panel logic? As far as I know yes but I haven’t tried every single one. One has to question though why you would use some functions. In Theory I think you could create all the instruments directly on the panel rather than in individual instruments but that would make little sense. I see it used for additional or common functionality that sits over what the instrument do. Some examples of what I use the panel script for are, selecting one instrument over another (see DR400 example above), moving instruments around on the panel, sim view selection, sim operational fixes not particularly related to a single instruments operation.

What is the variable scope? A good question that I don’t have an answer for. However it can easily be checked with a bit of testing. For what it’s worth I’d probably expect the panel to be like another instrument in this regard. So if data needs to be shared between an instrument and the panel then it’s likely iic (inter instrument communication) will be required.

As I said just my experience to date. I continue to look for new ways to use it. :D

Tony

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

Re: How To Create a panel Script

#6 Post by Keith Baxter »

Sling wrote: Sat Jul 31, 2021 11:51 pm Keith. I’d be happy to drop by Discord sometime to show how the basics of this can work if you’d like. Busy right now but down the track no worries.
Tony
Tony,

Thank you for the offer. I have a vague idea as I did play around with it when Corjan first released it. I have had a few queries on the discord so your input would be welcomed.

There is one discord member <stringy> that wants to set up a session next week some time. Perhaps set something up for then with him. He requested on the <Lua Scripting> <help-request> thread.
I will fall in line time wise with the arrangement that suites both of 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 

Tetrachromat
Posts: 236
Joined: Sun Feb 14, 2021 6:55 pm

Re: How To Create a panel Script

#7 Post by Tetrachromat »

Sling wrote: Sat Jul 31, 2021 11:51 pm ... What is the variable scope? A good question that I don’t have an answer for. However it can easily be checked with a bit of testing. For what it’s worth I’d probably expect the panel to be like another instrument in this regard. So if data needs to be shared between an instrument and the panel then it’s likely iic (inter instrument communication) will be required.
My tests show that you are right. Neither code from a panel 'logic.lua' nor code from the 'lib' directory is in the instruments environment.

Additionally I observed that the panel logic is executed after the instruments logic. So the instruments cannot expect the panel to be ready.

Post Reply