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
AWCM  
#1 Posted : Wednesday, December 6, 2023 3:12:38 PM(UTC)
AWCM

Rank: Newbie

Groups: Registered
Joined: 3/8/2023(UTC)
Posts: 9
United States
Location: Massachusetts

Thanks: 1 times
I am stuck and can't figure out how to make it work. I am trying to automate bonus text to appear when the foul counter reaches 6. I am using the score widget to add fouls. My thought was there should be a way to trigger the text to be visible by some sort of conditional logic. Any and all help is appreciated.
nikosman88  
#2 Posted : Wednesday, December 6, 2023 10:29:38 PM(UTC)
nikosman88

Rank: Advanced Member

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

Thanks: 121 times
Was thanked: 70 time(s) in 66 post(s)
Originally Posted by: AWCM Go to Quoted Post
I am stuck and can't figure out how to make it work. I am trying to automate bonus text to appear when the foul counter reaches 6. I am using the score widget to add fouls. My thought was there should be a way to trigger the text to be visible by some sort of conditional logic. Any and all help is appreciated.


Hello. Yes this can be done with a script that will check the value in the texr fouls field and will do what you need
Some examples to start you can find here https://forums.vmix.com/...86-Scripting-for-Dummies or for a more ready example see this
https://tvcrew.ch/wiki/d...hp?id=scripting_examples and from there the example
Text on/off based on a specific value, result etc.

Makes text or images invisible if a text field in a title has a certain value.
This example uses the same title as in the above example, visibledemo.gtzip, and turns text and image in visibledemo.gtzip on and off based on a value from the title “Title 0- The Classic Blue.gtzip”, in the field “Headline.Text”.
Code:

dim a as string

do while true

'fills variable a with the content of Headline.Text 
a= Input.Find("Title 0- The Classic Blue.gtzip").Text("Headline.Text")

'if the content is exactly "a" then the text is visible, any other value hides the text
if a = "a" then
  API.Function("SetTextVisibleON",Input:="visibledemo.gtzip",SelectedName:="TextBlock1.Text")
  API.Function("SetImageVisibleON",Input:="visibledemo.gtzip",SelectedName:="Image1.Source")
  API.Function("SetColor",Input:="visibledemo.gtzip",SelectedName:= "Rectangle1.Fill.Color",Value:="#FF0000FF")
else
  API.Function("SetTextVisibleOFF",Input:="visibledemo.gtzip",SelectedName:="TextBlock1.Text")
  API.Function("SetImageVisibleOFF",Input:="visibledemo.gtzip",SelectedName:="Image1.Source")
  API.Function("SetColor",Input:="visibledemo.gtzip",SelectedName:= "Rectangle1.Fill.Color",Value:="#FF000000")
end if

sleep(500)

loop

You can set up the if a = "a" as if a = "6" and modify the other to your needs also to make it work
AWCM  
#3 Posted : Thursday, December 7, 2023 12:26:17 AM(UTC)
AWCM

Rank: Newbie

Groups: Registered
Joined: 3/8/2023(UTC)
Posts: 9
United States
Location: Massachusetts

Thanks: 1 times
Alright I made my edits based on your example and when I hit ok to close the window the values all change to none().

This is the code that I used.
dim a as string



do while true

'fills variable a with the content of Headline.Text
a=Input.Find("Title 14- Basketball Scoreboard SC.gtzip").Text("VFoulCount.Text")

'if the content is exactly "a" then the text is visible, any other value hides the text
if a >= "a" then
API.Function("SetTextVisibleON",Input:="Basketball Scoreboard SC.gtzip",SelectedName:="VBonus.Text")
else
API.Function("SetTextVisibleOFF",Input:="Basketball Scoreboard SC.gtzip",SelectedName:="VBonus.Text")
end if

sleep(500)

loop
AWCM  
#4 Posted : Thursday, December 7, 2023 12:30:01 AM(UTC)
AWCM

Rank: Newbie

Groups: Registered
Joined: 3/8/2023(UTC)
Posts: 9
United States
Location: Massachusetts

Thanks: 1 times
Alright I made my edits based on your example and when I hit ok to close the window the values all change to none().

This is the code that I used.


Originally Posted by: AWCM Go to Quoted Post
dim a as string

do while true

'fills variable a with the content of Headline.Text
a=Input.Find("Title 14- Basketball Scoreboard SC.gtzip").Text("VFoulCount.Text")

'if the content is exactly "a" then the text is visible, any other value hides the text
if a >= "a" then
API.Function("SetTextVisibleON",Input:="Basketball Scoreboard SC.gtzip",SelectedName:="VBonus.Text")
else
API.Function("SetTextVisibleOFF",Input:="Basketball Scoreboard SC.gtzip",SelectedName:="VBonus.Text")
end if

sleep(500)

loop



I need the value of "a" to equal to or greater than 6. Then that would turn the text on to display Bonus under the Visitor.
nikosman88  
#5 Posted : Thursday, December 7, 2023 12:58:32 AM(UTC)
nikosman88

Rank: Advanced Member

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

Thanks: 121 times
Was thanked: 70 time(s) in 66 post(s)
Try this code
Code:

dim a as string

do while true

'fills variable a with the content of Headline.Text
a=Input.Find("Title 14- Basketball Scoreboard SC.gtzip").Text("VFoulCount.Text")

'if the content is exactly "a" then the text is visible, any other value hides the text
If Convert.ToDouble(a) >= 6 Then
API.Function("SetTextVisibleON",Input:="Basketball Scoreboard SC.gtzip",SelectedName:="VBonus.Text")
else
API.Function("SetTextVisibleOFF",Input:="Basketball Scoreboard SC.gtzip",SelectedName:="VBonus.Text")
end if
Loop
AWCM  
#6 Posted : Thursday, December 7, 2023 1:47:12 AM(UTC)
AWCM

Rank: Newbie

Groups: Registered
Joined: 3/8/2023(UTC)
Posts: 9
United States
Location: Massachusetts

Thanks: 1 times
No luck same result. I tried to work with Constructor to replicate as best I could. Not code savvy. See attached screenshot. Capture.PNG (262kb) downloaded 10 time(s).

doggy  
#7 Posted : Thursday, December 7, 2023 1:48:32 AM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: nikosman88 Go to Quoted Post
Try this code
Code:

dim a as string

do while true

'fills variable a with the content of Headline.Text
a=Input.Find("Title 14- Basketball Scoreboard SC.gtzip").Text("VFoulCount.Text")

'if the content is exactly "a" then the text is visible, any other value hides the text
If Convert.ToDouble(a) >= 6 Then
API.Function("SetTextVisibleON",Input:="Basketball Scoreboard SC.gtzip",SelectedName:="VBonus.Text")
else
API.Function("SetTextVisibleOFF",Input:="Basketball Scoreboard SC.gtzip",SelectedName:="VBonus.Text")
end if
Loop


Might want to add a change in value check into the code else its going to perform one of the functions on each loop pass
Change the comment to "if the content is equal or greater then "a" then the text is visible ..."
thanks 1 user thanked doggy for this useful post.
nikosman88 on 12/7/2023(UTC)
AWCM  
#8 Posted : Thursday, December 7, 2023 2:17:31 AM(UTC)
AWCM

Rank: Newbie

Groups: Registered
Joined: 3/8/2023(UTC)
Posts: 9
United States
Location: Massachusetts

Thanks: 1 times
Everytime I go to hit ok to the code put in it changes to none() after. The only time it doesnt do that is when I use contructor... I thank you for you assistance but it appears I am stuck.
doggy  
#9 Posted : Thursday, December 7, 2023 2:21:56 AM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: AWCM Go to Quoted Post
Everytime I go to hit ok to the code put in it changes to none() after. The only time it doesnt do that is when I use contructor... I thank you for you assistance but it appears I am stuck.


The code examples are for vMix scripting directly , not UTC or alike!
nikosman88  
#10 Posted : Thursday, December 7, 2023 2:23:13 AM(UTC)
nikosman88

Rank: Advanced Member

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

Thanks: 121 times
Was thanked: 70 time(s) in 66 post(s)
Originally Posted by: AWCM Go to Quoted Post
Everytime I go to hit ok to the code put in it changes to none() after. The only time it doesnt do that is when I use contructor... I thank you for you assistance but it appears I am stuck.

I dont know how the code must copy-paste in order work in utc program. The code i provided have to be pasted into vmix settings-->scripting in a new script and then run this script
Also doggy is right in his thought but personally i dont know how to implement the extra check. Maybe something like
Code:
 
If Convert.ToDouble(a) < 6 Then
return
else if ...

end if
AWCM  
#11 Posted : Thursday, December 7, 2023 2:25:49 AM(UTC)
AWCM

Rank: Newbie

Groups: Registered
Joined: 3/8/2023(UTC)
Posts: 9
United States
Location: Massachusetts

Thanks: 1 times
Gotcha. I will work in vmix with the script and run it out of UTC and check the result.
doggy  
#12 Posted : Thursday, December 7, 2023 3:07:10 AM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: nikosman88 Go to Quoted Post

Also doggy is right in his thought but personally i dont know how to implement the extra check. Maybe something like


One checks if the value has changed before running the decision making based on the value , else skip the decision making )needs an extra value to hold the "old" value ;-)
thanks 1 user thanked doggy for this useful post.
nikosman88 on 12/7/2023(UTC)
AWCM  
#13 Posted : Thursday, December 7, 2023 1:33:49 PM(UTC)
AWCM

Rank: Newbie

Groups: Registered
Joined: 3/8/2023(UTC)
Posts: 9
United States
Location: Massachusetts

Thanks: 1 times
Originally Posted by: doggy Go to Quoted Post
Originally Posted by: nikosman88 Go to Quoted Post

Also doggy is right in his thought but personally i dont know how to implement the extra check. Maybe something like


One checks if the value has changed before running the decision making based on the value , else skip the decision making )needs an extra value to hold the "old" value ;-)



So after the first if then statement where does the additional if then for value less than 6 get placed and what expression do I use. The way I am understanding this is that if the value is less than 6, then the script needs to start over and repeat itself using the original value as a reference?.?
doggy  
#14 Posted : Thursday, December 7, 2023 5:34:42 PM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: AWCM Go to Quoted Post
Originally Posted by: doggy Go to Quoted Post
Originally Posted by: nikosman88 Go to Quoted Post

Also doggy is right in his thought but personally i dont know how to implement the extra check. Maybe something like


One checks if the value has changed before running the decision making based on the value , else skip the decision making )needs an extra value to hold the "old" value ;-)



So after the first if then statement where does the additional if then for value less than 6 get placed and what expression do I use. The way I am understanding this is that if the value is less than 6, then the script needs to start over and repeat itself using the original value as a reference?.?


Code:
dim a as string
dim olda as string = ""

do while true

'fills variable a with the content of Headline.Text
a=Input.Find("Title 14- Basketball Scoreboard SC.gtzip").Text("VFoulCount.Text")

if olda <> a

    If Convert.ToDouble(a) >= 6 Then
      API.Function("SetTextVisibleON",Input:="Basketball Scoreboard SC.gtzip",SelectedName:="VBonus.Text")
    else
      API.Function("SetTextVisibleOFF",Input:="Basketball Scoreboard SC.gtzip",SelectedName:="VBonus.Text")
     end if

    olda = a

end if
Loop
thanks 1 user thanked doggy for this useful post.
AWCM on 12/8/2023(UTC)
Users browsing this topic
Guest (5)
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.