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

#1 2010-10-28 18:46:55

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

1 Script 1 Sprite Wait Until?

How can I make a sort of "wait until" without using the wait until block? I'm not going to use the wait until block because I don't want the entire script to stop while one section is waiting.


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#2 2010-10-28 20:55:50

12three
Scratcher
Registered: 2008-06-12
Posts: 1000+

Re: 1 Script 1 Sprite Wait Until?

It depends on what you're trying to do... could you maybe upload it so I could see?

Offline

 

#3 2010-10-29 10:54:27

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: 1 Script 1 Sprite Wait Until?

One script in Scratch is equivalent to one thread. Only one block from that script can be executing at a time, so it is therefore impossible to have part of a script wait while other parts execute!


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#4 2010-10-29 11:41:08

laser100
Scratcher
Registered: 2009-12-04
Posts: 100+

Re: 1 Script 1 Sprite Wait Until?

it is possible. use a variable. if the variable is 1, have that part of te script stop using the if else block.

hope that helps  big_smile

Offline

 

#5 2010-10-29 14:05:49

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

Re: 1 Script 1 Sprite Wait Until?

Use timer, reset it and check if it's more than something.


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

 

#6 2010-10-29 15:21:25

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: 1 Script 1 Sprite Wait Until?

fullmoon wrote:

One script in Scratch is equivalent to one thread. Only one block from that script can be executing at a time, so it is therefore impossible to have part of a script wait while other parts execute!

I mean more of an "if inside an if". Unfortunately, the "if's" I need are opposites- if mouse clicked, and then if mouse not clicked inside that. Tried it, and it didn't work.


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#7 2010-10-29 16:03:51

fullmoon
Retired Community Moderator
Registered: 2007-06-04
Posts: 1000+

Re: 1 Script 1 Sprite Wait Until?

Sunrise-Moon wrote:

^

So you're waiting for a condition to happen but you want it to continue executing something until it does happen:

Code:

...
loop_check = 0
repeat until <loop_check = 1>:
  //Do some other stuff here
  if <condition to check>:
    loop_check = 1
loop_check = 0
//Continue doing some other stuff...

This would work well if you replaced <condition to check> with <mouse down?> or something.


http://i302.photobucket.com/albums/nn100/fullmoon32/wow.jpg

Offline

 

#8 2010-10-29 17:26:33

Sunrise-Moon
Scratcher
Registered: 2009-06-27
Posts: 1000+

Re: 1 Script 1 Sprite Wait Until?

fullmoon wrote:

Sunrise-Moon wrote:

^

So you're waiting for a condition to happen but you want it to continue executing something until it does happen:

Code:

...
loop_check = 0
repeat until <loop_check = 1>:
  //Do some other stuff here
  if <condition to check>:
    loop_check = 1
loop_check = 0
//Continue doing some other stuff...

This would work well if you replaced <condition to check> with <mouse down?> or something.

That could possibly work, though I may have tried it already. I'll test it, thanks  smile .

@12three: I'll probably end up posting it if the above does not work.


http://i1067.photobucket.com/albums/u427/HulKDzN/RebornBlade.png

Offline

 

#9 2010-10-29 21:29:24

recycle49
Scratcher
Registered: 2009-12-21
Posts: 1000+

Re: 1 Script 1 Sprite Wait Until?

You could try if var=whutever and then it should wait entill its true


"Every challenge must be met, every battle must be won, and every story will end." -Me
Recycle49 December 09 - November 11 Goodbye

Offline

 

Board footer