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

#1 2007-05-04 01:34:16

frankmon
Scratcher
Registered: 2007-05-04
Posts: 3

coding new blocks

1. Is it possible for me to create new blocks and add to my options.

2. Is there blocks which allow to capture an input from the keyboard, other than a single key stroke.

Offline

 

#2 2007-05-04 13:27:49

andresmh
Scratch Team at MIT
Registered: 2007-03-05
Posts: 1000+

Re: coding new blocks

Re 1. It is not easy to add new blocks. You would need to change the source code of Scratch. What kind of blocks do you want to add?

Re 2. There is no block to capture more than one character. What you can do is capture each key stroke and store the order and times in which the strokes have been captured using variables.


Andres Monroy-Hernandez | Scratch Team at the MIT Media Lab
on identi.ca and  twitter

Offline

 

#3 2007-05-06 22:35:54

frankmon
Scratcher
Registered: 2007-05-04
Posts: 3

Re: coding new blocks

A block which does what you suggest would be nice.
"What you can do is capture each key stroke and store the order and times in which the strokes have been captured using variables."

How do you set the random key pressed valu to the variable

Offline

 

#4 2007-05-06 22:42:38

frankmon
Scratcher
Registered: 2007-05-04
Posts: 3

Re: coding new blocks

Can the value of a variable be  non numeric ?

can variable values be concatenated?   data1 = 9   data2 = 2            newdata = 90

Offline

 

#5 2007-05-10 09:56:20

tammy
Scratcher
Registered: 2007-03-07
Posts: 57

Re: coding new blocks

Hi frankmon,

We currently don't have a way to handle non-numeric variables or concatenate variables, though both of those features are on our wish list.

Sometimes you can work around not being able to concatenate variables by multiplying and adding numbers as they are entered.  This calculator example concatenates numbers as the user enters them:
http://scratch.mit.edu/projects/TeenSummit2006/1946

Does that answer your question?

Thanks!

Offline

 

#6 2007-05-10 10:40:55

tammy
Scratcher
Registered: 2007-03-07
Posts: 57

Re: coding new blocks

Here's a script that concatenates the numbers 0-3 (into the "number" variable)arbitrarily based on the user input:
http://web.media.mit.edu/~tstern/concatenatingNumbers.gif

Offline

 

#7 2007-05-17 11:08:44

dmagee
Scratcher
Registered: 2007-05-17
Posts: 13

Re: coding new blocks

frankmon wrote:

2. Is there blocks which allow to capture an input from the keyboard, other than a single key stroke.

If you mean by capture that you want to see if someone pressed "a" and "b" at the same time, you could simple do a forever if loop and use the "and" block found under the numbers section, to check for key "a" pressed and key "b" pressed. That way it will only fire that loop if both a and b are pressed.

But maybe that is not what you mean.

Offline

 

Board footer