Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple timers starTimer

Status
Not open for further replies.

styleBunny

Technical User
Jun 20, 2002
133
0
0
AU
ARE YOU READY KIDS?

in my director movie i have 3 events i want to control via 3 different timers.

Basically the timer is assigned to a variable, that counts up to 10 the when that variable = 10 subtract 1 from another variables value, then reset the timer and it all begins again. Obviously when i use startTimer to reset the timer it effects the value of the other two variables referencing the timer.

i looked at the help and it suggest managing your own timers with behaviours or parent scripts.

has anyone encounted this before?

thanks
p.
 
AYE AYE CAPTAIN!

this works i think...

i set gTimer to = the timer elsewhere in the movie
each time gTimer reaches 5 it adds 1 to gCount and resets itself to zero and begins again. When gCount reaches certain values along the way it subracts 1 from the specified variable. I jumbled up the order as gCount counts thru 1-10 to make it look a little more random when all variables have been thru the cycle once it begins again.

please comment / suggest etc...

on exitFrame
--Declare globals
global gTimer, gCount, gFeed, gEnt, gClean

--add 1 to gCount everytimer gTimer(the timer) = 5 and restart the timer
if gTimer > 5 then
gCount = gCount + 1
startTimer
end if

--when gCount = 3 remove 1 from the gFeed value
if gCount = 1 then
gFeed = gFeed - 1
gCount= gCount + 1 --to skip over the 5 seconds that gCount = 1
end if

if gCount = 4 then
gEnt = gEnt - 1
gCount= gCount + 1 --to skip over the 5 seconds that gCount = 4
end if

if gCount = 6 then
gFeed = gFeed - 1
gCount= gCount + 1 --to skip over the 5 seconds that gCount = 6
end if

if gCount = 8 then
gClean = gClean - 1
gCount= gCount + 1 --to skip over the 5 seconds that gCount = 8
end if

if gCount = 10 then
gEnt = gEnt - 1
gCount = 0 --back to the begining
end if

end
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top