Rank: Newbie
Groups: Registered
Joined: 3/8/2023(UTC) Posts: 9 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.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/24/2021(UTC) Posts: 508 Location: athens Thanks: 123 times Was thanked: 71 time(s) in 67 post(s)
|
Originally Posted by: AWCM 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
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/8/2023(UTC) Posts: 9 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
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/8/2023(UTC) Posts: 9 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 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.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/24/2021(UTC) Posts: 508 Location: athens Thanks: 123 times Was thanked: 71 time(s) in 67 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
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/8/2023(UTC) Posts: 9 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).
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,216 Location: Belgium Thanks: 291 times Was thanked: 955 time(s) in 790 post(s)
|
Originally Posted by: nikosman88 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 ..."
|
1 user thanked doggy for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/8/2023(UTC) Posts: 9 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.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,216 Location: Belgium Thanks: 291 times Was thanked: 955 time(s) in 790 post(s)
|
Originally Posted by: AWCM 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!
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/24/2021(UTC) Posts: 508 Location: athens Thanks: 123 times Was thanked: 71 time(s) in 67 post(s)
|
Originally Posted by: AWCM 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
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/8/2023(UTC) Posts: 9 Location: Massachusetts Thanks: 1 times
|
Gotcha. I will work in vmix with the script and run it out of UTC and check the result.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,216 Location: Belgium Thanks: 291 times Was thanked: 955 time(s) in 790 post(s)
|
Originally Posted by: nikosman88 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 ;-)
|
1 user thanked doggy for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/8/2023(UTC) Posts: 9 Location: Massachusetts Thanks: 1 times
|
Originally Posted by: doggy Originally Posted by: nikosman88 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?.?
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,216 Location: Belgium Thanks: 291 times Was thanked: 955 time(s) in 790 post(s)
|
Originally Posted by: AWCM Originally Posted by: doggy Originally Posted by: nikosman88 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
|
1 user thanked doggy for this useful post.
|
|
|
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