I will test this out tonight.
Original Message:
Sent: 01-22-2025 14:53
From: Zachary Fradette
Subject: Xpression - Resetting score when weight class is changed
Hey Mike, all good to be new with scripting, thanks for coming to the forums to ask!
From what it's sounding like; if you're already setting a text object WITH the widget, you wouldn't need to get the widget at all (since it's setting the text object, so we have the info we would get from it anyway)
For future edification, to get a widget that's within the same project as the scene, you'd use:
' Depending on how you access the scene, whether it be via a text object (where the scene is called Scene)' or via the scene itself (where the scene is called Self), the reference below may change.' Check the parameters included with the method you're using above the script entry box on the script.dim myWidget as xpTextListWidgetScene.Project.GetWidgetByName("TheWidgetsName", myWidget)' From there, once you've gotten the widget, all you need to do is use myWidget.Value to get whatever is typed indim dataWithinMyWidget as String = myWidget.Value
For our puposes, however, we can use the OnSetText Event. Whenever the Widget changes, the associated text object should change as well.
So with that said; our OnSetText gives us 2 crucial pieces of information: (1) "Self", which is the TextObject that the event is happening on AS IT CURRENTLY STANDS and (2) "Text", which is the string that is ABOUT TO BE SET on the Text object.
Granted, OnSetText is only going to run when the text is changed, so there may be an implication that every time the script is running, your weight class widget has changed, so you might not even need to truly compare. However, if we want to go ahead and verify that our weight class is changing, we can write a script like this:
' Remember, Self is the text object as it stands historically, Text is the future text.' So here, we're checking does "Self" (the object) ".Text" (the text property of the object) NOT EQUAL the upcoming "Text"?If Not Self.Text.Equals(Text) Then ' Do Stuff HereEnd If
------------------------------
Zachary Fradette
United States
Original Message:
Sent: 01-20-2025 15:12
From: Mike Gerken
Subject: Xpression - Resetting score when weight class is changed
Awesome , Thanks.
How would I add that into the script?
Here is how I started before:
Dim WeightClassWidget as xpTextListWidget
Engine.GetWidgetByName("WeightClass",WeightClassWidget)
I have only ever used the Engine call. I am very new to scripting.
Thanks
------------------------------
Mike Gerken
Production Truck Engineer
KCRG-TV9
Original Message:
Sent: 01-16-2025 13:26
From: Garner Millward
Subject: Xpression - Resetting score when weight class is changed
Engine calls that use methods inside of project files (like materials and widgets) are sent to the Active project (the one that is in bold in the Project Manager).
Project calls that use methods inside of project files (like materials and widgets) are sent to the project that the call comes from.
So using Projects calls ensures you are grabbing the material or widget (or others) from the project of origin, and not whatever project happens to be active.
Generally, MOS/News workflows tend to have multiple project files loaded simultaneously, where Live Event and Master Control/Channel workflows tend to only use a single project file. Of course, that may genrally be the case, but there are many many edge cases and exceptions.
Original Message:
Sent: 01-16-2025 12:49
From: Azathoth Son of Cthulhu
Subject: Xpression - Resetting score when weight class is changed
I don't have much experience with Widgets, but I imagine the Widget is changing the text object when the weight class changes.
As far as grabbing the widget, grab the project from the scene : Proj = Scene.Project, and then use Proj.GetWidgetByName
Don't use Engine.GetWidgetByName
There is a post that explains why some commands work with Project but not Engine even though they both have it. However, the reason wasn't clear enough or distinct enough for me to remember why.
Try using the command from Project.
------------------------------
Azathoth
Son of Cthulhu
Original Message:
Sent: 01-16-2025 11:38
From: Mike Gerken
Subject: Xpression - Resetting score when weight class is changed
Hello, long time listener first time caller.
I have a scripting question. How would I write an OnSetText script that will reset the score when the weight class is changed. I have a widget named "WeightClass" and I have the individual Home and Away scores as plain text objects. I tried using the GetWidgetByName but I might be a little over my head at this point. Also I'm using Xpression 8.x so, from what I can tell I don't have the option for the OnSet Visual Logic. Any help would be greatly appreciated.
------------------------------
Mike Gerken
Production Truck Engineer
KCRG-TV9
------------------------------