Facility Control

 View Only
Expand all | Collapse all

Auto Animation when clock reaches 0

Dennis Blank

Dennis Blank05-31-2017 19:48

  • 1.  Auto Animation when clock reaches 0

    Posted 05-17-2017 12:59
    Hi Guys

    I want a graphic to animate once my match clock has reached 0. Is there a command to do this?


  • 2.  RE: Auto Animation when clock reaches 0

    Posted 05-17-2017 14:49

    Yes. You can add additional tasks to timers and user the timer's "event" object to learn more about its current state.

    In this example, I'm using event.getCurrentValue() to return the timer's current value in milliseconds. When the value reaches 0, I rename my label. You can just as easily send a command to XPression to bring a Take ID on air or trigger something else.

    <abs contexttype="opengear">
       <meta>
          <params>
             <param access="1" maxlength="0" name="Timer Display" oid="Timer_Display" type="STRING" value="RUN AMIMATION!" widget="label"/>
          </params>
       </meta>
       <timer autostart="false" id="my-timer" pattern="HH:mm:ss" rate="500" start="00:00:05" stop="00:00:00">
          
          
       <timertask tasktype="ogparamset">params.setValue('Timer_Display', 0, event.getDisplay());</timertask>
          <timertask tasktype="ogscript">if (event.getCurrentValue() == 0)
    {
       ogscript.debug("PUT CODE TO RUN ANIMATION HERE!");
       params.setValue('Timer_Display', 0, 'RUN AMIMATION!'); //Remove this
    }
    </timertask>
       </timer>
       <param expand="true" height="76" left="25" oid="Timer_Display" style="style:timerLabel" top="26" width="394"/>
       <simplegrid height="48" left="27" rows="1" top="109" width="394">
          <button buttontype="push" name="Start">
             <task tasktype="timercontrol">ogscript.getTimerManager().getTimer('my-timer').startTimer(false);</task>
          </button>
          <button buttontype="push" name="Stop">
             <task tasktype="timercontrol">ogscript.getTimerManager().getTimer('my-timer').stopTimer(false);</task>
          </button>
          <button buttontype="push" name="Reset">
             <task tasktype="timercontrol">ogscript.getTimerManager().getTimer('my-timer').resetTimer();</task>
          </button>
       </simplegrid>
    </abs>

    #DashBoard


  • 3.  RE: Auto Animation when clock reaches 0

    Posted 05-18-2017 07:29
    Hi James

    Thank you very much.

    I will give this a go
    #DashBoard


  • 4.  RE: Auto Animation when clock reaches 0

    Posted 05-22-2017 08:55
    Hi James

    Iv attached my code for this. My clock name is Period.Clock and the OID is 0x2.

    I am not quite sure what you mean by "PUT CODE TO RUN ANNIMATION" I am also a bit unsure about the line that says "Remove this"

    Thanks in advance.

    Regards
    Dennis
    #DashBoard


  • 5.  RE: Auto Animation when clock reaches 0

    Posted 05-22-2017 22:15
    I used visual logic to compare the clock to a value, in this case 0.1, and when it is less than that it triggers an animation director.
    #DashBoard


  • 6.  RE: Auto Animation when clock reaches 0

    Posted 05-23-2017 08:22
    Thank you for the advice, could you explain how you did that?
    #DashBoard


  • 7.  RE: Auto Animation when clock reaches 0

    Posted 05-23-2017 17:55
    Malthepal has the right idea for his part.
    Where I say "PUT THE CODE TO RUN ANNIMATION", I mean, you should create a button that runs your animation by triggering it via RossTalk in order to get the correct piece of script to use.

    Perhaps Malthepal can provide the command... otherwise, I would suggest posting that part of the question in the XPression area.

    You can then copy the piece of script generated by VisualLogic (or keep the button and use rosstalk.fireGPI to trigger the button if you put a "Trigger ID" on it) and put that where I say to run the animation. The "remove this" line is to remove the piece of code I use to change the label to say "RUN ANIMATION" as this is not necessary.

    James
    #DashBoard


  • 8.  RE: Auto Animation when clock reaches 0

    Posted 05-24-2017 08:10
    Hi James

    I have attached the my script that I have tried. I am not sure where I am falling short but it does not seem to work.
    #DashBoard


  • 9.  RE: Auto Animation when clock reaches 0

    Posted 05-24-2017 13:43

    Hi Dennis.
    There are 3 problems with your attached code:
    1. The "Start" button is throwing an error because the timer IDs are case sensitive and you have a lowercase "c" in your script and and uppercase "C" in your timer's ID (Period.Clock)

    2. You've taken the script to send the RossTalk command and put the whole thing in quotes. You have:
    ogscript.debug("rosstalk.sendMessage(ogscript.getPrivateString('hosts', 'Dashboard.host'), parseInt(ogscript.getPrivateString('hosts', 'Dashboard.port')), 'SEQI 399:0');");

    What you probably want is:
    rosstalk.sendMessage(ogscript.getPrivateString('hosts', 'Dashboard.host'), parseInt(ogscript.getPrivateString('hosts', 'Dashboard.port')), 'SEQI 399:0');

    3. Your code is referencing a lookup table that contains the host/port information. It looks like you copied the button code but not the lookup table with the actual values.
    I generally recommend selecting the "Create Parameter" option when adding new devices to Visual Logic because it is easier to modify your device settings in the future.
    Overall, the code would become:

    <abs contexttype="opengear">
       <meta>
          <lookup id="hosts">
             <entry key="XPression.scriptport">true</entry>
             <entry key="XPression.color">-1145302</entry>
             <entry key="XPression.port">params.getValue('XPression_RossTalkPort', 0)</entry>
             <entry key="XPression.host">params.getValue('XPression_IPAddress', 0)</entry>
             <entry key="XPression.scripthost">true</entry>
             <entry key="XPression.devicetype">XPression</entry>
          </lookup>
          <params>
             <param access="1" maxlength="0" name="Period.Clock" oid="0x2" type="STRING" value="RUN AMIMATION!" widget="label"/>
             <param access="1" maxlength="0" name="XPression_IPAddress" oid="XPression_IPAddress" type="STRING" value="" widget="0"/>
             <param access="1" maxlength="0" name="XPression_RossTalkPort" oid="XPression_RossTalkPort" type="STRING" value="7788" widget="0"/>
          </params>
       </meta>
       <timer autostart="false" id="Period.Clock" pattern="mm:ss" rate="1" start="12:00" stop="00:00">
          <timertask tasktype="ogparamset">params.setValue('0x2', 0, event.getDisplay());</timertask>
          <timertask tasktype="ogscript">if (event.getCurrentValue() == 0)
    {
       rosstalk.sendMessage(params.getValue('XPression_IPAddress', 0), params.getValue('XPression_RossTalkPort', 0), "SEQI " + 399 + ":" + 0);
       params.setValue('0x2', 0, 'RUN AMIMATION!');
    }</timertask>
       </timer>
       <param expand="true" height="76" left="25" oid="0x2" style="style:timerLabel" top="26" width="394"/>
       <simplegrid height="48" left="27" rows="1" top="109" width="394">
          <button buttontype="push" name="Start">
             <task tasktype="timercontrol">ogscript.getTimerManager().getTimer('Period.clock').startTimer(false);</task>
          </button>
          <button buttontype="push" name="Stop">
             <task tasktype="timercontrol">ogscript.getTimerManager().getTimer('Period.Clock').stopTimer(false);</task>
          </button>
          <button buttontype="push" name="Reset">
             <task tasktype="timercontrol">ogscript.getTimerManager().getTimer('Period.Clock').resetTimer();</task>
          </button>
       </simplegrid>
       <table height="117" left="635" style="bg#dark;bdr:etched;" top="30" width="338">
          <tr>
             <label colspan="1" fill="both" insets="2,2,2,2" name="XPression Host: " rowspan="1" style="txt-align:east;" weighty="1.0"/>
             <param colspan="1" expand="true" fill="both" insets="2,2,2,2" oid="XPression_IPAddress" rowspan="1" weightx="1.0" weighty="1.0" widget="3"/>
          </tr>
          <tr>
             <label colspan="1" fill="both" insets="2,2,2,2" name="XPression Port: " rowspan="1" style="txt-align:east;" weighty="1.0"/>
             <param colspan="1" expand="true" fill="both" insets="2,2,2,2" oid="XPression_RossTalkPort" rowspan="1" weightx="1.0" weighty="1.0" widget="3"/>
          </tr>
       </table>
    </abs>

    The last thing to consider would be having the code attached to a button and having the timer code "press" the button:

    <abs contexttype="opengear">
       <meta>
          <lookup id="hosts">
             <entry key="XPression.scriptport">true</entry>
             <entry key="XPression.color">-1145302</entry>
             <entry key="XPression.port">params.getValue('XPression_RossTalkPort', 0)</entry>
             <entry key="XPression.host">params.getValue('XPression_IPAddress', 0)</entry>
             <entry key="XPression.scripthost">true</entry>
             <entry key="XPression.devicetype">XPression</entry>
          </lookup>
          <params>
             <param access="1" maxlength="0" name="Period.Clock" oid="0x2" type="STRING" value="12:00" widget="label"/>
             <param access="1" maxlength="0" name="XPression_IPAddress" oid="XPression_IPAddress" type="STRING" value="" widget="0"/>
             <param access="1" maxlength="0" name="XPression_RossTalkPort" oid="XPression_RossTalkPort" type="STRING" value="7788" widget="0"/>
          </params>
       </meta>
       <timer autostart="false" id="Period.Clock" pattern="mm:ss" rate="1" start="12:00" stop="00:00">
          <timertask tasktype="ogparamset">params.setValue('0x2', 0, event.getDisplay());</timertask>
          <timertask tasktype="ogscript">if (event.getCurrentValue() == 0)
    {
       ogscript.fireGPI('RunAnimation', null, false);
       params.setValue('0x2', 0, 'RUN AMIMATION!');
    }</timertask>
       </timer>
       <param expand="true" height="76" left="25" oid="0x2" style="style:timerLabel" top="26" width="394"/>
       <simplegrid height="48" left="27" rows="1" top="109" width="394">
          <button buttontype="push" name="Start">
             <task tasktype="timercontrol">ogscript.getTimerManager().getTimer('Period.Clock').startTimer(false);</task>
          </button>
          <button buttontype="push" name="Stop">
             <task tasktype="timercontrol">ogscript.getTimerManager().getTimer('Period.Clock').stopTimer(false);</task>
          </button>
          <button buttontype="push" name="Reset">
             <task tasktype="timercontrol">ogscript.getTimerManager().getTimer('Period.Clock').resetTimer();</task>
          </button>
       </simplegrid>
       <button buttontype="push" gpi="RunAnimation" height="125" left="421" name="Run Animation" top="26" width="210">
          <task tasktype="ogscript">
    
    
    /*! block id=1002 !*/
    ogscript.debug("Press button");
    /*! block id=1000 !*/
    rosstalk.sendMessage(params.getValue('XPression_IPAddress', 0), params.getValue('XPression_RossTalkPort', 0), "SEQI " + 399 + ":" + 0);
    /*!!
     &lt;block id="1002" type="ogscript_debug" x="7" y="21" w="243" MESSAGE="Press button"  next="ID:1000" /&gt;
    &lt;block id="1000" type="XPression_xpression_seqilayer" x="10" y="100" w="243" color="#ee862a" TAKEID="399" LAYER="0" /&gt;
    !!*/
    /*!!&lt;checksum&gt;96064eb7857be08aa4e00cac303703bf&lt;/checksum&gt;!!*/</task>
       </button>
       <table height="117" left="635" style="bg#dark;bdr:etched;" top="30" width="338">
          <tr>
             <label colspan="1" fill="both" insets="2,2,2,2" name="XPression Host: " rowspan="1" style="txt-align:east;" weighty="1.0"/>
             <param colspan="1" expand="true" fill="both" insets="2,2,2,2" oid="XPression_IPAddress" rowspan="1" weightx="1.0" weighty="1.0" widget="3"/>
          </tr>
          <tr>
             <label colspan="1" fill="both" insets="2,2,2,2" name="XPression Port: " rowspan="1" style="txt-align:east;" weighty="1.0"/>
             <param colspan="1" expand="true" fill="both" insets="2,2,2,2" oid="XPression_RossTalkPort" rowspan="1" weightx="1.0" weighty="1.0" widget="3"/>
          </tr>
       </table>
    </abs>

    The important parts are:

    <button buttontype="push" gpi="RunAnimation" height="125" left="421" name="Run Animation" top="26" width="210">
       <task tasktype="ogscript">
    
    
    /*! block id=1002 !*/
    ogscript.debug("Press button");
    /*! block id=1000 !*/
    rosstalk.sendMessage(params.getValue('XPression_IPAddress', 0), params.getValue('XPression_RossTalkPort', 0), "SEQI " + 399 + ":" + 0);
    /*!!
     &lt;block id="1002" type="ogscript_debug" x="7" y="21" w="243" MESSAGE="Press button"  next="ID:1000" /&gt;
    &lt;block id="1000" type="XPression_xpression_seqilayer" x="10" y="100" w="243" color="#ee862a" TAKEID="399" LAYER="0" /&gt;
    !!*/
    /*!!&lt;checksum&gt;96064eb7857be08aa4e00cac303703bf&lt;/checksum&gt;!!*/</task>
    </button>

    And, in the timer task:
    "‹if (event.getCurrentValue() == 0)
    {
    ogscript.fireGPI('RunAnimation', null, false);
    params.setValue('0x2', 0, 'RUN AMIMATION!');
    }


    #DashBoard


  • 10.  RE: Auto Animation when clock reaches 0

    Posted 05-24-2017 15:22
    Hi James

    Thank you for the insight. I will try this an report back
    #DashBoard


  • 11.  RE: Auto Animation when clock reaches 0

    Posted 05-25-2017 16:28

    Here is how I do my shotclock color change. I have set the threshold for the change at 10.5 because it takes just a bit to change the material.


    #DashBoard


  • 12.  RE: Auto Animation when clock reaches 0

    Posted 05-25-2017 16:38

    oops, wrong scene above. In this example I get my L_Timer from a widget, but you could get the timer from a scoring system like TISSOT, OES, etc. Once that widget is less than .1 it triggers the scene director "Buzzer_L" with the command Actions.Play.


    #DashBoard


  • 13.  RE: Auto Animation when clock reaches 0

    Posted 05-30-2017 07:46
    Hi Malthepal

    I will give this a goo and let you know.

    Thanks a lot.

    #DashBoard


  • 14.  RE: Auto Animation when clock reaches 0

    Posted 05-30-2017 16:47
    Happy to help Dennis, let me know how it works for you.
    #DashBoard


  • 15.  RE: Auto Animation when clock reaches 0

    Posted 05-31-2017 11:51
    Hi Mal

    I for some odd reason cannot find the "Value" or "equals to" block.

    Could you guide me?
    #DashBoard


  • 16.  RE: Auto Animation when clock reaches 0

    Posted 05-31-2017 16:03
    Sure, the "value" is under the math tab, and "equal to" is under the logic tab. You could also use "less than"
    #DashBoard


  • 17.  RE: Auto Animation when clock reaches 0

    Posted 05-31-2017 16:44
    Hi Mal

    I can see "Value of" under number but I do not see "equals to" or "less than". I do not have a logic tab. Perhaps I'm in the wrong version of dashboard?
    #DashBoard


  • 18.  RE: Auto Animation when clock reaches 0

    Posted 05-31-2017 16:48
    I believe that Mal was talking about where to find those blocks if you were doing your logic inside of XPression. (which some of the earlier screenshots were from).

    If you are using DashBoard, the right hand pane in Visual logic is where you would find all of your logic blocks, the block you want in DashBoard for this type of operation is the 'if' block. (either use the search at the top right hand pane, or, find it in the tree under the 'control/conditional' node).
    #DashBoard


  • 19.  RE: Auto Animation when clock reaches 0

    Posted 05-31-2017 17:09
    Hi Troy

    Cheers! I'll give it a go!
    #DashBoard


  • 20.  RE: Auto Animation when clock reaches 0

    Posted 05-31-2017 19:48

    Hi Troy

    Does this make sense?


    #DashBoard


  • 21.  RE: Auto Animation when clock reaches 0

    Posted 05-31-2017 20:10
    Sorry Dennis, I work in Xpression. I haven't had the chance to use DashBoard. I was hoping there wasn't much of a difference. But to my eyes you have the right idea.

    #DashBoard