Facility Control

 View Only
  • 1.  Random Number/Spin the bottle

    Posted 02-28-2018 23:28
    We have a half-time game to select the winner of a sleepover here at the Utah Jazz. The game will be played using the under jumbotron camera shooting straight down. There will be 10 contestants, 9 rounds. The graphic will be overlayed over this camera shot. I want to have either dashboard, or Xpression generate a random number between 1 and 10 for the first round, 1 and 9 for the second, etc. This way the number will pick which animation to play and spin our bottle. Can anyone give me a push in the right direction?

    Thanks


  • 2.  RE: Random Number/Spin the bottle

    Posted 03-01-2018 11:28

    In JavaScript, you would do something like this:

    function randomNumber(min,max)
    {
        return Math.floor(Math.random()*(max-min+1)+min);
    }

    And you would call it like:

    randomNumber(1,10);
    randomNumber(1,9);

    #DashBoard


  • 3.  RE: Random Number/Spin the bottle

    Posted 03-01-2018 16:25
    Great start, @josephadams.
    You could then call it with randomNumber(1, 11 - params.getValue('round', 0)); If you have a 'round' parameter that goes from 1 to 10.
    #DashBoard


  • 4.  RE: Random Number/Spin the bottle

    Posted 03-01-2018 16:38
    PERFECT!!! Thanks guys. Not very good at java but I will give it a try. Stay tuned for more simple questions.
    #DashBoard


  • 5.  RE: Random Number/Spin the bottle

    Posted 03-01-2018 18:42
    Can this be done inside of Xpression? I know my way around things there? Could I have the operator hit a button for each round of "spin the bottle" and that would trigger a script that generates the random number, then applies that to a SceneDirector and fires that Director?
    #DashBoard


  • 6.  RE: Random Number/Spin the bottle

    Posted 03-01-2018 18:43
    I've not used Xpression, I'll defer to @jamespeltzer for this.
    #DashBoard


  • 7.  RE: Random Number/Spin the bottle

    Posted 03-01-2018 21:01
    You could certainly send triggers to XPression whenever anyone hits a 'round' button in DashBoard. You'd either use RossTalk SmartGPI or DataLinq to do it. From there, there is plenty you can do with XPression's scripting engine - though you'd want to post in the XPression forum to get more info.
    #DashBoard