LUA script for seasonal textuers

Discussion related to terrain/scenery design.
MKMatt
Posts: 7
Joined: Sat Nov 23, 2013 11:51 pm

LUA script for seasonal textuers

Postby MKMatt » Thu Oct 18, 2018 12:39 pm

Hi,

I've been trying to add LUA script to my scenery. However the final result is that the material is not visible.

Here's what I've done:
!lua
local month = varget("E:ZULU MONTH OF YEAR", "Number")
local StringOld = varget("T:DiffuseTexture", "String")
local StringNew
if month > 9 then
StringNew=string.sub(StringOld,1,12) .. "_WI.DDS"
elseif month > 8 then
StringNew=string.sub(StringOld,1,12) .. "_FA.DDS"
elseif month > 5 then
StringNew=string.sub(StringOld,1,12) .. ".DDS"
else
StringNew=string.sub(StringOld,1,12) .. "_WI.DDS"
end
varset("T:DiffuseTexture","String",StringNew)
Then I've created another folder 'scripts' with 'texture' folder inside. I moved LUA and textures there that should be used by my object.

Image

Image

I want to keep the scripts in my project folder, I also added the entry to add-on.xml so it looks like this:
<?xml version="1.0" encoding="utf-8"?>
<SimBase.Document Type="AddOnXml" version="4,0" id="add-on">
<AddOn.Name>Airport test</AddOn.Name>
<AddOn.Description>Airport</AddOn.Description>
<AddOn.Component>
<Category>Scripts</Category>
<Path>scripts</Path>
</AddOn.Component>
<AddOn.Component>
<Category>Effects</Category>
<Path>effects</Path>
</AddOn.Component>
<AddOn.Component>
<Category>Scenery</Category>
<Path>scenery</Path>
<Name>Airport scenery</Name>
</AddOn.Component>
<AddOn.Component>
<Category>Texture</Category>
<Path>texture</Path>
<Type>WORLD</Type>
</AddOn.Component>
<AddOn.Component>
<Category>Texture</Category>
<Path>scripts\texture</Path>
<Type>GLOBAL</Type>
</AddOn.Component>
</SimBase.Document>
I also tried to put them into P3D main/Scripts folder to check however result remain the same - material is not visible, but BGL is loaded.

I tried to follow the SDK here, however I can't find any other tips for this.

Kind regards,
Matt

Clifton Crane
Lockheed Martin
Posts: 888
Joined: Tue Sep 25, 2012 2:34 pm

Re: LUA script for seasonal textuers

Postby Clifton Crane » Thu Oct 18, 2018 9:29 pm

Hi Matt,

Do you have any Content Errors being reported? This setting first needs to be enabled, then the ContentErrorReport.txt file will be output to your Documents\Prepar3D v4 Files directory.

Thanks.
Clifton Crane
Prepar3D® Software Engineer

MKMatt
Posts: 7
Joined: Sat Nov 23, 2013 11:51 pm

Re: LUA script for seasonal textuers

Postby MKMatt » Fri Oct 19, 2018 8:13 am

Hi!

Thank you for quick reply.

I checked content errors and there's one message related to the texture:
[error.27]
error=Texture GRASS_3D.DDS.DDS failed to load (FE_REQUEST_STATUS==13)
There seems to be a problem in the file extension being added twice to the file name. I modified texture name in BGL file and removed .DDS from it but it didn't solve the case.

Kind regards,
Matt

MKMatt
Posts: 7
Joined: Sat Nov 23, 2013 11:51 pm

Re: LUA script for seasonal textuers

Postby MKMatt » Tue Oct 30, 2018 10:18 am

Hi,

Do you happen to have any idea about this?

I couldn't solve this out.

Thank you,


Return to “Scenery Development Questions”

Who is online

Users browsing this forum: No registered users and 3 guests