Reloj 1:
' Template for controlling the global Viz clocks in Trio
Class Clock
Public FormattedLimitTime
Public FormattedCurrentTime
Public LimitTime
Public CurrentTime
Public DirectionUp
Public LimitEnabled
Public ClockRunning
End Class
Dim clock0
Dim activeClocknr
Dim fso
Dim objFile
sub InitForm
Set clock0 = New Clock
activeClocknr = 0
clockUpdateTimer.Enabled = chkTimerActive.Checked
GetSceneFromFile
end sub
sub chkTimerActiveClick(sender)
clockUpdateTimer.Enabled = chkTimerActive.Checked
end sub
function GetActiveTime(txt)
dim h, m, s
dim ih, im, isec
dim a
dim res
txt = Replace(txt," ","0")
txt = Replace(txt,"-","")
h = Mid(txt,1,2)
m = Mid(txt,4,2)
s = Mid(txt,7,2)
ih = 0
im = 0
isec = 0
if trim(h) <> "" then
ih = CInt(Trim(h))
ih = ih * 3600
end if
if trim(m) <> "" then
im = CInt(Trim(m))
im = im * 60
end if
if trim(s) <> "" then
isec = CInt(Trim(s))
end if
if ih < 0 then
res = "-"
end if
res = res + ih + im + isec
GetActiveTime = res & ""
end function
function GetActiveClock
GetActiveClock = "CLOCK" & activeClocknr
end function
function GetStartTime
GetStartTime = GetActiveTime(txtTimeStart.Text)
end function
Sub UpdateClock
str = GetActiveClock+"*DIRECTION SET UP"
ProgramVizCmd(str)
str = GetActiveClock+"*LIMIT SET NONE"
ProgramVizCmd(str)
SetTime
End sub
function LocalVizCmd(cmd)
LocalVizCmd = TrioCmd("send_local_vizcmd " & cmd)
end function
Sub ProgramVizCmd(cmd)
TrioCmd("send_vizcmd " & cmd)
end sub
Sub LiveStart
ProgramVizCmd(GetActiveClock + " START")
end sub
Sub LiveStop
ProgramVizCmd(GetActiveClock + " STOP")
end sub
Sub LiveContinue
ProgramVizCmd(GetActiveClock + " CONT")
end sub
Sub SetTime
str = GetActiveClock+"*TIME SET " + GetStartTime
ProgramVizCmd(str)
End sub
Sub SetClockTime(str)
pos0 = InStr(str, "}")
strclock0 = Mid(str, 3, pos0-3)
strclock0 = trim(strclock0)
rest = Mid(str, pos0+1, len(str))
pos = InStr(strclock0, " ")
up = Mid(strclock0, 1, 1)
rest = Mid(strclock0, pos + 1, len(strclock0))
clock0.DirectionUp = true
pos2 = InStr(rest, " ")
newtime = Mid(rest, pos-1, pos2)
rest = Mid(rest, pos2+1, len(strclock0))
clock0.CurrentTime = newtime
pos3 = InStr(rest, " ")
limittime = Mid(rest, 1, pos3)
rest = Mid(rest, pos3+1, len(strclock0))
clock0.LimitTime = limittime
pos4 = InStr(rest, " ")
limitenabled = Mid(rest, 1, pos4-1)
rest = Mid(rest, pos4+1, pos4+1)
if(limitenabled = "1") then
clock0.LimitEnabled = true
else
clock0.LimitEnabled = false
end if
pos5 = InStr(rest, " ")
clrunning = Mid(rest, 1, pos5)
if(clrunning = "1") then
clock0.ClockRunning = true
else
clock0.ClockRunning = false
end if
formattedTime = FormatTime(newtime)
clock0.FormattedCurrentTime = formattedTime
clock0.FormattedLimitTime = FormatTime(clock0.LimitTime)
txtClock0.Text = formattedTime
End Sub
Sub clockUpdateTimerTimer(Sender)
' We need to run this through the Trio to be able to get return
' values from the macro command queue.
TrioCmd("vtwtemplate:run_vtw_script GetTrioClocks")
End sub
sub GetTrioClocks
res = LocalVizCmd("CLOCK*DATA GET")
SetClockTime(res)
end sub
' This event is called from Trio when Trio closes
Sub OnClose
clockUpdateTimer.Enabled = false
end sub
function FormatTime(strSeconds)
dim sign
dim decimalPos
sign = ""
' need to replace the comma seperator returned from Viz
decimalPos = InStr(strSeconds,".")
if CInt(decimalPos) > 1 then
strSeconds = Mid(strSeconds, 1, decimalPos - 1)
End if
strSeconds = Replace(strSeconds,".",",")
seconds = CInt(strSeconds)
hours = fix(seconds/3600)
seconds = seconds - (hours * 3600)
minutes = fix (seconds / 60)
seconds = int(seconds - (minutes * 60)) ' int() rounds the value different from fix
if seconds < 0 then
sign = "-"
end if
if abs(seconds) < 10 then
seconds = "0" & abs(seconds)
else
seconds = abs(seconds)
end if
if minutes < 0 then
sign = "-"
end if
if abs(minutes) < 10 then
minutes = "0" & abs(minutes)
else
minutes = abs(minutes)
end if
if hours < 0 then
sign = "-"
end if
if abs(hours) < 10 then
hours = "0" & abs(hours)
else
hours = abs(hours)
end if
FormatTime = sign & hours & ":" & minutes & ":" & seconds
end function
'BUTTONS
Sub btnStartClick(Sender)
LiveStart
TrioCmd("synchronize_clocks")
End sub
Sub btnContinueClick(Sender)
LiveContinue
TrioCmd("synchronize_clocks")
End sub
Sub btnStopClick(Sender)
LiveStop
TrioCmd("synchronize_clocks")
End sub
Sub btnSetClick(Sender)
SetTime
UpdateClock
TrioCmd("synchronize_clocks")
End sub
Sub btnSetAndStartClick(Sender)
SetTime
UpdateClock
ProgramVizCmd(GetActiveClock + " START")
TrioCmd("synchronize_clocks")
End sub
Sub btnSetAndStopClick(Sender)
SetTime
UpdateClock
ProgramVizCmd(GetActiveClock + " STOP")
TrioCmd("synchronize_clocks")
End sub
'SCENE CONTROL
Sub SendCommand(Comando)
Dim strMensaje
strMensaje = "RENDERER*FRONT_LAYER"
strMensaje = strMensaje & Comando
TrioCmd("trio:send_vizcmd " & strMensaje)
End Sub
Sub btnInClick(sender)
Dim Scene
Scene = txtScene.Text '"OnAir_Futbol/MARCADOR_ONLINE"
SendCommand " SET_OBJECT SCENE*" & Scene
Update
SendCommand "STAGEDIRECTOR*In START"
End Sub
Sub btnOutClick(sender)
SendCommand "STAGEDIRECTOR*Out START"
End Sub
Sub btnExtraClick(sender)
SendCommand "STAGEDIRECTOR*Extra START"
End Sub
Sub btnUpdateClick(sender)
Update
End Sub
Sub Update
SendCommand "TREEobject*FUNCTION*ControlObject*in SET ON 01 SET " & txtHomeName.Text
SendCommand "*TREE*objectFUNCTIONControlObjectin SET ON 02 SET " & txtHomeScore.Text
SendCommand "TREEobject*FUNCTION*ControlObject*in SET ON 03 SET " & txtAwayScore.Text
SendCommand "*TREE*objectFUNCTIONControlObjectin SET ON 04 SET " & txtAwayName.Text
SendCommand "TREEobject*FUNCTION*ControlObject*in SET ON 06 SET " & txtPart.Text
SendCommand "*TREE*objectFUNCTIONControlObjectin SET ON 07 SET " & lgHome.picFilename
SendCommand "TREEobject*FUNCTION*ControlObject*in SET ON 08 SET " & lgAway.picFilename
SendCommand "*TREE*objectFUNCTIONControlObjectin SET ON 09 SET " & txtExtra.Text
WriteSceneToFile
End Sub
Sub GetSceneFromFile
Const ForReading = 1
Set fso = CreateObject("Scripting.FileSystemObject")
if fso.FolderExists("c:\ClockConfig") = False then
fso.CreateFolder("c:\ClockConfig")
End if
if fso.FileExists("c:\ClockConfig\Scene.txt") then
Set checkFile = fso.GetFile("c:\ClockConfig\Scene.txt")
If checkFile.Size > 0 Then
Set objFile = fso.OpenTextFile("c:\ClockConfig\Scene.txt", ForReading)
txtScene.Text = objFile.ReadLine
lgHome.picFilename = objFile.ReadLine
lgAway.picFilename = objFile.ReadLine
txtHomeName.Text = objFile.ReadLine
txtAwayName.Text = objFile.ReadLine
txtHomeScore.Text = objFile.ReadLine
txtAwayScore.Text = objFile.ReadLine
txtExtra.Text = objFile.ReadLine
txtPart.Text = objFile.ReadLine
objFile.Close
end if
else
Set objFile = fso.CreateTextFile("c:\ClockConfig\Scene.txt")
objFile.Close
end if
End Sub
Sub WriteSceneToFile
Const ForWriting = 2
Set fso = CreateObject("Scripting.FileSystemObject")
if fso.FileExists("c:\ClockConfig\Scene.txt") then
Set objFile = fso.OpenTextFile("c:\ClockConfig\Scene.txt", ForWriting)
objFile.WriteLine txtScene.Text
objFile.WriteLine lgHome.picFilename
objFile.WriteLine lgAway.picFilename
objFile.WriteLine txtHomeName.Text
objFile.WriteLine txtAwayName.Text
objFile.WriteLine txtHomeScore.Text
objFile.WriteLine txtAwayScore.Text
objFile.WriteLine txtExtra.Text
objFile.WriteLine txtPart.Text
objFile.Close
end if
End Sub
Reloj 2:
' Template for controlling the global Viz clocks in Trio
Class Clock
Public FormattedLimitTime
Public FormattedCurrentTime
Public LimitTime
Public CurrentTime
Public DirectionUp
Public LimitEnabled
Public ClockRunning
End Class
Dim clock0
Dim activeClocknr
Dim fso
Dim objFile
Dim secondClock
sub InitForm
Set clock0 = New Clock
activeClocknr = 0
clockUpdateTimer.Enabled = false
GetSceneFromFile
end sub
' function GetActiveTime(txt)
' dim h, m, s
' dim ih, im, isec
' dim a
' dim res
' txt = Replace(txt," ","0")
' txt = Replace(txt,"-","")
' h = Mid(txt,1,2)
' m = Mid(txt,4,2)
' s = Mid(txt,7,2)
' ih = 0
' im = 0
' isec = 0
' if trim(h) <> "" then
' ih = CInt(Trim(h))
' ih = ih * 3600
' end if
' if trim(m) <> "" then
' im = CInt(Trim(m))
' im = im * 60
' end if
' if trim(s) <> "" then
' isec = CInt(Trim(s))
' end if
' if ih < 0 then
' res = "-"
' end if
' res = res + ih + im + isec
' GetActiveTime = res & ""
' end function
function GetActiveTime(txt)
dim h, m, s
dim ih, im, isec
dim a
dim res
txt = Replace(txt," ","0")
txt = Replace(txt,"-","")
m = Mid(txt,1,3)
s = Mid(txt,5,2)
im = 0
isec = 0
if trim(m) <> "" then
im = CInt(Trim(m))
im = im * 60
end if
if trim(s) <> "" then
isec = CInt(Trim(s))
end if
if im < 0 then
res = "-"
end if
res = res + im + isec
GetActiveTime = res & ""
end function
function GetActiveClock
GetActiveClock = "CLOCK" & activeClocknr
end function
function GetStartTime
GetStartTime = GetActiveTime(txtTimeStart.Text)
end function
Sub UpdateClock
str = GetActiveClock+"*DIRECTION SET UP"
ProgramVizCmd(str)
if rbP1.Checked = true then
str = GetActiveClock+"*LIMIT SET 2700"
end if
if rbP2.Checked = true then
str = GetActiveClock+"*LIMIT SET 5400"
end if
if rbP3.Checked = true then
str = GetActiveClock+"*LIMIT SET 6300"
end if
if rbP4.Checked = true then
str = GetActiveClock+"*LIMIT SET 7200"
end if
ProgramVizCmd(str)
SetTime
End sub
function LocalVizCmd(cmd)
LocalVizCmd = TrioCmd("send_local_vizcmd " & cmd)
end function
Sub ProgramVizCmd(cmd)
TrioCmd("send_vizcmd " & cmd)
end sub
Sub LiveStart
ProgramVizCmd(GetActiveClock + " START")
end sub
Sub LiveStop
ProgramVizCmd(GetActiveClock + " STOP")
end sub
Sub LiveContinue
ProgramVizCmd(GetActiveClock + " CONT")
end sub
Sub SetTime
str = GetActiveClock+"*TIME SET " + GetStartTime
ProgramVizCmd(str)
End sub
Sub SetClockTime(str)
pos0 = InStr(str, "}")
strclock0 = Mid(str, 3, pos0-3)
strclock0 = trim(strclock0)
rest = Mid(str, pos0+1, len(str))
pos = InStr(strclock0, " ")
up = Mid(strclock0, 1, 1)
rest = Mid(strclock0, pos + 1, len(strclock0))
clock0.DirectionUp = true
pos2 = InStr(rest, " ")
newtime = Mid(rest, pos-1, pos2)
rest = Mid(rest, pos2+1, len(strclock0))
clock0.CurrentTime = newtime
pos3 = InStr(rest, " ")
limittime = Mid(rest, 1, pos3)
rest = Mid(rest, pos3+1, len(strclock0))
clock0.LimitTime = limittime
pos4 = InStr(rest, " ")
limitenabled = Mid(rest, 1, pos4-1)
rest = Mid(rest, pos4+1, pos4+1)
if(limitenabled = "1") then
clock0.LimitEnabled = true
else
clock0.LimitEnabled = false
end if
pos5 = InStr(rest, " ")
clrunning = Mid(rest, 1, pos5)
if(clrunning = "1") then
clock0.ClockRunning = true
else
clock0.ClockRunning = false
end if
formattedTime = FormatTime(newtime)
clock0.FormattedCurrentTime = formattedTime
clock0.FormattedLimitTime = FormatTime(clock0.LimitTime)
txtClock0.Text = formattedTime
End Sub
Sub clockUpdateTimerTimer(Sender)
' We need to run this through the Trio to be able to get return
' values from the macro command queue.
TrioCmd("vtwtemplate:run_vtw_script GetTrioClocks")
if rbP1.Checked = true then
if clock0.CurrentTime = 2700 and secondClock = false then
SendCommand "STAGEDIRECTORSecondClock START"
secondClock = true
ProgramVizCmd("CLOCK1TIME SET 0")
ProgramVizCmd("CLOCK1 START")
end if
end if
if rbP2.Checked = true then
if clock0.CurrentTime = 5400 and secondClock = false then
SendCommand "STAGEDIRECTORSecondClock START"
secondClock = true
ProgramVizCmd("CLOCK1TIME SET 0")
ProgramVizCmd("CLOCK1 START")
end if
end if
if rbP3.Checked = true then
if clock0.CurrentTime = 6300 and secondClock = false then
SendCommand "STAGEDIRECTORSecondClock START"
secondClock = true
ProgramVizCmd("CLOCK1TIME SET 0")
ProgramVizCmd("CLOCK1 START")
end if
end if
if rbP4.Checked = true then
if clock0.CurrentTime = 7200 and secondClock = false then
SendCommand "STAGEDIRECTORSecondClock START"
secondClock = true
ProgramVizCmd("CLOCK1TIME SET 0")
ProgramVizCmd("CLOCK1 START")
end if
end if
End sub
sub GetTrioClocks
res = LocalVizCmd("CLOCK*DATA GET")
SetClockTime(res)
end sub
' This event is called from Trio when Trio closes
Sub OnClose
clockUpdateTimer.Enabled = false
end sub
function FormatTime(strSeconds)
dim sign
dim decimalPos
sign = ""
' need to replace the comma seperator returned from Viz
decimalPos = InStr(strSeconds,".")
if CInt(decimalPos) > 1 then
strSeconds = Mid(strSeconds, 1, decimalPos - 1)
End if
strSeconds = Replace(strSeconds,".",",")
seconds = CInt(strSeconds)
'hours = fix(seconds/3600)
'seconds = seconds - (hours * 3600)
minutes = fix (seconds / 60)
seconds = int(seconds - (minutes * 60)) ' int() rounds the value different from fix
if seconds < 0 then
sign = "-"
end if
if abs(seconds) < 10 then
seconds = "0" & abs(seconds)
else
seconds = abs(seconds)
end if
if minutes < 0 then
sign = "-"
end if
'if abs(minutes) < 10 then
' minutes = "0" & abs(minutes)
'else
' minutes = abs(minutes)
'end if
minutes = abs(minutes)
'if hours < 0 then
' sign = "-"
'end if
'if abs(hours) < 10 then
' hours = "0" & abs(hours)
'else
' hours = abs(hours)
'end if
'FormatTime = sign & hours & ":" & minutes & ":" & seconds
FormatTime = sign & minutes & ":" & seconds
end function
'BUTTONS
Sub btnStartClick(Sender)
LiveStart
TrioCmd("synchronize_clocks")
End sub
Sub btnContinueClick(Sender)
LiveContinue
TrioCmd("synchronize_clocks")
End sub
Sub btnStopClick(Sender)
LiveStop
TrioCmd("synchronize_clocks")
End sub
Sub btnSetClick(Sender)
SetTime
UpdateClock
TrioCmd("synchronize_clocks")
End sub
Sub btnSetAndStartClick(Sender)
SetTime
UpdateClock
ProgramVizCmd(GetActiveClock + " START")
TrioCmd("synchronize_clocks")
End sub
Sub btnSetAndStopClick(Sender)
SetTime
UpdateClock
ProgramVizCmd(GetActiveClock + " STOP")
TrioCmd("synchronize_clocks")
End sub
'SCENE CONTROL
Sub SendCommand(Comando)
Dim strMensaje
strMensaje = "RENDERER"
'if cboLayer.Text <> "MIDDLE" Then strMensaje = strMensaje & "*" & cboLayer.Text & "_LAYER"
strMensaje = strMensaje & Comando
TrioCmd("trio:send_vizcmd " & strMensaje)
End Sub
Sub btnInClick(sender)
Dim Scene
Scene = txtScene.Text
SendCommand " SET_OBJECT SCENE*" & Scene
Update
SendCommand "STAGEDIRECTOR*In START"
secondClock = false
clockUpdateTimer.Enabled = true
End Sub
Sub btnOutClick(sender)
SendCommand "STAGEDIRECTOR*Out START"
secondClock = false
clockUpdateTimer.Enabled = false
End Sub
Sub btnExtraClick(sender)
SendCommand "TREE$objectFUNCTIONControlObjectin SET ON 09 SET " & txtExtra.Text
SendCommand "STAGEDIRECTORExtra START"
End Sub
Sub btnUpdateClick(sender)
Update
End Sub
Sub Update
SendCommand "TREEobject*FUNCTION*ControlObject*in SET ON 01 SET " & txtHomeName.Text
SendCommand "*TREE*objectFUNCTIONControlObjectin SET ON 02 SET " & txtHomeScore.Text
SendCommand "TREEobject*FUNCTION*ControlObject*in SET ON 03 SET " & txtAwayScore.Text
SendCommand "*TREE*objectFUNCTIONControlObjectin SET ON 04 SET " & txtAwayName.Text
SendCommand "TREEobject*FUNCTION*ControlObject*in SET ON 07 SET " & lgHome.picFilename
SendCommand "*TREE*objectFUNCTIONControlObjectin SET ON 08 SET " & lgAway.picFilename
SendCommand "TREE$objectFUNCTIONControlObjectin SET ON 09 SET " & txtExtra.Text
WriteSceneToFile
End Sub
Sub GetSceneFromFile
Dim Part
Const ForReading = 1
Set fso = CreateObject("Scripting.FileSystemObject")
if fso.FolderExists("c:\ClockConfig") = False then
fso.CreateFolder("c:\ClockConfig")
End if
if fso.FileExists("c:\ClockConfig\Scene.txt") then
Set checkFile = fso.GetFile("c:\ClockConfig\Scene.txt")
If checkFile.Size > 0 Then
Set objFile = fso.OpenTextFile("c:\ClockConfig\Scene.txt", ForReading)
txtScene.Text = objFile.ReadLine
lgHome.picFilename = objFile.ReadLine
lgAway.picFilename = objFile.ReadLine
txtHomeName.Text = objFile.ReadLine
txtAwayName.Text = objFile.ReadLine
txtHomeScore.Text = objFile.ReadLine
txtAwayScore.Text = objFile.ReadLine
txtExtra.Text = objFile.ReadLine
Part = objFile.ReadLine
if Part = "1" then
rbP1.Checked = true
end if
if Part = "2" then
rbP2.Checked = true
end if
if Part = "3" then
rbP4.Checked = true
end if
if Part = "4" then
rbP4.Checked = true
end if
objFile.Close
end if
else
Set objFile = fso.CreateTextFile("c:\ClockConfig\Scene.txt")
objFile.Close
end if
End Sub
Sub WriteSceneToFile
Const ForWriting = 2
Set fso = CreateObject("Scripting.FileSystemObject")
if fso.FileExists("c:\ClockConfig\Scene.txt") then
Set objFile = fso.OpenTextFile("c:\ClockConfig\Scene.txt", ForWriting)
objFile.WriteLine txtScene.Text
objFile.WriteLine lgHome.picFilename
objFile.WriteLine lgAway.picFilename
objFile.WriteLine txtHomeName.Text
objFile.WriteLine txtAwayName.Text
objFile.WriteLine txtHomeScore.Text
objFile.WriteLine txtAwayScore.Text
objFile.WriteLine txtExtra.Text
if rbP1.Checked = true then
objFile.WriteLine "1"
end if
if rbP2.Checked = true then
objFile.WriteLine "2"
end if
if rbP3.Checked = true then
objFile.WriteLine "3"
end if
if rbP4.Checked = true then
objFile.WriteLine "4"
end if
objFile.Close
end if
End Sub
Sub rbP1Click(Sender)
txtTimeStart.Text = "0:00"
End sub
Sub rbP2Click(Sender)
txtTimeStart.Text = "45:00"
End sub
Sub rbP3Click(Sender)
txtTimeStart.Text = "90:00"
End sub
Sub rbP4Click(Sender)
txtTimeStart.Text = "105:00"
End sub