This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-02-20 02:01:59

Bombguy2010
New Scratcher
Registered: 2013-02-08
Posts: 17

3 or more buttons pressed?

Can scratch only handle 2 buttons pressed?
When i try

if
'a' and 'b' and 'c'  pressed it doesn't work

Offline

 

#2 2013-02-20 08:11:15

shadowmouse
New Scratcher
Registered: 2013-02-03
Posts: 100+

Re: 3 or more buttons pressed?

I've had this problem as well. I had a game with arrow key movement and space key to activate a function. But if up, left and space were pressed then it didn't work. However it did work for other combinations.

Offline

 

#3 2013-02-20 14:43:04

piguillaud
Scratcher
Registered: 2010-06-19
Posts: 100+

Re: 3 or more buttons pressed?

It doesnt indeed work. You might want to do 3 ifs.
if 'a' is pressed then
    if "b" is pressed then
       if "c" is pressed then

Offline

 

#4 2013-02-20 15:06:02

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: 3 or more buttons pressed?

 when gf clicked
if < <key [a v] pressed>>
if <<key [b v] pressed>>
if <<key [c v] pressed>>
 
That should work.  smile

Regards,

CAA14

Offline

 

#5 2013-02-20 15:40:16

piguillaud
Scratcher
Registered: 2010-06-19
Posts: 100+

Re: 3 or more buttons pressed?

ill have to figure out some day how to use scratchblocks

Offline

 

#6 2013-02-20 20:55:32

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: 3 or more buttons pressed?

CAA14 wrote:

 when gf clicked
if (key [a v] pressed?)
 if (key [b v] pressed?)
  if (key [c v] pressed?)
  end
 end
end
That should work.  smile

Regards,

CAA14

Fixed. There were three mistakes:

1). You forgot a ? at the end of the conditionals, or in other words, the (key [a v] pressed?)'s.

2). You had an extra pair of <>'s around the conditionals.

3). You forgot to put "end" where you wanted the if blocks to end.


http://i46.tinypic.com/35ismmc.png

Offline

 

#7 2013-02-20 20:58:19

CAA14
Scratcher
Registered: 2013-01-14
Posts: 1000+

Re: 3 or more buttons pressed?

Thanks Erinie.  smile

It just comes with practice and reading the guide, piguillaud.  smile

As you can see, I am not yet good at them.

Regards,

CAA14

Offline

 

Board footer