Hi,
I have two timers created in Dashboard that I have linked to text objects inside of Xpression. These two are to be used for the home/away power play clocks in hockey. What I need is to script it so that the clocks won't be visible when it has "0:00", but at the same time, I need to script it so that if there are offsetting penalties, then both will be not visible. However if one ends before the other, the other will become visible.
Essentially:
- If both have more than "0:00" they both won't be visible, but if one goes down to "0:00" before the other, then the other will become visible.
- However, if they both read "0:00" (the default state with no penalties) then neither will be visible.
I've been trying to play with the scripting, but haven't managed to get it working
Simple version of the code to just get one timer to toggle visibility:
dim homepp as xptextobject
scene.getobjectbyname ("home pp", homepp)
if text = "0:00"
homepp.visibility=false
else
homepp.visibility=true
end if
This successfully makes it so when I add 2 minutes to the clock, it is visible, and when I rest it to 0 it is not. However, when I try to add code to interact with the other timer is where I am having issues.
dim homepp as xptextobject
dim awaypp as xptextobject
scene.getobjectbyname ("home pp", homepp)
scene.getobjectbyname ("away pp", awaypp)
if homepp.text = "0:00"
homepp.visible=false
else
homepp.visible=true
end if
This is without even trying to do anything with the other timer. When I change the "text" in the first code to "homepp.text" in the second example, it seems to somehow flip everything around. It is now visible when 0 and when I add 2 minutes, it is not. I am not quite sure why this would be. Still pretty new to this, and admit that the scripting is far from my strong suit.
Any help is appreciated. Thanks.