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

#1 2008-06-28 13:45:07

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

how do you discriminate among which key is pressed?

Using the "when __ key pressed" hat one can start different scripts when different keys are pressed. If you want to check for all alphabetic keys, is there a shorter way than having 26 scripts?

Offline

 

#2 2008-06-28 14:25:45

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: how do you discriminate among which key is pressed?

s_federici wrote:

Using the "when __ key pressed" hat one can start different scripts when different keys are pressed. If you want to check for all alphabetic keys, is there a shorter way than having 26 scripts?

ssadly, in today's Scratch, no.

Offline

 

#3 2008-06-28 15:20:19

bigB
Scratcher
Registered: 2007-06-09
Posts: 100+

Re: how do you discriminate among which key is pressed?

forever
if key (A) pressed or key (B) pressed or key . . .

Last edited by bigB (2008-06-28 15:20:33)


http://scratch.mit.edu/projects/bigB/260981 Draw to Text
http://scratch.mit.edu/projects/bigB/181829 3D Stunt Flyer

Offline

 

#4 2008-06-28 15:30:33

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

Re: how do you discriminate among which key is pressed?

That's fine. But then, if you have to discriminate among all 26 keys then you need further 26 "if" conditions. Is this correct?

Last edited by s_federici (2008-06-28 15:30:56)

Offline

 

#5 2008-06-28 15:33:07

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: how do you discriminate among which key is pressed?

s_federici wrote:

That's fine. But then, if you have to discriminate among all 26 keys then you need further 26 "if" conditions. Is this correct?

Spot on. It would be cool if someone could find a way, but you can't…


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#6 2008-06-28 19:49:34

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: how do you discriminate among which key is pressed?

Unfortunately.....I wish that were possible!!!!!!!!!!!!!


All your base are belong to us

Offline

 

#7 2008-06-29 03:52:37

bigB
Scratcher
Registered: 2007-06-09
Posts: 100+

Re: how do you discriminate among which key is pressed?

is this for any particular project?


http://scratch.mit.edu/projects/bigB/260981 Draw to Text
http://scratch.mit.edu/projects/bigB/181829 3D Stunt Flyer

Offline

 

#8 2008-06-29 03:54:39

s_federici
Scratcher
Registered: 2007-12-18
Posts: 500+

Re: how do you discriminate among which key is pressed?

Yes, this is for projects that involve teaching letter/words to children.

Offline

 

#9 2008-06-29 04:51:19

deatheater
Scratcher
Registered: 2008-04-11
Posts: 1000+

Re: how do you discriminate among which key is pressed?

what about

<if><<  <not> << <key[ b ]pressed?> <or> << <key[ d ]pressed?> <or> <key[ a ]pressed?> >> >>

that way you categorise it to a certain amount of the letters, the example is "bad" so if you press a key other than b, a or d it tells if ur wrong  smile

Last edited by deatheater (2008-06-29 04:52:28)

Offline

 

Board footer