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

#1 2012-05-09 04:48:07

Sherlockhomers
New Scratcher
Registered: 2012-04-04
Posts: 1

a new script block "once"

ever made a game and felt there is nothing that will make the whole script work only once well possibly we should get a once block im new to this and well its really anoying not having a once block

Offline

 

#2 2012-05-09 04:56:18

trinary
Scratcher
Registered: 2012-01-29
Posts: 1000+

Re: a new script block "once"

Just remove any loop blocks from around your scripts.


http://trinary.tk/images/signature_.php

Offline

 

#3 2012-05-09 10:12:00

iTweak0r
Scratcher
Registered: 2011-07-30
Posts: 100+

Re: a new script block "once"

trinary wrote:

Just remove any loop blocks from around your scripts.

No he means something like this:

Make it so when the space is pressed, move 100 steps, and don't do anything when you press space again.


Make it in Scratch! because it's cooler when it's made in scratch
http://i.imgur.com/D4iqPHR.png

Offline

 

#4 2012-05-09 11:27:47

benjamin2
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: a new script block "once"

iTweak0r wrote:

trinary wrote:

Just remove any loop blocks from around your scripts.

No he means something like this:

Make it so when the space is pressed, move 100 steps, and don't do anything when you press space again.

Here would be a solution:

The bad script:

when (space) key pressed
move (100) steps
The good script:
when gf clicked
wait until <key [space v] pressed>
move (100) steps
Note: In the first diagram, space is not a variable. In the second diagram, the key space pressed is a sensing block.


http://i.imgur.com/gp6tZ.gif

Offline

 

#5 2012-05-09 14:10:32

joefarebrother
Scratcher
Registered: 2011-04-08
Posts: 1000+

Re: a new script block "once"

benjamin2 wrote:

iTweak0r wrote:

trinary wrote:

Just remove any loop blocks from around your scripts.

No he means something like this:

Make it so when the space is pressed, move 100 steps, and don't do anything when you press space again.

Here would be a solution:

The bad script:

when [space v] key pressed
move (100) steps
The good script:
when gf clicked
wait until <key [space v] pressed?>
move (100) steps
Note: In the first diagram, space is not a variable. In the second diagram, the key space pressed is a sensing block.

Scripts fixed


My latest project is called http://tinyurl.com/d2m8hne! It has http://tinyurl.com/d395ygk views, http://tinyurl.com/cnasmt7 love-its, and http://tinyurl.com/bwjy8xs comments.
http://tinyurl.com/756anbk   http://tinyurl.com/iplaychess

Offline

 

#6 2012-05-09 15:04:57

benjamin2
Scratcher
Registered: 2008-10-18
Posts: 1000+

Re: a new script block "once"

Sherlockhomers wrote:

ever made a game and felt there is nothing that will make the whole script work only once well possibly we should get a once block im new to this and well its really anoying not having a once block

Use a repeat 1 block


http://i.imgur.com/gp6tZ.gif

Offline

 

Board footer