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

#1 2012-08-13 04:13:01

abel465
New Scratcher
Registered: 2012-07-25
Posts: 2

wait until multiple of number?

Hello. Is there a way to detect if my variable is a multiple of 480.
Thanks.

Offline

 

#2 2012-08-13 04:17:35

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: wait until multiple of number?

Try doing this:

<(variable) = ((round ((variable) * ((1) / (480))) * (480))


http://i50.tinypic.com/312u714.jpg

Offline

 

#3 2012-08-13 04:21:17

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: wait until multiple of number?

BirdByte wrote:

Try doing this:

if <(variable) = ((round ((variable) * ((1) / (480)))) * (480))>
 whatever
end

Whoops, messed that one up. Sorry, fixed.  smile


http://i50.tinypic.com/312u714.jpg

Offline

 

#4 2012-08-13 04:24:31

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: wait until multiple of number?

BirdByte wrote:

Try doing this:

<(variable) = (round (variable) * ((1) / (480)) * (480))

Whoa. I think the "mod" block works.

<((variable) mod (480)) = [0]>
Help fix it please.

Last edited by jontmy00 (2012-08-13 04:38:24)


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

#5 2012-08-13 04:28:41

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: wait until multiple of number?

jontmy00 wrote:

BirdByte wrote:

Try doing this:

<(variable) = (round (variable) * ((1) / (480)) * (480))

Whoa. I think the "mod" block works.

<((variable) mod (480)) = [0]>
Help fix it please.

I totally forgot about that!  yikes


http://i50.tinypic.com/312u714.jpg

Offline

 

#6 2012-08-13 04:38:44

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: wait until multiple of number?

Thanks for fixing it.

FINAL:

<((variable) mod (480)) = [0]>

Last edited by jontmy00 (2012-08-13 04:39:15)


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

#7 2012-08-13 04:56:04

abel465
New Scratcher
Registered: 2012-07-25
Posts: 2

Re: wait until multiple of number?

Thank you very much for your answer

Offline

 

#8 2012-08-13 05:02:40

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: wait until multiple of number?

abel465 wrote:

Thank you very much for your answer

Welcome.


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

Board footer