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
andreg25  
#1 Posted : Saturday, January 25, 2025 5:39:44 AM(UTC)
andreg25

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.
doggy  
#2 Posted : Saturday, January 25, 2025 6:24:33 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,300
Belgium
Location: Belgium

Thanks: 296 times
Was thanked: 973 time(s) in 806 post(s)
Originally Posted by: andreg25 Go to Quoted Post
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
andreg25  
#3 Posted : Saturday, January 25, 2025 6:38:34 AM(UTC)
andreg25

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"
nikosman88  
#4 Posted : Saturday, January 25, 2025 8:18:52 AM(UTC)
nikosman88

Rank: Advanced Member

Groups: Registered
Joined: 12/24/2021(UTC)
Posts: 572
Greece
Location: athens

Thanks: 141 times
Was thanked: 78 time(s) in 74 post(s)
Originally Posted by: andreg25 Go to Quoted Post
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
doggy  
#5 Posted : Saturday, January 25, 2025 8:26:54 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,300
Belgium
Location: Belgium

Thanks: 296 times
Was thanked: 973 time(s) in 806 post(s)
Originally Posted by: andreg25 Go to Quoted Post
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 
andreg25  
#6 Posted : Saturday, January 25, 2025 11:47:28 PM(UTC)
andreg25

Rank: Newbie

Groups: Registered
Joined: 1/25/2025(UTC)
Posts: 3
Location: Portugal

Originally Posted by: nikosman88 Go to Quoted Post
Originally Posted by: andreg25 Go to Quoted Post
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.
Users browsing this topic
Guest (4)
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.