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

#1 2012-06-15 12:10:52

berberberber
Scratcher
Registered: 2012-03-08
Posts: 1000+

A for ( ) secs block

OK, so it would look like this:

<<> for (1) secs>
So, you could do this:
if <<touching [sprite1 v]?> for (1) secs?>
 say [I got you!] for (2) secs
end
Or:
if <<touching color [#ff0000]?> for (1) secs?>
 play sound [burn v] until done
end


http://i47.tinypic.com/2iaa73k.png

Offline

 

#2 2012-06-15 12:20:44

777w
Scratcher
Registered: 2009-02-10
Posts: 1000+

Re: A for ( ) secs block

you can do it like this
http://img594.imageshack.us/img594/1639/helpq.gif

Offline

 

#3 2012-06-15 12:59:36

berberberber
Scratcher
Registered: 2012-03-08
Posts: 1000+

Re: A for ( ) secs block

No, but yours has a delay.  Mine simply checks.


http://i47.tinypic.com/2iaa73k.png

Offline

 

#4 2012-06-15 15:09:02

777w
Scratcher
Registered: 2009-02-10
Posts: 1000+

Re: A for ( ) secs block

berberberber wrote:

No, but yours has a delay.  Mine simply checks.

what do you mean by delay? if the conditions are met by the end of the second, the scripts are initiated just like your block

Last edited by 777w (2012-06-15 15:11:07)

Offline

 

#5 2012-06-15 16:31:38

berberberber
Scratcher
Registered: 2012-03-08
Posts: 1000+

Re: A for ( ) secs block

Mine has to be true the whole time.  Yours could be true false true and still work.


http://i47.tinypic.com/2iaa73k.png

Offline

 

#6 2012-06-15 16:37:50

777w
Scratcher
Registered: 2009-02-10
Posts: 1000+

Re: A for ( ) secs block

berberberber wrote:

Mine has to be true the whole time.  Yours could be true false true and still work.

hmm

Offline

 

#7 2012-06-15 16:50:48

ImagineIt
Scratcher
Registered: 2011-02-28
Posts: 1000+

Re: A for ( ) secs block

This would be good. But I have a workaround that doesn't let you have true false true.

http://i46.tinypic.com/2nls9w4.png

Offline

 

#8 2012-06-15 18:53:14

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Re: A for ( ) secs block

This is an interesting idea, but it would be hard to program.
Also, what if the time passed while it was still executing the blocks? Would it stop right there or finish the loop?


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#9 2012-06-15 21:21:19

berberberber
Scratcher
Registered: 2012-03-08
Posts: 1000+

Re: A for ( ) secs block

finish.


http://i47.tinypic.com/2iaa73k.png

Offline

 

#10 2012-06-15 22:03:52

Wes64
Scratcher
Registered: 2011-08-19
Posts: 1000+

Re: A for ( ) secs block

Can you give an example script with this block that has no workarounds?


Experienced 2.0 Tester: Ask me questions!
Using Firefox 13.0, Flash plugin version 11.4.402.287, and Windows XP Professional.

Offline

 

#11 2012-06-20 14:22:02

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

Re: A for ( ) secs block

set [condition v] to [1]
repeat until <<(timer) > [1]> or <(condition) = [0]>>
  set [condition v] to <<(condition) = [1]> and <touching [sprite v]?>>
end

Last edited by MathWizz (2012-06-20 14:23:25)


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

Offline

 

#12 2012-06-22 00:33:53

samtwheels
Scratcher
Registered: 2011-03-20
Posts: 1000+

Re: A for ( ) secs block

MathWizz wrote:

set [condition v] to [1]
repeat until <<(timer) > [1]> or <(condition) = [0]>>
  set [condition v] to <<(condition) = [1]> and <touching [sprite v]?>>
end

you need a reset timer block.

Offline

 

Board footer