ZBrushCentral

Zscript question: Reading a key press

When a script is started and in a loop, how would I read a keyboard key press, such as ‘x’?

I’ve tried using IKeyPress (even with the ASCII #), but it doesn’t seem to work.

I’d like a specific action to occure when that key is pressed. I’ve tried embedding it within an IF statement, but that didn’t work either.

I’m pretty sure I don’t understand that command correctly.

Any help is always appreciated!

The IKeyPress command simulates pressing a key, but that’s different from reading whether the user is pressing one.

The only thing that I can think of for what you’re trying to do is to make a special button with a shortcut key assigned to it. When someone presses the shortcut key (such as ‘X’), the script runs the commands specified for the button.

If you don’t want the button to be visible, you can even bury it far enough down the ZScript page to be out of sight.

Maybe Davey or Digits will have a better solution.

yes, this isn’t about creating a hot key for a button, but having a key read after the button is pressed and the script is in a loop.

Hi, Ken.

ZScripts were designed to “lock out” key presses – how embarassing would it be if a ZScript ended, and suddenly all your keystrokes were pressed when you didn’t expect them to?

Here is one way I’ve come up with – I’d love it if someone found another way :wink:


When you display a Message, the VIEW KEYBOARD STATUS slider updates with the current keystroke. The user must press OK with the mouse button; if he/she presses the Enter key to banish the Message, then Enter will be the last key pressed.

dave