Discuss Scratch

pocketcube
Scratcher
25 posts

Why does this script not work?

when green flag clicked
reset timer
forever
if <((timer) mod (5)) = [0]> then
if <(pick random (0) to (1)) = [1]> then


show

else
hide
end
end
end
This should, every 5 seconds, hide/show at random. Why doesn't this work?

Last edited by pocketcube (Dec. 7, 2017 21:35:25)

pocketcube
Scratcher
25 posts

Why does this script not work?

Never mind, this script works. I must be going crazy.
pocketcube
Scratcher
25 posts

Why does this script not work?

Why does the script not work in this instance?
https://scratch.mit.edu/projects/189096765/
xXLORDPEKKAXx
Scratcher
18 posts

Why does this script not work?

What is it exactly that you want to do that to? If you want something to appear and re-appear in another location, you have to change the location of it. You don't necessarily need the timer, though it doesn't affect anything. What you do is-
You can look in the Scratch tutorials and look for the hide and seek one. That has the same concept that you are trying to do.


when green flag clicked
go to x: (starting x position) y: (starting y position)
wait (5) secs
forever
go to x: (pick random (-240) to (240)) y: (pick random (-180) to (180))
wait (5) secs
end

Last edited by xXLORDPEKKAXx (Dec. 7, 2017 22:56:26)

asivi
Scratcher
1000+ posts

Why does this script not work?

It is better to do that @uniquename1 says below this.

Last edited by asivi (Dec. 7, 2017 23:30:09)

Uniquename1
Scratcher
100+ posts

Why does this script not work?

I'd be suspicious of pick random 0-1 =1. Though if that works it'd make things easier. That part seems ok. Why not replace the if timer mod 5=0 with wait 5 seconds?

Last edited by Uniquename1 (Dec. 7, 2017 22:50:36)


Try my games.
Scratch Sprite Club VI Soccer
Star Fighter Shooting
Space Marines: Boarding Party Strategy
Lion Runner Running/ Platformer
KingOfAwesome58219
Scratcher
1000+ posts

Why does this script not work?

Uniquename1 wrote:

Why not replace the if timer mod 5=0 with wait 5 seconds?
This is your best solution.
Put the cloning script into a custom block, with run without screen refresh enabled so that they are all created at the same time, and there is no offset. Also, make 64 clones and don't have the original sprite be part of the process.



deck26
Scratcher
1000+ posts

Why does this script not work?

Never assume the timer is returning a whole number unless you use round, floor or ceiling on it. timer mod 5 might never be 0 in your project.
deck26
Scratcher
1000+ posts

Why does this script not work?

KingOfAwesome58219 wrote:

Uniquename1 wrote:

Why not replace the if timer mod 5=0 with wait 5 seconds?
This is your best solution.
Put the cloning script into a custom block, with run without screen refresh enabled so that they are all created at the same time, and there is no offset. Also, make 64 clones and don't have the original sprite be part of the process.
Have to say, @KingOfAwesome58219 that I find your signature graphic particularly annoying!
pocketcube
Scratcher
25 posts

Why does this script not work?

Thanks everyone, I've got it fixed.
BrownydaKat
Scratcher
7 posts

Why does this script not work?

Wait, can someone give me some tips for a good tweening code for my Wonderland meme?
deck26
Scratcher
1000+ posts

Why does this script not work?

BrownydaKat wrote:

Wait, can someone give me some tips for a good tweening code for my Wonderland meme?
Why not start your own topic, give more details and share what you have so far.
BrownydaKat
Scratcher
7 posts

Why does this script not work?

deck26 wrote:

BrownydaKat wrote:

Wait, can someone give me some tips for a good tweening code for my Wonderland meme?
Why not start your own topic, give more details and share what you have so far.
Oki *Wait, how do you do that? Sorry, Idk…*

Last edited by BrownydaKat (Dec. 10, 2017 19:46:52)

xXLORDPEKKAXx
Scratcher
18 posts

Why does this script not work?

BrownydaKat wrote:

deck26 wrote:

BrownydaKat wrote:

Wait, can someone give me some tips for a good tweening code for my Wonderland meme?
Why not start your own topic, give more details and share what you have so far.
Oki *Wait, how do you do that? Sorry, Idk…*

Scroll to the top of this page. Click “Discussion Home”. Then look for the category/section labeled “Making Scratch Projects. Look for the ”Help With Scripts“ link/tab in one of the sections and click it. Near the top of the page, you will see ”New Topic" as a blue button. Click that and write your concerns.

Last edited by xXLORDPEKKAXx (Dec. 10, 2017 20:14:43)

BrownydaKat
Scratcher
7 posts

Why does this script not work?

xXLORDPEKKAXx wrote:

BrownydaKat wrote:

deck26 wrote:

BrownydaKat wrote:

Wait, can someone give me some tips for a good tweening code for my Wonderland meme?
Why not start your own topic, give more details and share what you have so far.
Oki *Wait, how do you do that? Sorry, Idk…*

Scroll to the top of this page. Click “Discussion Home”. Then look for the category/section labeled “Making Scratch Projects. Look for the ”Help With Scripts“ link/tab in one of the sections and click it. Near the top of the page, you will see ”New Topic" as a blue button. Click that and write your concerns.
https://scratch.mit.edu/discuss/topic/285446/?page=1#post-2920203

Powered by DjangoBB