Facility Control

 View Only
  • 1.  Pause Command

    Posted 04-29-2018 22:54
    Hey guys,
    "‹This is probably an easy question, but I cant seem to figure it out....
    "‹I see that in the tasks for a pause, it is just the number 500.
    "‹It says also you can use for ogscript "return 500; //wait 0.5 seconds"
    "‹however when I try to use that command, as below, it isn't working....

    return 500;
    rosstalk.sendMessage('localhost', 7788, 'TAKE 990:1:-1');

    "‹It's just not doing anything. And If I just type 500 as a line of text it does nothing.

    "‹What am I doing wrong?
    "‹I just want to set pauses in ogscript.

    "‹Thanks!


  • 2.  RE: Pause Command

    Posted 04-30-2018 04:02
    Hi Davyboy,

    The return statement exits the script, so it'll never send the message (return is for returning a value from a function/script, and goes back to the calling function/script). I've never used pauses, so I can't comment on how to do it, except that the way you have it there isn't the right way.

    James.
    #DashBoard


  • 3.  RE: Pause Command

    Posted 04-30-2018 11:57
    1: I was once after the exact same thing you're looking at now. However I ended up making 3 tasks... They work from top to bottom, so I ended up with: [LIST=1]
  • Do whatever I can before the pause...
  • Pause for X milliseconds
  • Do whatever I want to happen after the pause...
  • Not pretty, not clean, and not something I'd recommend, as it gets clumsy and hard to keep track of variables etc accross each task.
    I also believe there is a problem with sending conflicting commands to Carbonite/Xpression with other buttons when DashBoard is in pause that caused some issue, but I cant remember exactly...

    HOWEVER!

    I did find this in the archive here in the forum:
    https://discussions.rossvideo.com/fo...-within-a-task

    And from what @jamespeltzer says here:

    ogScript does not allow pauses to be performed in the main DashBoard UI thread but they can be done in the "asyncExec" thread.
    The trick is to put your code into a function and then call that function with ogscript.asyncExec.

    function doFade()
    {
    var counter = 0;
    while (counter < 10)
    {
    ogscript.debug(counter);
    counter++;
    ogscript.pause(500);
    }
    }

    ogscript.asyncExec(doFade, 0);


    #DashBoard


  • 4.  RE: Pause Command

    Posted 04-30-2018 15:41

    Thanks for your help, basically I have a score bug that I have made in Dashboard/Xpression. The reason I'm seeking the pause is because I am running checks to see what state the bug is in before it animates off. So if there is a stat pop-up active, I want that to finish animating off before the whole bug animates off... Here is the code that I am using:
    ​I was hoping for one simple line of code. I'm not sure I understand whats going on above.


    var flyin = params.getValue('Fly_In_Status', 0);
    var popup = params.getValue('Popup_Toggle', 0);


    if (flyin == 0)
    {params.setValue('Down_Toggle', 0, '0');
    params.setValue('Flag_Toggle', 0, '0');
    if (popup == 1)
    {params.setValue('Popup_Toggle', 0, '0');
    ​ return 500}
    rosstalk.sendMessage('localhost', 7788, 'TAKE 990:1:-1');}


    if (flyin == 1)
    rosstalk.sendMessage('localhost', 7788, 'TAKE 999:1:-1');


    #DashBoard


  • 5.  RE: Pause Command

    Posted 05-02-2018 09:20
    You sure you're not trying to solve this in the "wrong end" of the chain?
    I'm pretty sure what you're trying to achieve here can be done through Xpression and its Transition Logic.

    Take a look here:
    https://www.rossvideo.com/gallery/xpression-transition-logic/
    #DashBoard