Graphics

 View Only
  • 1.  Script for onSetText event to get previous value of text

    Posted 2 days ago
    Hi all. I got a basketball project I'm working on. I'm trying to make a shot clock animate above my score graphic, BUT only when the shot clock goes below 11. I also want it to animate out when shot clock is >= 11. Anyway, the issue I'm having is that EVERY TIME the text changes it animates in or out, but I only want it to animate in when the value changes from 11 or greater to 10 or less, and only animate out only when the value changes from 10 or less to 11 or greater. SO I think I need a way to find the previous value of the text before it changes with the onSetText event. Any thoughts? Thanks.

    ------------------------------
    Roger Heyward
    ------------------------------


  • 2.  RE: Script for onSetText event to get previous value of text

    Ross Staff
    Posted 2 days ago
    This probably isn't the best way but it came to mind. 

    I'm sure there's a better way to write this but I have my head deep in something else atm. 

    dim sd as xpSceneDirector

    dim old as xpTextObject
    scene.GetObjectByName("oldText", old)

    if old.text > 11
    if text < 11
    scene.getscenedirectornyname("In", sd)
    sd.play
    end if
    end if

    if old.text < 11
    if text > 11
    scene.getscenedirectornyname("Out", sd)
    sd.play
    end if
    end if

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



  • 3.  RE: Script for onSetText event to get previous value of text

    Posted 2 days ago
    Thanks Red. I'm new to scripting in Xpression and Visual Basic, so never thought to use a dummy text object to hold my previous values. Question: Do I have to update old after each text change? Seems that I do. So I'd think you need this line at the end of the code:

    old.Text = Text

    ------------------------------
    Roger Heyward
    ------------------------------



  • 4.  RE: Script for onSetText event to get previous value of text

    Ross Staff
    Posted 2 days ago
    Yes, you would want that at the end, I thought I'd written that but must not have copied it from my other window.

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



  • 5.  RE: Script for onSetText event to get previous value of text

    Posted 6 hours ago

    Hey Red. I basically got this working. Thanks for the help, but I got one more issue here. Maybe you can help. The project is complex so it is a little hard to explain, so I have attached the project here, https://drive.google.com/file/d/1wYu6SX3aSY8Xr9W2bCJJDLc9hg0kE0gq/view?usp=sharing . You can easily see the problem by taking Item 4053, then change the Shotclock1 text to anything below 11, BUT  the issue is when you take out the score (item 4053). It does weird things. It will disappear then reappear before it dropped down. Basically, I want the shot clock to move down first if it is live. I think it does this sometimes too when you bring the score in. I do have another script running in the Score Out scene director that can also take the shot clock out. Maybe that is the issue. If you can please take a look. Thanks.



    ------------------------------
    Roger Heyward
    ------------------------------