Keyboard input


Is it possible to trigger events using keyboard inputs during simulation?
For example, during simulation on my PC, pressing 'z' causes a certain event/animation to trigger, and pressing 'y' will trigger something else to trigger?

Currently, I only see gre.keydown, gre.keyrepeat, gre.keyup, but I'd like to use alphanumeric keys.




  • Official comment

    Hi Jamie,

    this is an interesting requirement and I can see it being useful for many applications.

    I will raise an enhancement request for a future Storyboard release to add a couple of filter arguments to the event trigger to filter on the key code and optionally the modifier? Only if the key code filters match will that event trigger that associated action.

    You could then add multiple triggers and actions for different key combinations such as for numeric menu choices.




  • Hello,

    The key events for keydown, keyup and key repeat return the UTF-8 key code as well as a modifier for key combinations:

    You can access these parameters in Lua by inspecting the mapargs.event_data and conditionally handle the key codes. If you are using Linux then it does not have a concept of the keyrepeat event in the OS so instead you will get multiple keypresses.

    I put together a simple test app for you with this behaviour which sends a simple custom event (to self) when either the Z or Y keys are pressed. You can then daisy chain other actions from these triggers such as running an animation on Z and changing the background screen fill colour to yellow on Y with a data change.

    You can test the application below.

    Let us know if this answers your question. Let us know.


  • but link file is not work >> pls new link work


Please sign in to leave a comment.

Didn't find what you were looking for?

New post