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

#1 2010-12-18 12:38:48

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Commands and their uses

This was made in response to a question.  I"m going to outline each of the commands, and in some cases, their common uses.

<when green flag clicked>

will activate any script below it when the flag is pressed.  This is the most commonly used command

<when[  ]key pressed>

activates any script beneath it when a certain key is pressed.  This key is less useful than it sounds.  Generally used for movement by beginners, there are much smoother ways to move around.  Look at the FOREVER below for the most common method of movement

<if>
<end>

is a block that is essential to almost every project.  Basically, you put <(  <<>  )><(  <>>  )> or <(  <=>  )> in it, and place variables, numbers, or both on either side.  If the condition is true, the script below it will be activated.

<if>
<else>

Very similar to the "if" block.  If the condition is true, the script between the IF and ELSE will be activated, if the condition is false, the script between the ELSE and the end of the block will be activated instead

<when[KEY]clicked>

Will activate the script below it when the sprite is clicked by the mouse

<wait( )secsc>

pauses the script it is attached to for however many seconds you want

<repeat(
<end>

repeats the script between the REPEAT and the end of the block as many times as specified; then moves on to the script after it

<broadcast[
<broadcast[  ]and wait c>
<when I receive[ ]>

Broadcasting is a way to activate a script with another script, even if it is in another sprite.  The normal Broadcast command will activate any script below the "WHEN I RECEIVE (_)" command, and then continue on with script beneath it.  The BROADCAST AND WAIT command will activate the script beneath the "WHEN I RECEIVE (_)" command, just like the normal one, but will wait for the script beneath the "WHEN I RECEIVE (_)" command to finish, before activating the script below it.  Wow, I hope you understood that.


<forever>

is like the Repeat() block, but will activate its script forever.  When a scratcher wants a sprite to move smoothly, the most common way to do it is with this script:

<when green flag clicked>
<forever>
<if> <key[Up Arrow]pressed?>
<change y by( 3
<end>

<wait until>

similar to wait () secs; this will pause the script until the condition you put in it is true

<repeat until>
<end>

The opposite of the <forever if> loop (which is nothing more than a FOREVER block and an IF block combine).  This will repeat the script in it as long as the condition returns false, when it returns true, the script stops

<stop all>

Stops every script in the entire project

<stop script>

Stops whatever script it is attached to

Last edited by MoreGamesNow (2010-12-18 12:41:07)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#2 2010-12-18 16:51:12

imnotbob
Scratcher
Registered: 2010-12-11
Posts: 1000+

Re: Commands and their uses

thnx so much!


PesterChum Handle: annoyingAnchorman
durp yo terezi sup sup gotta beat john gotta beat john

Offline

 

#3 2010-12-18 16:53:19

MiffinTheMuffin
Scratcher
Registered: 2010-12-11
Posts: 1000+

Re: Commands and their uses

Very helpful (Even though I've been on scratch for 9 and a half months )


http://i.imgur.com/FDvbV.png

Offline

 

#4 2010-12-19 09:25:27

werdna123
Scratcher
Registered: 2010-06-12
Posts: 1000+

Re: Commands and their uses

Great guide, one tiny thing: You can put more than just >,<, and = in a <  > bit.

Offline

 

Board footer