vMix Forums
»
General
»
General Discussion
»
Simple Math for Sports Scoreboard
Rank: Newbie
Groups: Registered
Joined: 12/9/2022(UTC) Posts: 1
|
Any help would be greatly appreciated! Situation: I have an XML-powered scoreboard graphic. If you know a little about basketball, it's nice to be able to show percentages. Unfortunately, the XML generated by my stats program does not put out a percentage field. 😓 Question: In either the Title Editor or GT Title Designer, is there a way to automate some simple math so I can have one field in the XML field divided by another field? Thank you! Sample File: https://www.dropbox.com/...m3vkwor/example.xml?dl=0Would love to automate fgm="16" divided by fga="61" to output 26.2!
|
|
|
|
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: thenickrobinson Situation: I have an XML-powered scoreboard graphic. If you know a little about basketball, it's nice to be able to show percentages. Unfortunately, the XML generated by my stats program does not put out a percentage field. 😓 Question: In either the Title Editor or GT Title Designer, is there a way to automate some simple math so I can have one field in the XML field divided by another field? Thank you! Sample File: https://www.dropbox.com/...m3vkwor/example.xml?dl=0Would love to automate fgm="16" divided by fga="61" to output 26.2! Sae answer as given on FB ;-) Small script reading the values from a (invisible) title field where the original values are stored , do calculation and write to a visible title field Alternativly write a script/app to convert the xml by adding values based on the calculations and using the resulting file as a data source (more elaborate)
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 1/25/2019(UTC) Posts: 302 Thanks: 17 times Was thanked: 79 time(s) in 60 post(s)
|
As Doggy described it, let's assume you have a GT Title name: simplemath.gtzip This GT Tile has the fields: fga.Text fgm.Text result.Text The fields fga and fgm are filled in by the XML database. Then you run a small script in vMix, which then gets the two values and fills the result into a third field. Attention: Textfields in scripts are casesensitive Code:dim fgm,fga,result as double 'defines 3 number values
do while true
fga = cint(Input.Find("simplemath.gtzip").Text("fga.Text")) 'gets value fga from the title
fgm = cint(Input.Find("simplemath.gtzip").Text("fgm.Text")) 'gets value fgm from the title
result = (fgm/fga *100).ToString("F2") 'calculates the result with 2 decimals
Input.Find("simplemath.gtzip").Text("result.Text")=result 'writes result back to the title
sleep (500) 'waits a while, can be adjusted (500 = 1/2 second)
loop
|
|
|
|
vMix Forums
»
General
»
General Discussion
»
Simple Math for Sports Scoreboard
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