• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

LUA gauge implementation?

Messages
20
Country
us-indiana
I’ve developed a gauge using lua script that works great. Is there a way to implement this into the vc of an aircraft?
 
I'm not sure if i understand well your question, but in the understanding that you lua script is inside an xml file .. them you only need to add a line on the panel.cfg like any other xml gauge. take look on the tipical example about P3DRadar

Code:
<?xml version="1.0" encoding="UTF-8"?>
<SimBase.Document  Type="AceXML" version="1,0"  id="F1EE Radar">
    <Descr>P3DRadarTexture</Descr>
    <SimGauge.Gauge id="Gauge" ArtDirectory="C:\Prepar3D\SDK\Panels and User Interface\Panels\XML Gauge samples">
        <FloatPosition>0.000,0.000</FloatPosition>
        <Size>1024,1024</Size>
        <Element FloatPosition="1.000,1.000">
        <Visibility>(L:ELEC_AC_MAIN1_BUS, Bool)</Visibility>
            <Texture Name="P3DRadarTexture" Width="1024" Height="1024" />
        </Element>
        <MouseArea id="MouseArea all">
            <FloatPosition>0.000,0.000</FloatPosition>
            <Size>1024,1024</Size>
            <CursorType>Normal</CursorType>
            <MouseArea>
                <FloatPosition>1.0,1.0</FloatPosition>
                <Size>1024,1024</Size>
                <CursorType>Hand</CursorType>
                <MouseClick id="MouseClick">
                    <Script>!lua
                    .
                    (your code)
                    .
                    </Script>
                    <ClickType>WheelUp+WheelDown+LeftSingle+LeftDrag+LeftRelease</ClickType>
                </MouseClick>
            </MouseArea>
        </MouseArea>
 
I'm not sure if i understand well your question, but in the understanding that you lua script is inside an xml file .. them you only need to add a line on the panel.cfg like any other xml gauge. take look on the tipical example about P3DRadar

Code:
<?xml version="1.0" encoding="UTF-8"?>
<SimBase.Document  Type="AceXML" version="1,0"  id="F1EE Radar">
    <Descr>P3DRadarTexture</Descr>
    <SimGauge.Gauge id="Gauge" ArtDirectory="C:\Prepar3D\SDK\Panels and User Interface\Panels\XML Gauge samples">
        <FloatPosition>0.000,0.000</FloatPosition>
        <Size>1024,1024</Size>
        <Element FloatPosition="1.000,1.000">
        <Visibility>(L:ELEC_AC_MAIN1_BUS, Bool)</Visibility>
            <Texture Name="P3DRadarTexture" Width="1024" Height="1024" />
        </Element>
        <MouseArea id="MouseArea all">
            <FloatPosition>0.000,0.000</FloatPosition>
            <Size>1024,1024</Size>
            <CursorType>Normal</CursorType>
            <MouseArea>
                <FloatPosition>1.0,1.0</FloatPosition>
                <Size>1024,1024</Size>
                <CursorType>Hand</CursorType>
                <MouseClick id="MouseClick">
                    <Script>!lua
                    .
                    (your code)
                    .
                    </Script>
                    <ClickType>WheelUp+WheelDown+LeftSingle+LeftDrag+LeftRelease</ClickType>
                </MouseClick>
            </MouseArea>
        </MouseArea>
I'm not sure if i understand well your question, but in the understanding that you lua script is inside an xml file .. them you only need to add a line on the panel.cfg like any other xml gauge. take look on the tipical example about P3DRadar

Code:
<?xml version="1.0" encoding="UTF-8"?>
<SimBase.Document  Type="AceXML" version="1,0"  id="F1EE Radar">
    <Descr>P3DRadarTexture</Descr>
    <SimGauge.Gauge id="Gauge" ArtDirectory="C:\Prepar3D\SDK\Panels and User Interface\Panels\XML Gauge samples">
        <FloatPosition>0.000,0.000</FloatPosition>
        <Size>1024,1024</Size>
        <Element FloatPosition="1.000,1.000">
        <Visibility>(L:ELEC_AC_MAIN1_BUS, Bool)</Visibility>
            <Texture Name="P3DRadarTexture" Width="1024" Height="1024" />
        </Element>
        <MouseArea id="MouseArea all">
            <FloatPosition>0.000,0.000</FloatPosition>
            <Size>1024,1024</Size>
            <CursorType>Normal</CursorType>
            <MouseArea>
                <FloatPosition>1.0,1.0</FloatPosition>
                <Size>1024,1024</Size>
                <CursorType>Hand</CursorType>
                <MouseClick id="MouseClick">
                    <Script>!lua
                    .
                    (your code)
                    .
                    </Script>
                    <ClickType>WheelUp+WheelDown+LeftSingle+LeftDrag+LeftRelease</ClickType>
                </MouseClick>
            </MouseArea>
        </MouseArea>
The entire thing is LUA script now. I did it in air manager but trying to figure out how to convert it to usable in a vc in msfs.
 
In my understanding you can only introduce in VC an xml or dll/gau gauge... so you need to revise the way where a xml with lua script inside on the P3D examples .. for instance the radar example or the clock example on this link

https://www.prepar3d.com/SDKv3/LearningCenter/utilities/scripting/lua_scripting.html
Ok I’ll give it a look. This is for fs2020/2024 My lua script is based on referencing pngs in a resource file. Does the xml allow for that? I’m still incredibly new to all this but have managed to get this 700+ line code to work great.
 
Back
Top