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
thenickrobinson  
#1 Posted : Friday, December 9, 2022 5:25:23 PM(UTC)
thenickrobinson

Rank: Newbie

Groups: Registered
Joined: 12/9/2022(UTC)
Posts: 1
United States

UserPostedImage

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=0

Would love to automate fgm="16" divided by fga="61" to output 26.2!
doggy  
#2 Posted : Friday, December 9, 2022 6:07:43 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: thenickrobinson Go to Quoted Post


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=0

Would 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)
Peter1000  
#3 Posted : Friday, December 9, 2022 6:45:14 PM(UTC)
Peter1000

Rank: Advanced Member

Groups: Registered
Joined: 1/25/2019(UTC)
Posts: 302
Switzerland

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


Users browsing this topic
Guest
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.