logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
alexbyrd  
#1 Posted : Thursday, October 8, 2020 12:52:53 AM(UTC)
alexbyrd

Rank: Member

Groups: Registered
Joined: 5/3/2015(UTC)
Posts: 10
Location: UK

Was thanked: 3 time(s) in 2 post(s)
Here is a very simple script that will work with a countdown timer made in GT designer - dropbox link attached.

as it gets closer to the end of the countdown it goes from green (plus 5 mins) to yellow (5 - 2 mins) to red (0 - 2 mins) and flashes red/white once it runs out of time.

It uses the countdownclock.gtzip which is just a simple countdown timer.

Its been working on multiple events and keeping speakers to time as best as possible, as we send it back on a reverse feed on all the vimxcallers.

As far as I can tell It does not handle time that crosses midnight - as most of the events I do are across the day its not been an issue.

Hope someone finds it useful or as a bit of a jump start into scripting in vmix, as there is not much to go on sometimes.

Enjoy.


https://www.dropbox.com/...ountdownclock.gtzip?dl=0

here's is the script for vmix scripting.

dim i As Integer
dim time1 as String
dim hourset as String
dim minset as String
dim secset as String
dim Timemake as string
dim date1 as DateTime
dim remainingtime as TimeSpan
dim rightnow as dateTime
dim flashx as Boolean
dim tClose as Integer
dim tAlmost as Integer


' set parameters
flashx = false
i = 1
tClose = (5*60) ' set to 5 mins - is number of seconds
tAlmost = (2*60) ' set to 2 mins - - is number of seconds

Do Until i = 2

' if you don't have countdownclock.gtzip and a field called Countdown.Text it won't do much
dim content as string = Input.Find("countdownclock.gtzip").Text("CountDown.Text")
'Console.WriteLine(content)
'Console.WriteLine(content.Substring(3,2))
'Console.WriteLine(content.Substring(6,2))
'Console.WriteLine(content.Substring(9,2))
'Console.WriteLine(System.DateTime.Now.ToLongTimeString + " " + content)
rightnow = DateTime.Now
hourset = content.Substring(3,2)
minset = content.Substring(6,2)
secset = content.Substring(9,2)

Timemake = hourset & ":" & minset &":" & secset
'Console.WriteLine(Timemake)
Try
date1 = Convert.ToDateTime(Timemake)
Catch ex As System.Exception
' nothing
End Try
remainingtime = date1.Subtract(rightnow)
console.Writeline("Time Left -" +remainingtime.TotalSeconds.Tostring)


If remainingtime.TotalSeconds > tClose then
API.Function("SetTextColour",Input:="countdownclock.gtzip",Value:="40,200,40")
Else if remainingtime.TotalSeconds < tAlmost then
API.Function("SetTextColour",Input:="countdownclock.gtzip",Value:="255,40,40")
Else
API.Function("SetTextColour",Input:="countdownclock.gtzip",Value:="Yellow")
End if

' Flash when out of time.
if remainingtime.TotalSeconds < 1 then
if flashx = true then
API.Function("SetTextColour",Input:="countdownclock.gtzip",Value:="255,255,255")
flashx = false
Else
API.Function("SetTextColour",Input:="countdownclock.gtzip",Value:="255,40,40")
flashx = true
End if
End if

Sleep (300)

Loop

thanks 2 users thanked alexbyrd for this useful post.
doggy on 10/8/2020(UTC), TobinT on 11/20/2020(UTC)
JessShake  
#2 Posted : Wednesday, October 13, 2021 1:16:41 AM(UTC)
JessShake

Rank: Member

Groups: Registered
Joined: 2/9/2021(UTC)
Posts: 10
United States
Location: Oklahoma

Thanks: 2 times
That is fantastic! Could you point me in the direction of modifying this to work with a countdown timer instead of a countdown clock?
Aecast  
#3 Posted : Tuesday, October 19, 2021 12:26:58 PM(UTC)
Aecast

Rank: Advanced Member

Groups: Registered
Joined: 3/25/2020(UTC)
Posts: 45
United Kingdom
Location: Chichester

Was thanked: 7 time(s) in 6 post(s)
Hi JessShake I modified the great work done by Alexbyrd script idea for those who want to use on the VMIX GT Timers,
so have rewritten to work on the input you set the VMIX GT Timer on and
use the API to compare the countdown time checks.

Also as defined below have set variables so you can change several settings

Variables
InputNo = The Input the GT Timer is on
countdowncolor = The default colour of the countdown

wrapuptime = Presenters first warning for color change i.e 5 minutes = 500
wrapuptimecolor = Colour change for Presenters first warning i.e YELLOW

finalcall = Presenters Second warning for color change i.e 2 minutes = 200
finalcallcolor = Colour change for Presenters second warning i.e RED

flashcolor = When reach 00:00:00 the colour to flash with finalcallcolor

Countdown time checks are calculated by taking the time string and converting to Integer to compare
i.e string "00:05:00" = 5 minutes left = 500. so for example the wrapuptime variable is 500
The countdown value will always be lower than the check values in this format.


'************************************************************************************
'** Color Changing Countdown timer for standard VMIX GT timer - TimerCentre.gtzip **
'**
'** Set variables for your required colour change times
'**

'** InputNo = The input the time is setup on i.e input = 4
Dim InputNo as Integer = 24
'** Set the Countdown timer color when started.
dim countdowncolor AS String = "Orange"

'** wrapuptime = The first time color change to warn time nearly up
'** Countdown Time HH:MM:SS is converted to an integer. 01:10:00 = 11000
'** so 5 minute wrapup is 00:05:00 = 500.
dim wrapuptime as Integer = 500
dim wrapuptimecolor AS String = "Yellow"

'** finalcall = The second time colour change to warn end of presenting
'** Countdown Time HH:MM:SS is converted to an integer. 01:10:00 = 11000
'** so 2 minute finalcall is 00:02:00 = 200.
dim finalcall as Integer = 200
dim finalcallcolor AS String = "Red"

'** Set the flash colour with the finalcallcolor when countdown 00:00:00
dim flashcolor AS String = "Black"

'** set parameters
dim flashtimer as Boolean
dim x as new system.xml.xmldocument
Dim HHMMSS As String()
dim i as integer
dim timevar AS String
flashtimer = false
i = 1

Do Until i = 2

x.loadxml(API.XML())

'Fetch the current countdown time ************************************
dim xmlct As string = x.SelectSingleNode("//input[" & InputNo & "]/text[1]/text()").value

'** Create a time string HHMMSS ***************************************
HHMMSS = xmlct.Split(New Char() {":"c})
timevar = HHMMSS(0) & HHMMSS(1) & HHMMSS(2)

' Convert Time String HHMMSS into a integer i.e 00:05:00 = 500 *******
dim timevarint as integer = Convert.toInt32(timevar)

'** Check if countdowntimer reached wraptuptime and finalcall **********
If timevarint > wrapuptime then
API.Function("SetTextColour",Input:=InputNo,Value:=countdowncolor)
Else if timevarint < finalcall then
API.Function("SetTextColour",Input:=InputNo,Value:=finalcallcolor)
Else
API.Function("SetTextColour",Input:=InputNo,Value:=wrapuptimecolor)
End if

' Flash timer when out of time timevarint is 00:00:00 = 0
if timevarint < 1 then
if flashtimer = true then
API.Function("SetTextColour",Input:=InputNo,Value:=flashcolor)
flashtimer = false
Else
API.Function("SetTextColour",Input:=InputNo,Value:=finalcallcolor)
flashtimer = true
End if
End if

Sleep (1000)
Loop
thanks 2 users thanked Aecast for this useful post.
JessShake on 10/20/2021(UTC), APX on 10/23/2021(UTC)
JessShake  
#4 Posted : Wednesday, October 20, 2021 1:00:40 AM(UTC)
JessShake

Rank: Member

Groups: Registered
Joined: 2/9/2021(UTC)
Posts: 10
United States
Location: Oklahoma

Thanks: 2 times
Thank you Aecast! This looks amazing. Exactly what I need!

-Jess
APX  
#5 Posted : Saturday, October 23, 2021 6:53:46 PM(UTC)
APX

Rank: Newbie

Groups: Registered
Joined: 1/5/2021(UTC)
Posts: 4
France, Metropolitan
Location: Paris

Thanks: 2 times
Hello Guys,
thank you for this very usefull script!

May i ask few questions, i'm a script beginer ?

Aecast, your script only works for countdown with HH:mm:ss display format. Would it be possible to adapt the script for a MM:SS countdown?

Another question, is there an option in Vmix to continue the countdown after expiration? I didnt find it.

Thank you for your help!

Regards.

Aurélien
APX  
#6 Posted : Saturday, October 23, 2021 7:38:52 PM(UTC)
APX

Rank: Newbie

Groups: Registered
Joined: 1/5/2021(UTC)
Posts: 4
France, Metropolitan
Location: Paris

Thanks: 2 times
Of course, i can crop my countdown, but i wonder if there is a proper way to do that ;)
doggy  
#7 Posted : Saturday, October 23, 2021 8:48:05 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 3,577
Belgium
Location: Belgium

Thanks: 197 times
Was thanked: 642 time(s) in 525 post(s)
Originally Posted by: APX Go to Quoted Post

Aecast, your script only works for countdown with HH:mm:ss display format. Would it be possible to adapt the script for a MM:SS countdown?


If the countdown display is set to mm:ss then just remove the '& HHMMSS(2)' from the 'timevar = HHMMSS(0) & HHMMSS(1) & HHMMSS(2)' line

thanks 1 user thanked doggy for this useful post.
APX on 10/23/2021(UTC)
doggy  
#8 Posted : Saturday, October 23, 2021 8:59:45 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 3,577
Belgium
Location: Belgium

Thanks: 197 times
Was thanked: 642 time(s) in 525 post(s)
Originally Posted by: APX Go to Quoted Post
Another question, is there an option in Vmix to continue the countdown after expiration? I didnt find it.


It's a countdown and stops when reaching the set time ;-)

setup a second countdown (set to reverse) and trigger it to start with the OnCountdownCompleted of the first
APX  
#9 Posted : Saturday, October 23, 2021 11:47:41 PM(UTC)
APX

Rank: Newbie

Groups: Registered
Joined: 1/5/2021(UTC)
Posts: 4
France, Metropolitan
Location: Paris

Thanks: 2 times
Yes, Thank you, that is what i did.

I'll Try to learn how to do everything with one script!
APX  
#10 Posted : Saturday, October 23, 2021 11:53:22 PM(UTC)
APX

Rank: Newbie

Groups: Registered
Joined: 1/5/2021(UTC)
Posts: 4
France, Metropolitan
Location: Paris

Thanks: 2 times
Originally Posted by: doggy Go to Quoted Post
Originally Posted by: APX Go to Quoted Post

Aecast, your script only works for countdown with HH:mm:ss display format. Would it be possible to adapt the script for a MM:SS countdown?


If the countdown display is set to mm:ss then just remove the '& HHMMSS(2)' from the 'timevar = HHMMSS(0) & HHMMSS(1) & HHMMSS(2)' line



Thank you that is exactly what i was trying to do_
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.