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

#1 2011-10-12 21:17:15

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Is there an equivalent of |wait () secs| for Squeak?

^ title ^

Offline

 

#2 2011-10-13 09:09:07

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

Re: Is there an equivalent of |wait () secs| for Squeak?

obviously, how else was the wait () secs block made?


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

 

#3 2011-10-13 11:46:15

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Is there an equivalent of |wait () secs| for Squeak?

There certainly is a sleep function. I never googled it, but you might as well do.

In case you find nothing, you can always use steps.

Offline

 

#4 2011-10-13 16:42:12

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Is there an equivalent of |wait () secs| for Squeak?

joefarebrother wrote:

obviously, how else was the wait () secs block made?

I know, but that's because it's a timer block (#t).  Other timer blocks include play note for ( ) secs and play drum for ( ) secs.  When these blocks are used in Squeak, they work for their full value, but don't wait for the next commands (at least in experience).  For example, playing a note for 2 beats and then returning something will play that note for 2 beats, but will immediately return the value without waiting for the note to finish.   hmm

Offline

 

#5 2011-10-13 17:16:23

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Is there an equivalent of |wait () secs| for Squeak?

LS97 wrote:

There certainly is a sleep function. I never googled it, but you might as well do.

In case you find nothing, you can always use steps.

I found a delay thing, used by the syntax

Code:

 (Delay forSeconds: NUMBER) wait

but it delays everything, and I was hoping for something that would only delay the method that runs it...

Offline

 

#6 2011-10-13 17:37:43

rubiks_cube_guy238
Scratcher
Registered: 2009-07-02
Posts: 100+

Re: Is there an equivalent of |wait () secs| for Squeak?

I would make a variable for the current time (in milliseconds) and run a loop until the time - the variable is the desired time. There's a way to do this so the loop doesn't make it crash, but I forget what it is.


The glass is never half full nor half empty; it is twice as large as it needs to be.

Offline

 

#7 2011-10-16 20:11:11

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Is there an equivalent of |wait () secs| for Squeak?

rubiks_cube_guy238 wrote:

I would make a variable for the current time (in milliseconds) and run a loop until the time - the variable is the desired time. There's a way to do this so the loop doesn't make it crash, but I forget what it is.

How would the loop make it crash?  (That's a really good idea, using the time as a timer...)

Offline

 

#8 2011-10-17 01:49:18

roijac
Scratcher
Registered: 2010-01-19
Posts: 1000+

Re: Is there an equivalent of |wait () secs| for Squeak?

Greenatic wrote:

LS97 wrote:

There certainly is a sleep function. I never googled it, but you might as well do.

In case you find nothing, you can always use steps.

I found a delay thing, used by the syntax

Code:

 (Delay forSeconds: NUMBER) wait

but it delays everything, and I was hoping for something that would only delay the method that runs it...

i THINK you have to go deep inside the execution engine to do that...  sad

Offline

 

#9 2011-10-17 11:33:41

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Is there an equivalent of |wait () secs| for Squeak?

Greenatic wrote:

LS97 wrote:

There certainly is a sleep function. I never googled it, but you might as well do.

In case you find nothing, you can always use steps.

I found a delay thing, used by the syntax

Code:

 (Delay forSeconds: NUMBER) wait

but it delays everything, and I was hoping for something that would only delay the method that runs it...

Use steps then. You know what that is right?
"stepTime" and "step:" methods?

Offline

 

#10 2011-10-17 21:13:34

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Is there an equivalent of |wait () secs| for Squeak?

LS97 wrote:

Greenatic wrote:

LS97 wrote:

There certainly is a sleep function. I never googled it, but you might as well do.

In case you find nothing, you can always use steps.

I found a delay thing, used by the syntax

Code:

 (Delay forSeconds: NUMBER) wait

but it delays everything, and I was hoping for something that would only delay the method that runs it...

Use steps then. You know what that is right?
"stepTime" and "step:" methods?

No, I don't...could you please explain?

Offline

 

#11 2011-10-21 20:44:57

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Is there an equivalent of |wait () secs| for Squeak?

Greenatic wrote:

LS97 wrote:

Greenatic wrote:


I found a delay thing, used by the syntax

Code:

 (Delay forSeconds: NUMBER) wait

but it delays everything, and I was hoping for something that would only delay the method that runs it...

Use steps then. You know what that is right?
"stepTime" and "step:" methods?

No, I don't...could you please explain?

^ last post ^

bump

Offline

 

Board footer