vMix Forums
»
General
»
General Discussion
»
Script to change color of the text when two titles have the same number
Rank: Newbie
Groups: Registered
Joined: 1/25/2025(UTC) Posts: 3 Location: Portugal
|
Hey there,
I use vMix for a few years but i never use any Script, i don't know how to code and i already tried to use ChatGPT but i cant get the result i want. I need a script for a Padel/Tenis scoreboard that when the "game" numbers are the same, like 40-40, the text color need to change to yellow.
I got a title called "game.gtzip" and in that title there are two text fields "pointhome.Text" and "pointaway.Text", what i need is when both text field got the same number 40 - 40 the text color turn to Yellow to show the user that it is a "Gold Point".
I've been trying this for a few days... can somebody help me please?
Thanks.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,300 Location: Belgium Thanks: 296 times Was thanked: 973 time(s) in 806 post(s)
|
Originally Posted by: andreg25 Hey there,
I use vMix for a few years but i never use any Script, i don't know how to code and i already tried to use ChatGPT but i cant get the result i want. I need a script for a Padel/Tenis scoreboard that when the "game" numbers are the same, like 40-40, the text color need to change to yellow.
I got a title called "game.gtzip" and in that title there are two text fields "pointhome.Text" and "pointaway.Text", what i need is when both text field got the same number 40 - 40 the text color turn to Yellow to show the user that it is a "Gold Point".
I've been trying this for a few days... can somebody help me please?
Thanks. Have you searched this forum ? There are mulitple posts on text and color manipulations and also a thread regarding scripting called "scripting for dummies" containing mulotple examples Basically you have to compare the content of the 2 textfields and if they are equal (vb.net logic) change the color for the text (Shortcut functions are the same as being used withina a script) . There is a full reference list within the vMix helpfiles for all possible functions/shortcuts
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/25/2025(UTC) Posts: 3 Location: Portugal
|
Thanks, i already searched on that topics, but the close i can go is change the color of each individual text, like if the first title reach 40 it changes the color to yellow, but i cant get it change when both got the number "40"
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/24/2021(UTC) Posts: 572 Location: athens Thanks: 141 times Was thanked: 78 time(s) in 74 post(s)
|
Originally Posted by: andreg25 Thanks, i already searched on that topics, but the close i can go is change the color of each individual text, like if the first title reach 40 it changes the color to yellow, but i cant get it change when both got the number "40" Try this Code:
Do while true
Dim doc As New System.Xml.XmlDocument()
doc.LoadXml(API.XML())
Dim homePoints As String = doc.SelectSingleNode("//input[@title='game.gtzip']//text[@name='pointhome.Text']").InnerText
Dim awayPoints As String = doc.SelectSingleNode("//input[@title='game.gtzip']//text[@name='pointaway.Text']").InnerText
If homePoints = "40" And awayPoints = "40" Then
API.Function("SetTextColour", Input:="game.gtzip", SelectedName:="pointhome.Text", Value:="#FFFF00")
API.Function("SetTextColour", Input:="game.gtzip", SelectedName:="pointaway.Text", Value:="#FFFF00")
Else
API.Function("SetTextColour", Input:="game.gtzip", SelectedName:="pointhome.Text", Value:="#FFFFFF")
API.Function("SetTextColour", Input:="game.gtzip", SelectedName:="pointaway.Text", Value:="#FFFFFF")
End If
Loop
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,300 Location: Belgium Thanks: 296 times Was thanked: 973 time(s) in 806 post(s)
|
Originally Posted by: andreg25 Thanks, i already searched on that topics, but the close i can go is change the color of each individual text, like if the first title reach 40 it changes the color to yellow, but i cant get it change when both got the number "40" So which is it ? both equal or both equal 40 ? Have to now the specifics else even chatgtp wont understand and if one wants to script in vMix one better google a bit about vb.net coding Code:dim home= Input.Find("game.gtzip").Text("pointhome.Text")
dim away= Input.Find("game.gtzip").Text("pointaway.Text")
if (home="40") and (away="40") then
API.Function("SetTextColour",Input:="game.gtzip",SelectedName:="pointhome.Text",Value:="#00FF00")
API.Function("SetTextColour",Input:="game.gtzip",SelectedName:="pointaway.Text",Value:="#00FF00")
end if
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 1/25/2025(UTC) Posts: 3 Location: Portugal
|
Originally Posted by: nikosman88 Originally Posted by: andreg25 Thanks, i already searched on that topics, but the close i can go is change the color of each individual text, like if the first title reach 40 it changes the color to yellow, but i cant get it change when both got the number "40" Try this Code:
Do while true
Dim doc As New System.Xml.XmlDocument()
doc.LoadXml(API.XML())
Dim homePoints As String = doc.SelectSingleNode("//input[@title='game.gtzip']//text[@name='pointhome.Text']").InnerText
Dim awayPoints As String = doc.SelectSingleNode("//input[@title='game.gtzip']//text[@name='pointaway.Text']").InnerText
If homePoints = "40" And awayPoints = "40" Then
API.Function("SetTextColour", Input:="game.gtzip", SelectedName:="pointhome.Text", Value:="#FFFF00")
API.Function("SetTextColour", Input:="game.gtzip", SelectedName:="pointaway.Text", Value:="#FFFF00")
Else
API.Function("SetTextColour", Input:="game.gtzip", SelectedName:="pointhome.Text", Value:="#FFFFFF")
API.Function("SetTextColour", Input:="game.gtzip", SelectedName:="pointaway.Text", Value:="#FFFFFF")
End If
Loop
This is perfect. Works realy nice, is just what i needed. Thank you so much and thanks to everyone who helped me.
|
|
|
|
vMix Forums
»
General
»
General Discussion
»
Script to change color of the text when two titles have the same number
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.
Important Information:
The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close