Discuss Scratch
- Discussion Forums
 - » Suggestions
 - » Key pressed reporter block
        
         
- Thepuzzlegame
 - 
                            
						
						
                            Scratcher
                        
						
						 
1000+ posts
Key pressed reporter block
I think there should be a reporter block which reports the name of the key being pressed. This would be incredibly useful and although it is workaroundable the workaround is extremely large and inconvenient and the whole point of scratch is to be simple and easy to use. Some uses of this block can be seen below:
                        
                            add [a] to [keys v]
add [b] to [keys v]
add [c] to [keys v]
add [d] to [keys v]
add [e] to [keys v]
...
if <[keys v] contains (key pressed::sensing)> then
say [You pressed a key!] for (2) secs
end
say [Press a key!]
wait until <[keys v] contains (key pressed::sensing)>
say (join (join [You pressed the] (key pressed::sensing)) [key!]) for (2) secs
go to x: (-220) y: (160)
forever
if <[keys v] contains (key pressed::sensing)> then
if <(x position)> [220]> then
change y by (-10)
set x to (-220)
else
change x by (6)
end
switch costume to (key pressed::sensing)
stamp
end
end
Last edited by Thepuzzlegame (July 21, 2014 21:51:08)
- Iditaroid
 - 
                            
						
						
                            Scratcher
                        
						
						 
500+ posts
Key pressed reporter block
What you're thinking of isn't a boolean, but a reporter.
                        
                        
                    - Thepuzzlegame
 - 
                            
						
						
                            Scratcher
                        
						
						 
1000+ posts
Key pressed reporter block
What you're thinking of isn't a boolean, but a reporter.Thanks for the heads up! Changed the title of the post

- Iditaroid
 - 
                            
						
						
                            Scratcher
                        
						
						 
500+ posts
Key pressed reporter block
What you're thinking of isn't a boolean, but a reporter.Thanks for the heads up! Changed the title of the post

- mathfreak231
 - 
                            
						
						
                            Scratcher
                        
						
						 
1000+ posts
Key pressed reporter block
The one problem with this block is this: What if more than one key was being pressed?
I would support otherwise. Also, I know this has been suggested before, I'm just too lazy to find the link.
                        
                        
                    I would support otherwise. Also, I know this has been suggested before, I'm just too lazy to find the link.
- Thepuzzlegame
 - 
                            
						
						
                            Scratcher
                        
						
						 
1000+ posts
Key pressed reporter block
The one problem with this block is this: What if more than one key was being pressed?I think the reporter should only report the last key being pressed
I would support otherwise. Also, I know this has been suggested before, I'm just too lazy to find the link.
- stickfiregames
 - 
                            
						
						
                            Scratcher
                        
						
						 
1000+ posts
Key pressed reporter block
How would it report non-printing keys like enter or backspace? Because they have different names in different languages.
                        
                            Last edited by stickfiregames (July 25, 2014 11:24:55)
- robosnakejr
 - 
                            
						
						
                            Scratcher
                        
						
						 
1000+ posts
Key pressed reporter block
How would it report non-printing keys like enter or backspace? Because they have different names in different languages.scratch doesn't (and never will) use those keys.
also, support.
- stickfiregames
 - 
                            
						
						
                            Scratcher
                        
						
						 
1000+ posts
Key pressed reporter block
It already does use arrow keys. They have names and do not print.How would it report non-printing keys like enter or backspace? Because they have different names in different languages.scratch doesn't (and never will) use those keys.
also, support.
- robosnakejr
 - 
                            
						
						
                            Scratcher
                        
						
						 
1000+ posts
Key pressed reporter block
upIt already does use arrow keys. They have names and do not print.How would it report non-printing keys like enter or backspace? Because they have different names in different languages.scratch doesn't (and never will) use those keys.
also, support.
down
left
right
- derpmeup
 - 
                            
						
						
                            Scratcher
                        
						
						 
1000+ posts
Key pressed reporter block
It's possible to put those into the key pressed block, though. Griffpatch made an example of that. ;)How would it report non-printing keys like enter or backspace? Because they have different names in different languages.scratch doesn't (and never will) use those keys.
also, support.
- TheMasterKing107
 - 
                            
						
						
                            Scratcher
                        
						
						 
36 posts
Key pressed reporter block
Huge support. If two keys were being pressed at once, I believe it would record the last one. And if you actually needed more than 1 key at once, like a caps lock system, do the following:
                        
                            When [InsertKeyThatTriggersCapLockHere v] pressed::hat control
if <(caps lock) = [on]
set [caps lock v] to [off]
else
set [caps lock v] to [on]
end
if <(caps lock) = [on]
add (<key pressed::sensing>+(LeghtOfAlphabet) ) to [output v]
else
add (key pressed::sensing) to [output v]
end
//or this is another way to deal with two keys at once, the old way
if <<[up v] key pressed::sensing> and <[down v] key pressed::sensing
...
Last edited by TheMasterKing107 (Sept. 8, 2015 00:47:56)
- DaSpudLord
 - 
                            
						
						
                            Scratcher
                        
						
						 
1000+ posts
Key pressed reporter block
The one problem with this block is this: What if more than one key was being pressed?Everything I was going to say… and someone beat me to it.
I would support otherwise. Also, I know this has been suggested before, I'm just too lazy to find the link.
Anyway, semi-support.
Last edited by DaSpudLord (Sept. 8, 2015 00:41:55)
- IronBit_Studios
 - 
                            
						
						
                            Scratcher
                        
						
						 
1000+ posts
Key pressed reporter block
What about languages?upIt already does use arrow keys. They have names and do not print.How would it report non-printing keys like enter or backspace? Because they have different names in different languages.scratch doesn't (and never will) use those keys.
also, support.
down
left
right
Semi Support.
- Discussion Forums
 - » Suggestions
 - 
            » Key pressed reporter block 
         














