Log in

View Full Version : Display Time Script Problem


Blaze_Heatnix
23rd June 2010, 22:46
I am using this script:

AVISource("videofile.avi")

function counter(clip clip, int n)
{
n = n / clip.framerate()
min = int(n / 60)
mins = string(min)
mins = min < 10 ? "0" + mins : mins
n = n - min * 60
sec = int(n)
secs = string(sec)
secs = sec < 10 ? "0" + secs : secs
ms = string(int(1000 * (n - sec)))
ms = strlen(ms) < 2 ? "0" + ms : ms
ms = strlen(ms) < 3 ? "0" + ms : ms
time = mins + ":" + secs+ ":" + ms
clip.subtitle(time, x=410, y=440, font="chickenscratch aoe", size=28, text_color=$ffffff, halo_color=$000000, first_frame=131, last_frame=18159)

}
scriptclip("counter(current_frame)")

It works just fine, but I want the timer to start at about 00:04:000 in the video. The time starts counting from there, but the time shows 00:04:000 when it starts and I want it to start counting from 00:00:000 when 00:04:000 comes up in the video. How do I do that?

Gavino
23rd June 2010, 23:27
Change the last line to
scriptclip("counter(current_frame-131)")

Blaze_Heatnix
23rd June 2010, 23:34
Change the last line to
scriptclip("counter(current_frame-131)")

Oh I see! Thank you very much, it works great now!

IanB
24th June 2010, 01:31
Why not give ShowTime() a try, it is very close to the formatting of your counter function and it will avoid the need for that nasty ScriptClip().Trim(0, 130)+Trim(131, 18159).ShowTime (x=410, y=440, font="chickenscratch aoe", size=28, text_color=$ffffff, halo_color=$000000)+Trim(18160, 0)