Graphics

 View Only
  • 1.  Setting Clock Countdown

    Posted 02-17-2021 22:03

    I have a dashboard panel that calculates the time between the current time to a set kickoff time in minutes. How do I trigger a set value from Dashboard to an XPression widget?

    In Dashboard I have this:

    <table height="150" left="38" top="52" width="225">
    <tr>
    <label colspan="3" fill="both" header="true" name="Countdown to Kick" rowspan="1" style="txt-align:center;bg#0c2340;size:Big;" weightx="1.0" weighty="1.0"/>
    </tr>
    <tr>
    <param colspan="1" expand="true" fill="both" oid="kickoffhour" style="font:bold;size:Bigger;txt-align:center;tt:Hour;" weightx="1.0" weighty="1.0"/>
    <param colspan="1" expand="true" fill="both" oid="kickoffminute" style="font:bold;size:Bigger;txt-align:center;tt:Minute;" weightx="1.0" weighty="1.0"/>
    <param colspan="1" expand="true" oid="am-pm" style="style:toggleButton" weightx="1.0" weighty="1.0"/>
    </tr>
    <tr>
    <button buttontype="push" colspan="3" fill="both" flat="true" id="set-kickoff-time" name="Set &amp; Go" rowspan="1" weightx="1.0" weighty="1.0">
    <task tasktype="ogscript">/*! block id=1114,1113,1121,1123,1115,1122,1117,1115 !*/
    if (params.getValue('am-pm', 0) == 1)
    {
    params.setValue('kickoffhour', 0, (params.getValue('kickoffhour', 0) + 12));
    } else {
    return params.getValue('kickoffhour', 0);
    }
    /*!!
    &lt;block id="1114" type="if" x="281" y="160" w="268" INPUT1="ID:1113" OPERATION="equals" INPUT2="1" TRUE="ID:1121" FALSE="ID:1117" IGNORE="" /&gt;
    &lt;block id="1113" type="param__top&amp;amp;am-pm (am-pm)[0]" x="53" y="158" w="243" SET="" /&gt;
    &lt;block id="1121" type="param_setvalue" x="672" y="211" w="318" PARAM="[root, Params for Matchday-Main.grid, Not In Menu, kickoff-hour (kickoffhour)]" VALUE="ID:1123" /&gt;
    &lt;block id="1123" type="math_add" x="518" y="32" VALUE="ID:1115" VAL_1="ID:1122" w="218" VAL_1_1="" /&gt;
    &lt;block id="1115" type="param__top&amp;amp;kickoff-hour (kickoffhour)[0]" x="297" y="33" w="243" SET="" /&gt;
    &lt;block id="1122" type="number" x="369" y="87" w="168" VALUE="12" /&gt;
    &lt;block id="1117" type="return" x="540" y="371" w="243" VALUE="ID:1115" /&gt;
    &lt;block id="1115" type="param__top&amp;amp;kickoff-hour (kickoffhour)[0]" x="297" y="33" w="243" SET="" /&gt;
    !!*/
    /*!!&lt;checksum&gt;efb14cf986834fa131b0a6177ef83d05&lt;/checksum&gt;!!*/</task>
    <task tasktype="ogscript">/*! block id=1054,1052,1051,1053 !*/
    params.setValue('kickoffhour', 0, (params.getValue('kickoffhour', 0) * 60));
    /*!!
    &lt;block id="1054" type="param_setvalue" x="655" y="179" w="318" PARAM="[root, Params for Matchday-Main.grid, Not In Menu, kickoff-hour (kickoffhour)]" VALUE="ID:1052" /&gt;
    &lt;block id="1052" type="math_multiply" x="420" y="175" VALUE="ID:1051" VAL_1="ID:1053" w="218" VAL_1_1="" /&gt;
    &lt;block id="1051" type="param__top&amp;amp;kickoff-hour (kickoffhour)[0]" x="86" y="167" w="243" SET="" /&gt;
    &lt;block id="1053" type="number" x="154" y="240" w="168" VALUE="60" /&gt;
    !!*/
    /*!!&lt;checksum&gt;63818a08e20ebd21b4c1c40b25c2cae5&lt;/checksum&gt;!!*/</task>
    <task tasktype="ogscript">/*! block id=1059,1057,1055,1056 !*/
    params.setValue('kickoff-totalmin', 0, (params.getValue('kickoffhour', 0) + params.getValue('kickoffminute', 0)));
    /*!!
    &lt;block id="1059" type="param_setvalue" x="651" y="301" w="318" PARAM="[root, Params for Matchday-Main.grid, Not In Menu, kickoff-totalmin (kickoff-totalmin)]" VALUE="ID:1057" /&gt;
    &lt;block id="1057" type="math_add" x="444" y="297" VALUE="ID:1055" VAL_1="ID:1056" w="218" VAL_1_1="" /&gt;
    &lt;block id="1055" type="param__top&amp;amp;kickoff-hour (kickoffhour)[0]" x="210" y="280" w="243" SET="" /&gt;
    &lt;block id="1056" type="param__top&amp;amp;kickoff-minute (kickoffminute)[0]" x="209" y="360" w="243" SET="" /&gt;
    !!*/
    /*!!&lt;checksum&gt;a4bfa8ff63d3f85b918227bede425bde&lt;/checksum&gt;!!*/</task>
    <task tasktype="ogscript">/*! block id=1073,1072,1069,1110,1109,1111,1070,1112,1071,1070 !*/
    params.setValue('countdown-to-kick', 0, (params.getValue('kickoff-totalmin', 0) - ((new Date().getHours() * 60) + new Date().getMinutes())));
    /*!!
    &lt;block id="1073" type="param_setvalue" x="733" y="257" w="318" PARAM="[root, Params for Matchday-Main.grid, Not In Menu, countdown-to-kick (countdown-to-kick)]" VALUE="ID:1072" /&gt;
    &lt;block id="1072" type="math_subtract" x="544" y="261" VALUE="ID:1069" VAL_1="ID:1110" w="218" VAL_1_1="" /&gt;
    &lt;block id="1069" type="param__top&amp;amp;kickoff-totalmin (kickoff-totalmin)[0]" x="278" y="243" w="243" SET="" /&gt;
    &lt;block id="1110" type="math_add" x="455" y="472" VALUE="ID:1109" VAL_1="ID:1071" w="218" VAL_1_1="" /&gt;
    &lt;block id="1109" type="math_multiply" x="233" y="405" VALUE="ID:1111" VAL_1="ID:1112" w="218" VAL_1_1="" /&gt;
    &lt;block id="1111" type="getHours" x="19" y="413" w="243" DATE="ID:1070" /&gt;
    &lt;block id="1070" type="currentdate" x="15" y="322" w="243" empty2="" /&gt;
    &lt;block id="1112" type="number" x="92" y="477" w="168" VALUE="60" /&gt;
    &lt;block id="1071" type="getMinutes" x="219" y="526" w="243" DATE="ID:1070" /&gt;
    &lt;block id="1070" type="currentdate" x="15" y="322" w="243" empty2="" /&gt;
    !!*/
    /*!!&lt;checksum&gt;5f303c52d75236e51c730e7b02e617dc&lt;/checksum&gt;!!*/</task>
    <task tasktype="ogscript">/*! block id=1066,1068,1065,1067 !*/
    params.setValue('kickoffhour', 0, (params.getValue('kickoffhour', 0) / 60));
    /*!!
    &lt;block id="1066" type="param_setvalue" x="698" y="245" w="318" PARAM="[root, Params for Matchday-Main.grid, Not In Menu, kickoff-hour (kickoffhour)]" VALUE="ID:1068" /&gt;
    &lt;block id="1068" type="math_divide" x="464" y="256" VALUE="ID:1065" VAL_1="ID:1067" w="218" VAL_1_1="" /&gt;
    &lt;block id="1065" type="param__top&amp;amp;kickoff-hour (kickoffhour)[0]" x="113" y="223" w="243" SET="" /&gt;
    &lt;block id="1067" type="number" x="203" y="337" w="168" VALUE="60" /&gt;
    !!*/
    /*!!&lt;checksum&gt;90f5957af33646726cb35ed282c58f52&lt;/checksum&gt;!!*/</task>
    <task tasktype="ogscript">/*! block id=1125,1124,1129,1128,1126,1127,1130,1126 !*/
    if (params.getValue('am-pm', 0) == 1)
    {
    params.setValue('kickoffhour', 0, (params.getValue('kickoffhour', 0) - 12));
    } else {
    return params.getValue('kickoffhour', 0);
    }
    /*!!
    &lt;block id="1125" type="if" x="319" y="204" w="268" INPUT1="ID:1124" OPERATION="equals" INPUT2="1" TRUE="ID:1129" FALSE="ID:1130" IGNORE="" /&gt;
    &lt;block id="1124" type="param__top&amp;amp;am-pm (am-pm)[0]" x="82" y="234" w="243" SET="" /&gt;
    &lt;block id="1129" type="param_setvalue" x="759" y="245" w="318" PARAM="[root, Params for Matchday-Main.grid, Not In Menu, kickoff-hour (kickoffhour)]" VALUE="ID:1128" /&gt;
    &lt;block id="1128" type="math_subtract" x="548" y="42" VALUE="ID:1126" VAL_1="ID:1127" w="218" VAL_1_1="" /&gt;
    &lt;block id="1126" type="param__top&amp;amp;kickoff-hour (kickoffhour)[0]" x="306" y="46" w="243" SET="" /&gt;
    &lt;block id="1127" type="number" x="384" y="109" w="168" VALUE="12" /&gt;
    &lt;block id="1130" type="return" x="554" y="379" w="243" VALUE="ID:1126" /&gt;
    &lt;block id="1126" type="param__top&amp;amp;kickoff-hour (kickoffhour)[0]" x="306" y="46" w="243" SET="" /&gt;
    !!*/
    /*!!&lt;checksum&gt;f2bf9e438556325b02f488d319d12b13&lt;/checksum&gt;!!*/</task>
    <task tasktype="rosstalk">rosstalk.sendMessage('localhost', 7788, 'GPI 1');</task>
    <task tasktype="rosstalk">rosstalk.sendMessage('localhost', 7788, 'GPI 2');</task>
    </button>
    </tr>
    <tr>
    <param colspan="3" expand="true" fill="both" oid="countdown-to-kick" rowspan="1" style="style:timerLabel;" weightx="1.0" weighty="1.0">
    <config key="w.restricted">true</config>
    </param>
    </tr>
    </table>

    With Params:

    <params>
    <param access="1" constrainttype="INT_NULL" name="Clock-MM" oid="ClockMM" precision="0" type="INT16" value="0" widget="default"/>
    <param access="1" constrainttype="INT_NULL" name="Clock-SS" oid="ClockSS" precision="0" type="INT16" value="0" widget="default"/>
    <param access="1" constrainttype="INT_NULL" name="countdown-to-kick" oid="countdown-to-kick" precision="0" type="INT32" value="61" widget="text-display"/>
    <param access="1" constraint="0.0;12.0;0.0;12.0;1" constrainttype="INT_STEP_RANGE" name="kickoff-hour" oid="kickoffhour" precision="0" type="INT32" value="4" widget="spinner"/>
    <param access="1" constraint="0.0;59.0;0.0;59.0;1" constrainttype="INT_STEP_RANGE" name="kickoff-minute" oid="kickoffminute" precision="0" type="INT32" value="46" widget="spinner"/>
    <param access="1" constrainttype="INT_NULL" name="kickoff-totalmin" oid="kickoff-totalmin" precision="0" type="INT32" value="1006" widget="default"/>
    <param access="1" constraintstrict="false" constrainttype="STRING_STRING_CHOICE" maxlength="0" name="am-pm" oid="am-pm" type="STRING" value="1" widget="toggle">
    <constraint key="0">AM</constraint>
    <constraint key="1">PM</constraint>
    </param>
    </params>

     

    In XPression I have a scene that grabs 'coutndown-to-kick' in a text object for a script to be triggered via GPI. I'm assuming the format of the integer is what is causing the problem of setting?

    The GPI script trigger:

    dim setTimer as xpClockTimerWidget
    dim scene as xpScene
    dim time as xpBaseObject
    dim time2 as Integer

    engine.GetWidgetByName("Countdown", setTimer)
    engine.GetSceneByName("Countdown", scene)
    scene.GetObjectByName("SetTimeText", time)
    time2 = Val(time)

    setTimer.TimerValue = time2


  • 2.  RE: Setting Clock Countdown

    Posted 03-20-2021 15:37

    Not sure if this helps but are you aware of the countdown wdiget in dashboard that links directly to XPression? 

    https://www.youtube.com/watch?v=Z8zUjJB_P9Q


    #XPression


  • 3.  RE: Setting Clock Countdown

    Posted 03-20-2021 21:25

    Unfortunately that method is sending the countdown from XPression to Dashboard. (Which would've been huge for me last year before the update, so excited that it was finally added!) I believe my issue comes with triggering a GPI command to set a timer widget. Still working on it! 


    #XPression


  • 4.  RE: Setting Clock Countdown

    Posted 03-22-2021 11:09

    Not sure if this video would help at all? It's setting widgets via script. 

    https://www.youtube.com/watch?v=DScHw0SWutk 


    #XPression


  • 5.  RE: Setting Clock Countdown

    Posted 03-22-2021 15:23

    I moved away from my GPI trigger from the above code and moved to onSetText like in that video. However, I think it has something to do with my value not being the correct format. I see in the SDK, that to set widget.TimerValue should be in milliseconds, so I take my minutes from dashboard and use visual logic in my scene to convert to milliseconds (multiply by 60000) then to set the timer on onSetText. But it does nothing.

    Then I take that millisecond number and copy/paste it into the value input in the widget and it thinks that number is too high and auto sets it to 59 seconds. Which is strange.

    I wonder if need to format it to "00:00:00.000" or that the value of my integer is not translating to a readable input?

    Here's my onSetText code:

    dim clock as xpClockTimerWidget
    dim time as Integer
    engine.GetWidgetByName("CountdownTimer", clock)
    time = Val(self)
    clock.TimerValue = time

    #XPression