Graphics

 View Only
  • 1.  Using scripting with data getting pulled in and having text change color after reading the data

    Posted 23 days ago

    Hello,

    I'm trying to learn who do to scripting and trying to figure out how I would apply scripting to change the color of text that is shown on videoboard. Example: If someone has been on the ice for 1:30 seconds have that text change from white to red. What is the best way to create scripting to perform this and other data driven graphical changes to text. 

    Thank you.



    ------------------------------
    David Haag
    Manager, AV
    St. Louis Blues
    ------------------------------


  • 2.  RE: Using scripting with data getting pulled in and having text change color after reading the data

    Posted 22 days ago

    Roughly. - This assumes that red and white are both Materials already in your project. - Almost every AI tool can now write xpression scripts for you that are basic like this.  So use your tool of choice and then can get you what you need.

    Dim matRed, matWhite
    Dim timeArray, minutes, seconds, totalSeconds
    
    ' Retrieve the existing materials from the project
    Engine.GetMaterialByName("RED", matRed)
    Engine.GetMaterialByName("WHITE", matWhite)
    
    ' Split the text string into an array using the colon as the divider
    timeArray = Split(Self.Text, ":")
    
    ' Check if the split created exactly two parts (minutes and seconds)
    If UBound(timeArray) = 1 Then
        
        ' Ensure both parts are numbers to prevent script errors
        If IsNumeric(timeArray(0)) And IsNumeric(timeArray(1)) Then
            
            ' Convert strings to integers
            minutes = CInt(timeArray(0))
            seconds = CInt(timeArray(1))
            
            ' Calculate the total time in seconds
            totalSeconds = (minutes * 60) + seconds
            
            ' 1 minute and 30 seconds = 90 total seconds
            If totalSeconds >= 90 Then
                Self.SetMaterial 0, matRed
            Else
                Self.SetMaterial 0, matWhite
            End If
            
        Else
            ' Fallback to white if the text contains non-numeric characters
            Self.SetMaterial 0, matWhite
        End If
        
    Else
        ' Fallback to white if the text doesn't contain exactly one colon
        Self.SetMaterial 0, matWhite
    End If



    ------------------------------
    Garrett Hall
    Overtime Elite
    Atlanta United States
    ------------------------------



  • 3.  RE: Using scripting with data getting pulled in and having text change color after reading the data

    Posted 22 days ago

    David,

    You should be able to do something like this with Visual Logic. Here's a quick example:

    If you want to dive into scripting as well, I highly recommend this XPression U Video Series

    https://www.rossvideo.com/resources/ross-university/xpression-scripting-part-2-onsettext-widgets-and-concatenation/

    https://www.rossvideo.com/resources/ross-university/xpression-scripting-part-1-an-introduction/

    https://www.rossvideo.com/resources/ross-university/xpression-scripting-part-3-creating-a-crawl-using-scripts/



    ------------------------------
    Jeff Mayer
    Ross Video
    ------------------------------



  • 4.  RE: Using scripting with data getting pulled in and having text change color after reading the data

    Posted 22 days ago

    If you are keen to use script you can make a Red font and a White font and then use material tags.

    Make sure to make you OG font white. 

    OnSet Text script 

    Dim parts() As String
    Dim mins As Integer
    Dim secs As Integer
    Dim totalSeconds As Integer
    Dim cleanText As String
    parts = cleanText.Split(":"c)
     
    If parts.Length = 2 Then
     
        mins = CInt(parts(0))
        secs = CInt(parts(1))
     
        totalSeconds = (mins * 60) + secs
     
        If totalSeconds >= 90 Then
            Text = "{M:Red}" & cleanText
        Else
            Text = "{M:White}" & cleanText
        End If
     
    End If



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------