Making a "Voice Command" menu using Derma(AKA Help with PlayerBindPress)

Okay, so I don’t need help with the Derma menu coding, but I need help with PlayerBindPress. I want to make it so that if the player presses Z then the voice command menu opens, and if the menu is already open and the player presses Z then the menu closes. Also, how would I make the player do DoClick functions when they press any of the number keys? Any help is appreciated.

Just use

GM/PlayerButtonDown instead of PlayerBindPress. When a player presses a button, it will pass one of the KEY_, MOUSE_, or JOYSTICK_ enumerations to the hook for you to use. You’d obviously want to check if the player pressed KEY_Z for this.

To execute a function when a key is pressed within a panel, you can use

PANEL/OnKeyCodePressed. Again, these will use the KEY_ enums, so you can check for each of the number keys (I’d recommend using a table of the proper enumerations over an elseif stack).