Yep, this can be done in scripting, Zoranvedek is on the right lines.
There are two easy ways I can think of. To delay by a number of frames:
When you want the delay to start, set a variable to 0. Have a script running once every frame, to increment the variable by 1. Have another part of the script running so that when the variable exceeds 20, to then go on and do something else.
If you're using 20 frames per second, this would pause the movie for one second.
ie.
In the starting script:
status="BeforeWait"
In a script running once per frame in the movie:
if (status=="BeforeWait")
{
// All the other stuff you want to do before the wait
}
if (status=="StartWait")
{
counter=0
status="NowWaiting"
}
if (status=="NowWaiting")
{
counter+=1
if (counter>20)
{
status="FinishedWaiting"
}
}
if (status=="FinishedWaiting")
{
// All the stuff you want to do after the wait is completed
}
On a button when you want the delay to start, add an 'On Button Up' script of:
status="StartWait"
For longer delays, change the line : if (counter>20) to be a bigger number. If your movie doesn't run at 20 frames per second, change this accordingly.
If you need it to be a strict time delay, then the same principle can be used with the time variables, or probably the better one would be the timer() function, which just returns a number rather than having to mess about with hours, minutes, seconds, days, etc.
ie.
In the starting script:
status="BeforeWait"
In a script running once per frame in the movie:
if (status=="BeforeWait")
{
// All the other stuff you want to do before the wait
}
if (status=="StartWait")
{
counter=getTimer()
status="NowWaiting"
}
if (status=="NowWaiting")
{
if (getTimer()>(counter+1000))
{
status="FinishedWaiting"
}
}
if (status=="FinishedWaiting")
{
// All the stuff you want to do after the wait is completed
}
On a button when you want the delay to start, add an 'On Button Up' script of:
status="StartWait"
This would wait 1000 milliseconds. The method you use probably depends on if you want to wait for a number of frames, or for a specific amount of time.
Morgan.
Bookmarks