How to store the pressed key into a variable

Is there a way to store the pressed key into a variable, without using the block on every key?

Oh wait never mind. I just found a way around it.
But if anyone knows the answer, I'd still like to know it, thanks!

Can you post your workaround so we can see if its different from other possible solutions?

with 7.0 you can
when [any key v] key pressed ((key) :: control ) :: control hat
set [global key v] to (key)
define-reporter (key pressed :: custom) :: custom hat
if <key [any v] pressed?> then
report (global key pressed) :: control cap
report [] :: control cap

here's a method for the current version of snap.

you can also add more keys if you want.

here's the block so you don't have to copy all the text yourself Snap! 6.9.2 Build Your Own Blocks


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.