PapaX,
I reconfigured my igs file to match the script, where I have ten nodes, named Frame_0 through Frame_9(these are 10 textured planes, layered on top of each other). I even renamed the associated texture/ace files to match (I don't know if that matters). specifically, the nodes are named
1_1000_Frame_1_fx_night, etc... because I only want these nodes at night. There is also a day texture. When I export it and fire it up, the day texture looks great, but when I switch over to night time running, I only have the last frame (Frame_9) showing. No animation. I tinkered around with the time to show each frame, changing it from 10 SEC to 30 SEC to see what would happen, but nothing. It seems like the script isn't 'hooking in' to the igs file. I'm stuck.
I would greatly appreciate some insight, if anyone has the time.
Here's the script again, below:
- Code: Select all
-- set globals
-- assumes the first frame is named Frame_0
gNextFrame = 0;
-- the maximum number of frames, remember we are 0 based
-- so if there are ten frames then the last frame
-- would be Frame_9
MAX_FRAMES = 10;
-- number of seconds to wait till showing the next frame
INTERVAL_SEC = 3
-- initialize, always needed
function Initialise()
SetFrame( 0 );
end
-- update, always needed
function Update( time )
SetFrame( time );
end
-- this is where all the heavy lifting is done
function SetFrame( currTime )
-- loop through each frame every three seconds
-- if the current time is 0 then we are initializing the model
if (math.mod(math.floor(currTime), INTERVAL_SEC) == 0 or currTime == 0) then
local index = 0;
while (index < MAX_FRAMES) do
-- if the frame is equal to the index then turn it on
if (index == gNextFrame) then
Call( "*:ActivateNode", "Frame_" .. index, 1 );
else -- turn the frame off
Call( "*:ActivateNode", "Frame_" .. index, 0 );
end
index = index + 1;
end
-- if we cycled through all the frames then reset to the first frame
if (gNextFrame < MAX_FRAMES) then
gNextFrame = gNextFrame + 1;
else
gNextFrame = 0;
end
end
end
Down another rabbit hole we go....