• 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.

P3Dv4 Material Scripting

so if i just type L:XXX in modelDef.xml
it is created and ready to use ? no need to initiate it like A VARS?
 
That is correct. In this example, I'm "creating" a new control variable for the left landing light:
XML:
  <PartInfo>
    <Name>ATR_light_landing_left_ON</Name>
    <Visibility>
      <Parameter>
        <Code>
          (A:ELECTRICAL MASTER BATTERY,bool)
          (L:LAND_L, number) and
        </Code>
      </Parameter>
    </Visibility>
  </PartInfo>

Here is the animation and mouse control script:
XML:
  <PartInfo>
    <Name>ATR_LAND_L</Name>
    <AnimLength>10</AnimLength>
    <Animation>
      <Parameter>
        <Code>(L:LAND_L, number) 10 *</Code>
      </Parameter>
    </Animation>
    <MouseRect>
      <Cursor>HAND</Cursor>
      <MouseFlags>LeftSingle</MouseFlags>
      <CallbackCode>0x110B3 (&gt;L:LVEVENT, number)</CallbackCode>
    </MouseRect>
  </PartInfo>

Notice that the mouse control is being sent to a C++ logic controller as a hex number sent via another L:var (>L:LEVENT,number) to an event handler, which in turn controls the value of (L:LAND_L, number)

While I could control the local (L:LAND_L, number) variable directly in the <MouseRect>, doing it this way is a positive check that the actual logic controller is working properly. So, if you click on a switch and nothing happens... that means your logic controller isn't working properly! :eek:

Now what I cannot tell you is whether this applies to a Lua script at all is something else. I've not yet dived into the PDK or Lua at all...
 
i found that combining simconnect, PDK, LUA, and VARS can make great addons

thank you for the explanation, i'll check it out :)
 
Hi!

Maybe someone has already dealt with the topic and can help here :)

It's about the taillights of a car that are presented via PBR textures. When it gets dark, the Night Texture is automatically turned on (AdditiveNightOnly). That was the old standard procedure for objects in the FSX:

p3dv4_porsche_lua_script_taillights.jpg



My goal is that the Night Map is not automatically switched on, but by the Nav Lights Switch. The developers of the P3Dv4 have provided the LUA material scripting for such things and I would like to use this elegant option -> LUA Material Script.

Does anyone know how to approach this idea?
 
My question has already been settled. :)
The answer was given by Manfred Jahn : Did this test with an aircraft model ...

For this enormous knowledge fund I love this forum :)

...

In a slightly modified form, the LUA script looks like this:

Code:
!lua
if varget("A:LIGHT STATES", "Mask") & 0x0004 > 0 then
  varset("T:EmissiveTexture", "string", "porsche_carrera_gt_emissive.dds")
  varset("T:EmissiveScale", "number", 1.00)
else
  varset("T:EmissiveTexture", "string", "")
end

This script turns on the Night Map of the taillights with the Landing Lights switch:

porsche_lua_script.jpg

The dynamic lights (headlights and taillights) as well as the Night Map are switched on via the Landing Lights Switch
 
My question has already been settled. :)
The answer was given by Manfred Jahn : Did this test with an aircraft model ...

For this enormous knowledge fund I love this forum :)

...

In a slightly modified form, the LUA script looks like this:

Code:
!lua
if varget("A:LIGHT STATES", "Mask") & 0x0004 > 0 then
  varset("T:EmissiveTexture", "string", "porsche_carrera_gt_emissive.dds")
  varset("T:EmissiveScale", "number", 1.00)
else
  varset("T:EmissiveTexture", "string", "")
end

This script turns on the Night Map of the taillights with the Landing Lights switch:

View attachment 51932
The dynamic lights (headlights and taillights) as well as the Night Map are switched on via the Landing Lights Switch
Thank you for the example, it worked perfectly for the panel lights using PBR textures.

For others who are late to the party, here are the "light on states"

LIGHT ON STATES:

Bit mask:
0x0001: Nav
0x0002: Beacon
0x0004: Landing
0x0008: Taxi
0x0010: Strobe
0x0020: Panel
0x0040: Recognition
0x0080: Wing
0x0100: Logo
0x0200: Cabin

Rotorhub
 
Back
Top