Chess evaluation bar

Hi!

I’m trying to build a chess evaluation bar that updates based on new values from a datalinq.
I have a script that works to set the right keyframes as the scene is taken online, but I’m at a loss for how to script live updates.
I tried to put it the script on the text object recieving the value at the OnSetText, but understand that that wil only run before the new value is set.

I have this script on the text object datalinqed to the desired end value:

dim arrow as xpBaseObject
dim ValueOld as xpTextObject
dim ValueNew as xpTextObject
dim MoveArrow as xpAnimController

Scene.GetObjectByName(“White Bar M2”, arrow)

Scene.GetObjectByName(“M2VOld”, ValueOld)
Scene.GetObjectByName(“M2VNew”, ValueNew)

Scene.GetAnimControllerByName(“MoveBarM2”, MoveArrow)

MoveArrow.SetKeyFrameValueTCB(arrow, 0,“Scale.X”,(ValueOld.text),0.9,-15.0,-0.950)
MoveArrow.SetKeyFrameValueTCB(arrow, 23,“Scale.X”,(ValueNew.text),0.9,-15.0,-0.950)

dim MoveBar as xpSceneDirector

Scene.GetSceneDirectorByName (“MoveBarM2”, MoveBar)

MoveBar.Play

Where do I put the script to trigger the animation each time there is an new value from the datalinq? It pulls every 960 ms, so it shouldn’t get a new value before the animation is done.

Maybe there is a much simpler way to do this?
Do I need to take the datalinqed values and put into another text object or could I just use the input texts as the values called upon by the script?
We have had a version where visual logic triggers the SceneDirector, but it would freeze after being on air for some time, so trying to both do a cleanup (there’s a new design style) and simplify the scene. We will have a total of 3 bars on the same scene going simultaneously.

Is there a command to run the script when a new value is input?

I have attached a project with this scene, if anyone is able to give some insights I would be very grateful.

All the best!

Oda

I finally downloaded your project and am digging in. Frankly I am lost. Ultimately what do you want it to do? I think you might have conflicting scripts working against each other but I don’t really know yet.

Hi!
I need the white bar to shrink and grow according to the input value form datalinq, live. When the value changes the bar needs to animate from the old size to the new size. When the white bar is small it is advantage black and when it is big it is advantage white. We can make the input value equal to the scale x of the white bar - 0.5 is equal (the white bar is half of the total size).
There is a script at the end of the Animation Controller that pushes the value over to ValueOld after the animation is done, but we can add a datalinq field that has the old value at all times to possibly eliminate that script.
In short: New value: trigger animation from old value to new value by setting new and old value as keyframes for scale x. Live updated as the scene is online. I believe there also needs to be an animation as the scene is taken on air to make sure the correct current value is presented. In that case there might not be both an old value and a new value in the datalinq, but that could always start fron the middle for example.The changes in values can happen both quickly and slowly, the datalinq will pull data approximately every second.
I think you’re right in there being conflictiong scripts. Does this clarify the question? Please don’t hesitate to ask and I will attempt to clarify even further!

Best regards
Oda

I answer something similar here;
https://livinglive.community/discussion/trigger-animations-using-counter-widget

Ok, I understand now. It’s miserable weather outside so this will keep me occupied. I had something similar to this a few years ago that set x position and it worked “ok” but we never really used it. No promises, but I will do my best.

The first thing that I found is you have a text object “M2 Animation Vlaue Old” that is called in one of your scripts as “M2 Animation Value Old” . I will keep looking.

Something else I have done in the past, sorry I have not downloaded the project to look at the scene. But I had a soccer possession bar that I needed to animate depending on the percentage of possession. Well I made 2 quads, one home, one away, and then lets say the away one. I put it in the background a little bit, and I just did the animating on the home bar. There is no reason to be moving around 2 bars when the scaling of one bar will give you the same results. (if that makes sense).

I have seen stats before where the identifier is in the middle and so you end up having BAR text BAR and so you have to animate both bars. But when you do not have to, why do the extra work on something that will never give you a different result.