Graphics

 View Only
Expand all | Collapse all

Keypress in script

  • 1.  Keypress in script

    Posted 03-26-2022 20:27

    In a few months some greater soccer events are coming up, where wel will most probably will be showing the match clock.
    I've been playing around and trying stuff, so i will have things prepared for use.
    This match clock will contain several elements that are controlled by several scenedirectors. Some of these elements i would like to control through keypresses, actual situation; keypress ctrl-1 would be the first red card for the home team, ctrl-2 the second, etc... Is this possible with script? Can i start a scenedirector with a keypress thats coded?
    Something like this in VB?

     Private Sub TextBox1_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If Asc(e.KeyChar) = 97 Or Asc(e.KeyChar) = 65 Then
            MsgBox("hello")
        End If
    End Sub


    ------------------------------
    Justus van der Hulst
    Live Graphics Operator
    Euro Media Group
    Hilversum, The Netherlands
    ------------------------------


  • 2.  RE: Keypress in script

    Posted 03-27-2022 12:46
    Usually, I do this via Keyboard/GPI mapping. You assign a keyboard shortcut and can have this shortcut run a script that will trigger a specific Scene Director.

    Here is the script I use.


    dim fb as xpOutputFramebuffer
    dim scene as xpScene
    dim sd as xpSceneDirector
    dim layer as integer


    engine.GetOutputFramebuffer (0,fb)
    fb.GetSceneOnLayer (0, scene)

    For layer = -10 to 15
    If fb.GetSceneOnLayer(layer, scene) then

    if scene.name = "My Scene" then
    scene.GetSceneDirectorByName ("My Scene Director", sd)
    sd.Play
    end if

    end if

    next

    ------------------------------
    Malcolm Thorpe
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 3.  RE: Keypress in script

    Posted 03-27-2022 17:01
    Very nice! Thanks a lot! This might just be very usefull!
    Do i put this script in the scene, in the scene director as a scriot event or do i get a scriot window specifically for this keyboard shortcut?

    ------------------------------
    Justus van der Hulst
    Live Graphics Operator
    Euro Media Group
    Hilversum, The Netherlands
    ------------------------------



  • 4.  RE: Keypress in script

    Posted 03-28-2022 06:02
    You put the script in the Keyboard / GPI Mapping ("Edit -> Keyboard / GPI Mapping" and at the right side, underneath "Available Global Functions" select "Scripting -> Script Action").
    Alternatively you could build a simple Dashboard interface to control the graphics. That way you can create a button "Red Card" (and other buttons) without having to remember all the shortcuts you (or someone else) created.

    ------------------------------
    Gerard de Vries
    Solution Architect Live Graphics & Virtual Graphics
    EMG
    The Netherlands
    ------------------------------



  • 5.  RE: Keypress in script

    Posted 03-28-2022 11:13
    I'm on board with Gerard. Dashboards are so simple to build and customize. If you decide to go that way, you can assign a GPI trigger in that same screen where the script is. Then, in dashboard assign that GPI trigger number as the action on the button. DONE...

    ------------------------------
    Malcolm Thorpe
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 6.  RE: Keypress in script

    Posted 03-28-2022 12:49
    Tried the script and it worked flawless. 
    Thanks for that!

    The idea of using dashboard @Gerard de Vries  mentioned also is very attractive. Have absolutely no idea how because i hardly have any experience using Dashboard, so that'll be a whole new study....but i've got some months to find out.​

    ------------------------------
    Justus van der Hulst
    Live Graphics Operator
    Euro Media Group
    Hilversum, The Netherlands
    ------------------------------



  • 7.  RE: Keypress in script

    Posted 03-28-2022 14:08
    Check: https://www.rossvideo.com/products-services/management-systems/automated-production-control/dashboard/dashboard-u/

    ------------------------------
    Gerard de Vries
    Solution Architect Live Graphics & Virtual Graphics
    EMG
    The Netherlands
    ------------------------------



  • 8.  RE: Keypress in script

    Posted 03-28-2022 15:57

    Ah nice! I know now what i will be doing in the time in between broadcasts tomorrow! :D

    Thanks!



    ------------------------------
    Justus van der Hulst
    Live Graphics Operator
    Euro Media Group
    Hilversum, The Netherlands
    ------------------------------



  • 9.  RE: Keypress in script

    Posted 03-28-2022 17:07
    Start simple. Make a button to take a scene on line, or to use a gpi trigger that does the same thing as your keystroke. That's how I got going. Good Luck.

    ------------------------------
    Malcolm Thorpe
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 10.  RE: Keypress in script

    Posted 03-28-2022 13:55
    Hi dears, 
    i have anther way using Dashboard its very powerful 


    ------------------------------
    TAMER ABDELAZIZ
    ONTV
    ------------------------------



  • 11.  RE: Keypress in script

    Posted 03-28-2022 15:58
    Impressive!

    ------------------------------
    Justus van der Hulst
    Live Graphics Operator
    Euro Media Group
    Hilversum, The Netherlands
    ------------------------------



  • 12.  RE: Keypress in script

    Posted 03-29-2022 09:15

    I'd definetly recommend using DashBoard for what you're trying achieve here.

    This way you not only have the power of scripting behind you, but you can also create a DashBoard that really "anyone" can use with minimal training, and not having to be relying on that everyone knows your shortcuts etc.

    If you want to take this even a step further, if you decide to go for DashBoard, you can technically do calls to external sources like JSON etc and build tables of stats etc inside DashBoard and use those to create your graphics again. Even if you decide to use sources like Excel to handle the stats/info etc for players, you can then use that table, and a selector (like jersey number) in DashBoard to pull the data for that player into a graphics.

    Say you type in the jersey number 23, then that will go into the Excel sheet and fill out all the info you have on that player when the graphics goes online.
    Just an example. Hit me up if you want some clues and hints on this. Been developing this myself for the last few years for our local hockey team big screen.
    This DashBoard pulls data from external sources for stats and player info, listeners for live game clock feed, while talks to both Xpression, Graphite Mixer, Behringer X32 Audio Mixer, QLAB and through MIDI server also to our lighting board, controlling the entire venue from one panel.



    ------------------------------
    Aleksander Stalsberg
    Inland Norway University of Applied Sciences/Lillehammer Icehockey Club
    Norway
    ------------------------------



  • 13.  RE: Keypress in script

    Posted 03-29-2022 10:42
    One word! WOW!
    That looks inspiring!
    Looks like the sky is the limit..
    I have the lastest Dashboard installed right now...gonna take a dive.
    Thanks!

    ------------------------------
    Justus van der Hulst
    Live Graphics Operator
    Euro Media Group
    Hilversum, The Netherlands
    ------------------------------



  • 14.  RE: Keypress in script

    Posted 04-01-2022 05:19
    So i had a bit of time to have a quick look.
    I'm under the impression that when i want to control scene directors with buttons in dashboard, my only option is through gpi/rosstalk taking actual scenes with an id in my sequence, am i correct?

    ------------------------------
    Justus van der Hulst
    Live Graphics Operator
    Euro Media Group
    Hilversum, The Netherlands
    ------------------------------



  • 15.  RE: Keypress in script

    Posted 04-01-2022 12:17
    The easy answer: Yes. The heavy lifting is done by the script you assigned in Keyboard/GPI mapping. You can assign buttons on dashboard to take the scene on and off if you want to just use dashboard instead of going back and forth.

    ------------------------------
    Malcolm Thorpe
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 16.  RE: Keypress in script

    Posted 04-02-2022 18:54
    Ok cool, thanks.
    That makes the exploration path a bit narrower.

    ------------------------------
    Justus van der Hulst
    Live Graphics Operator
    Euro Media Group
    Hilversum, The Netherlands
    ------------------------------



  • 17.  RE: Keypress in script

    Posted 04-01-2022 13:10
    The script targets any scene that is online on a certain channel/layer and triggers scene directors by their name. So if you name your scene directors the same name in any scene with scene directors that you want to control, your buttons can be agnostic and trigger any scene that is online in those layers.


  • 18.  RE: Keypress in script

    Posted 04-01-2022 20:14

    Let me see if I understand this correctly:

    1. You use the regular Xpression API to trigger a scene online with the "Sequence In" in DashBoard.
    2. Then you would use the Keyboard/API Shortcuts in Xpression, set up with a script, and trigger specific Scene Directors in that scene with a Visual Basic script.
    3. Then use DashBoard and trigger that API script in Xpression?
    I've been thinking about a way to trigger specific Scene DIrectors from DashBoard myself. I feel like that's  one of the things missing from the XPression API in DashBoard, the ability to take a scnee online with a specific Scene Director. Not sure how that would implement combined with Transition Logic however.. But yeah, I'm missing a way to run specific scene directors from buttons.

    ------------------------------
    Aleksander Stalsberg
    Inland Norway University of Applied Sciences/Lillehammer Icehockey Club
    Norway
    ------------------------------



  • 19.  RE: Keypress in script

    Posted 04-01-2022 21:08
    Here is just a simple example of a dashboard I was working on Pre-Covid. By adding the Xpression API into my dashboard, I can run a fan game without ever touching the Xpression. In this example the green "On Line/Step through" button puts the scene online by using the API. The numbers 1 thru 10 use gpi triggers to fire animations in the game to turn the tiles over and back. The Winner button fires an animation via gpi to turn all tiles over, and display YOU WIN. Then the scene is taken off line with the "Off Line" button. All inside of the dashboard. The operator can run it, or a producer can. 


    ------------------------------
    Malcolm Thorpe
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------



  • 20.  RE: Keypress in script

    Posted 04-04-2022 05:04
    Here's a really simple example;

    dim fb as xpOutputFrameBuffer
    dim scene as xpScene
    dim dir as xpSceneDirector

    engine.GetOutputFrameBuffer(0, fb)

    if fb.GetSceneOnLayer(100, scene)
    scene.GetSceneDirectorByName("IN", dir)
    dir.PlayRange(dir.Duration, 0)
    end if

    if fb.GetSceneOnLayer(103, scene)
    scene.GetSceneDirectorByName("IN", dir)
    dir.PlayRange(0, dir.Duration)
    end if


    This script will get any scenes on layers 100 and 103 and play the "IN" scene director if it finds them. As Garner said if you keep your naming consistent this will make it easy to make buttons in Dashboard that fire a lot of different graphics.

    It just occurred to me while writing this you could probably set a range of layers for XPression to check in the script rather than specific layers like I have done. If not you could certainly write a loop to check a bunch. 


    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 21.  RE: Keypress in script

    Posted 04-04-2022 05:22
    So yesterday i had 15 minutes to spare to play around with script and it looked like i could only trigger a scene director once with a keypress..
    Does the scene director not return to the starting position after playing (even if i add a pause with reverse direction). Or can script be only be run once?
    (I havent had much time to dive deep into this, so i might have missed something).

    ------------------------------
    Justus van der Hulst
    Live Graphics Operator
    Euro Media Group
    Hilversum, The Netherlands
    ------------------------------



  • 22.  RE: Keypress in script

    Posted 04-04-2022 05:33
    You can try a couple of things, use playrange instead of just play like I have in my script above. 

    If you are just using play command I recommend using autostop which looks like; 
    dir.AutoStop = true

    XPression will often still think the scene director is playing, especially if you use a pause as you mentioned so you get conflicts.


    If you still get issues you can put this script on the scene director where you want it to stop. 

    dim dir as xpSceneDirector

    scene.GetSceneDirectorByName("directorname", dir)
    sd.Stop

    This will make sure it has stopped but autostop should be enough usually. 

    Also be aware of any transition logic you have running as if you may find you have conflicts between your different scene directors being active and essentially canceling each other out, like an IN and an OUT. 

    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 23.  RE: Keypress in script

    Posted 04-04-2022 05:42
    You can run a script as many times as you like, but the action performed depends on what you use in the script SceneDirector.Play or SceneDirector.PlayRange. Also, you have to make sure yourself that the conditions are correct: e.g. if you use SceneDirector.Play you need to make sure the cursor/play-head (or whatever you want to call it) is at the right position in the SceneDirector. Events will be fired when playing a SceneDirector from a script but, as Simon says, make sure you don't cause conflicts.

    ------------------------------
    Gerard de Vries
    Solution Architect Live Graphics & Virtual Graphics
    EMG
    The Netherlands
    ------------------------------



  • 24.  RE: Keypress in script

    Posted 04-04-2022 19:32
    So many new things to be learned....
    PlayRange, i'll give that a go!
    Thnx!

    ------------------------------
    Justus van der Hulst
    Live Graphics Operator
    Euro Media Group
    Hilversum, The Netherlands
    ------------------------------



  • 25.  RE: Keypress in script

    Posted 04-04-2022 19:31
    Ok, helpful. I already had the feeling Xpression acted funny because it 'thinks' the scene direcor is still playing..

    ------------------------------
    Justus van der Hulst
    Live Graphics Operator
    Euro Media Group
    Hilversum, The Netherlands
    ------------------------------



  • 26.  RE: Keypress in script

    Posted 04-04-2022 19:41
    I think you have been bitten by the Xpression bug. Well done. You can also have Xpression check to see where the playhead is on the scene director and either play forward or reverse. I used this with my match game. 1 click it played from 0 to 50, 1 more click, it played from 50 to 0. Flipped the tile over, paused, and then flipped it back if I wanted. Have fun, and I agree don't create problems for yourself, but troubleshooting can be fun too.

    Cheers

    ------------------------------
    Malcolm Thorpe
    Free Lance Xpression Designer/Carbonite TD
    ------------------------------