Graphics

 View Only
Expand all | Collapse all

Basketball Score Bug Animation Scripting

  • 1.  Basketball Score Bug Animation Scripting

    Posted 01-13-2024 03:21

    I am new to scripting and have been trying to teach myself Visual Basic but I need some help trying to make this work. Essentially I am working on a basketball score bug and I want it to play different animations depending on how much a certain text object increases. I have it set up right now to only play a single animation every time a text objects changes/updates. My script looks like this (for reference I have two text objects each for HOME and AWAY, one hidden and one visible, it is Datalinqd to Daktronics):

    On the scene itself:

    OnOnline

    Dim scr as xpTextObject

    scene.GetObjectByName("AW ScrText" , scr)

    scene.GetObjectByName("Aw Score" , txt)

    txt.Text = scr.Text

    --------------------------------------------------------------------

    On the hidden script (this example is only for the away score):

    OnSetText

    Dim dir as xpSceneDirector

    scene.GetSceneDirectorByName("AW Score" , dir)

    dir.PlayRange(0,60)

    ______________________________________________

    I want to change this to play a simple animation when the hidden text increases by 1 or 2 (For a free throw or field goal in basketball), and then play a different more complicated animation when it increases by 3. I know this is probably simple I am just in the process of learning so thank you for any help you can provide!

    I am guessing something like this but don't know how to connect it to the previous and current values.

    Dim previousValue As Double

    Dim currentValue As Double

    Dim increaseAmount As Double = 1.0

    Dim dir as xpSceneDirector

    If currentValue > previousValue AndAlso currentValue - previousValue >= increaseAmount Then

    scene.GetSceneDirectorByName("AW Score" , dir)

    dir.PlayRange(0,60)

    Or is there an easier way to do this with Visual Logic?



    ------------------------------
    Nathaniel Rudolph
    Xpression Graphics Operator
    CSBN
    ------------------------------



  • 2.  RE: Basketball Score Bug Animation Scripting

    Ross Staff
    Posted 01-13-2024 06:26

    I would compare the old score with the new score and calculate the delta. 

    If the delta equals 3 then play the animation else play the other animation. 

    I'm traveling and writing this on the move or I'd write the code for you here. 



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



  • 3.  RE: Basketball Score Bug Animation Scripting

    Posted 01-15-2024 14:55

    Thank you I updated my code but I am still not sure how to have it know what the previous score is. How would I store this?

    This is what I have so far (For an increase in 3 points):

    Dim previousValue As Double
    Dim currentValue As Double
    Dim dir As xpSceneDirector


    previousValue = GetPreviousScore() 'this is where I am thinking I would get it from I just don't know if there is a method for this
    currentValue = GetCurrentScore()

    Dim delta As Double = currentValue - previousValue

    If Math.Abs(delta) = 3 Then
        scene.GetSceneDirectorByName("AW Score", dir)
        dir.PlayRange(0, 60)



    ------------------------------
    Nathaniel Rudolph
    Xpression Graphics Operator
    CSBN
    ------------------------------



  • 4.  RE: Basketball Score Bug Animation Scripting

    Ross Staff
    Posted 01-15-2024 14:58

    When you do your animation you must be animating the old score off I assume?

    Then the new score in?

    You can pull the old score from the object you are animating out? 



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