How to assign any keyboard keys to output numeric values

I have a comp that will be listening to the keyboard and specifically I’d like to be able to set it up so I can assign each key (or at least many of the keys) a predetermined fixed number that would be output when it was pressed… For example I see that for the keys which happen to actually be numbers in terms of typing it’s possible to use a “Receive Keyboard Typing” node and take the Typed Character out into a “Convert Text to Real” node and this allows for having zero through 9 each assigned to a specific key on the keyboard (and that all works), but I want to be able to hit any key and have it output any number I may specify ahead of time (for example how would I make the Q, W, E keys output the numbers 11, 12, and 13)… What would be a good way to do this in Vuo ? I guess besides the Keyboard Typing node I have the “Receive Keyboard Buttons” node to start with but where would I go with that ? Thanks very much in advance for any suggestions.

You can use Select Latest to convert the events from Receive Keyboard Buttons into integers (or whatever kind of data you want). Like this:


KeyToNumber.vuo (3.36 KB)

thanks for the quick reply - after posting the question I had worked out something similar, but your answer uses one less layer of nodes and teaches me something about how this stuff works - so thanks again