View Only
  • 1.  Timer Widget Sync with Datalinq

    Posted 12 days ago
    Hey everybody,

    I'm creating a timing/scoring bug and I have a timer (remaining heat time) which will need to be synced to a text object connected to a datalinq feed (JSON).

    Is there a script that would allow me to sync the datalinq value with my Widget Timer and get it to start right away?

    So, the remaining time value would be pulled by datalinq, synced with my Widget timer and started right away with some script.

    Thank you for the help!

    Paulo Dias

  • 2.  RE: Timer Widget Sync with Datalinq

    Posted 11 days ago
    Hi Paulo
    What are you timing/doing with your Widget timer?
    If you have a widget called ClockTimer1, and put the below script in the OnSetText of the text object that is Datalinqed to your external clock source, then as soon as the external clock value changes, the widget will start.
    The problem is that your widget will be 1 clock tick out, as it will start on the first change, not as soon as the clock starts, which can be different.
    Do you have a flag in your Datalinq clock source that shows the clock is running? If you looked at that flag instead, that would give a more accurate result.
    All depends on what your widget timer is for though!

    dim myWidget as xpClockTimerWidget
    'We come here when XPression is setting up the datalinq values.
    'The scene may not be online though, so just reset our flag for now
    'scene.tag is number that is not tied to any object, so is invisble
    'and great for doing stuff like this.
    if scene.IsOnline = false then
    		scene.tag = 0
    	'if we're here, the scene is online
    	'Have we been here before, ie the scene is online and the text has changed
    		select case scene.Tag
    			case 0
    				'first time here, so flag that
    				scene.tag = 1
    			case 1
    				'second time here, start our widget.
    				'Increment our flag so we don't try and start the widget again
    				engine.GetWidgetByName("ClockTimer1", myWidget)
    				scene.tag = 2
    		end select
    	end if

    Simon Latus
    Simon Latus Media Ltd
    United Kingdom