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

#1 2010-02-14 12:25:20

ruehlm74
Scratcher
Registered: 2008-12-02
Posts: 3

How to make typed in commands?

I am making a project where you type in a certain code word, and then something happens. How do I do this?

Offline

 

#2 2010-02-14 12:28:30

ruehlm74
Scratcher
Registered: 2008-12-02
Posts: 3

Re: How to make typed in commands?

hello?

Offline

 

#3 2010-02-14 17:43:03

16Skittles
Scratcher
Registered: 2009-08-26
Posts: 1000+

Re: How to make typed in commands?

1st of all, don't think that nobody will answer after only 3 minutes. but here is an answer. you need this script.
[blocks]
<when green flag clicked>
ask codeword
<if><( answer <=> (whatever the command is) )>
<broadcast[ command
<end>[/blocks]

the ask block is located in the sensing category. the scratch team must not have updated the forum blocks.

Last edited by 16Skittles (2010-02-14 17:44:01)


http://16skittles.tk/sig.png
Are you a student? Check out OnSchedule!

Offline

 

#4 2010-02-14 21:50:55

billyedward
Scratcher
Registered: 2008-01-03
Posts: 500+

Re: How to make typed in commands?

If you want to make it so that the user types in a secret word, then you have to have a hat for the first letter. Following this, numerous if blocks for the keys following. For instance, if the word is 'phi,' then use this:
<when[ p ]key pressed>
<wait until><key[ any ]pressed?>
<if><key[ h ]pressed?>
|<wait until><key[ any ]pressed?>
|<if><key[ i ]pressed?>
||Code to execute if the word is entered.
|<end>
<end>


"I'd love to change the world, but they haven't released the source code yet."
Check out the latest version of Streak --> http://billy.scienceontheweb.net/Streak

Offline

 

#5 2010-02-15 13:08:24

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: How to make typed in commands?

billyedward wrote:

If you want to make it so that the user types in a secret word, then you have to have a hat for the first letter. Following this, numerous if blocks for the keys following. For instance, if the word is 'phi,' then use this:
<when[ p ]key pressed>
<wait until><key[ any ]pressed?>
<if><key[ h ]pressed?>
|<wait until><key[ any ]pressed?>
|<if><key[ i ]pressed?>
||Code to execute if the word is entered.
|<end>
<end>

Scratch does not have <key[ any ]pressed?>.


http://block.site90.net/scratch.mit/text.php?size=30&amp;text=%20A%20signature!&amp;color=333333

Offline

 

#6 2010-02-15 13:58:15

juststickman
Scratcher
Registered: 2009-05-31
Posts: 1000+

Re: How to make typed in commands?

MathWizz wrote:

billyedward wrote:

If you want to make it so that the user types in a secret word, then you have to have a hat for the first letter. Following this, numerous if blocks for the keys following. For instance, if the word is 'phi,' then use this:
<when[ p ]key pressed>
<wait until><key[ any ]pressed?>
<if><key[ h ]pressed?>
|<wait until><key[ any ]pressed?>
|<if><key[ i ]pressed?>
||Code to execute if the word is entered.
|<end>
<end>

Scratch does not have <key[ any ]pressed?>.

Nope, you have to use a bunch of <<  <or>  >>  blocks.


http://is.gd/iBQi2 Add grob to your sig and help with world dominiation!http://is.gd/iBQ9Q                                                             Hey guys, we're seriously naming our team bob?

Offline

 

#7 2010-02-17 06:50:30

EmperorEvil
Scratcher
Registered: 2009-02-13
Posts: 1000+

Re: How to make typed in commands?

Ok. My script will do you well. :
<when green flag clicked>
<forever>
<play sound[ pop]
<end>
Try it out.


http://oi54.tinypic.com/t8ogle.jpg http://blocks.scratchr.org/API.php?user=veggieman001&amp;action=onlineStatus

Offline

 

#8 2010-02-17 06:54:23

EmperorEvil
Scratcher
Registered: 2009-02-13
Posts: 1000+

Re: How to make typed in commands?

My real script, Here it goes. Say the password is duck.
<when green flag clicked>
<wait until><key[d]pressed?>
<wait(.001 )secsc>
<wait until><key[u]pressed?>
<wait(.001 )secsc>
<wait until><key[c]pressed?>
<wait(.001 )secsc>
<wait until><key[k]pressed?>
<wait(.001 )secsc>

Try it out. Works for me.


http://oi54.tinypic.com/t8ogle.jpg http://blocks.scratchr.org/API.php?user=veggieman001&amp;action=onlineStatus

Offline

 

#9 2010-02-18 01:34:22

billyedward
Scratcher
Registered: 2008-01-03
Posts: 500+

Re: How to make typed in commands?

juststickman wrote:

MathWizz wrote:

billyedward wrote:

If you want to make it so that the user types in a secret word, then you have to have a hat for the first letter. Following this, numerous if blocks for the keys following. For instance, if the word is 'phi,' then use this:
<when[ p ]key pressed>
<wait until><key[ any ]pressed?>
<if><key[ h ]pressed?>
|<wait until><key[ any ]pressed?>
|<if><key[ i ]pressed?>
||Code to execute if the word is entered.
|<end>
<end>

Scratch does not have <key[ any ]pressed?>.

Nope, you have to use a bunch of <<  <or>  >>  blocks.

Yes, I was doing that to be lazy. You can also use an any option in Streak, though.


"I'd love to change the world, but they haven't released the source code yet."
Check out the latest version of Streak --> http://billy.scienceontheweb.net/Streak

Offline

 

#10 2010-02-18 05:28:13

Stickman704
Scratcher
Registered: 2009-01-31
Posts: 1000+

Re: How to make typed in commands?

Lol don't tease the new person.
Use the ask question block.

When green flag clicked
Ask question (whatever you want to ask))
Forever if (<answer = Whatever your answer is>
Do whatever you want to do

Last edited by Stickman704 (2010-02-18 05:48:25)


Dun dun dun dun dun dun.... dun dun dun dun dun dun...  tongue

Offline

 

#11 2010-02-18 05:46:17

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: How to make typed in commands?

You could just use the ask block...  hmm


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

Board footer