Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Why does this script not work?
- pocketcube
- Scratcher
25 posts
Why does this script not work?
when green flag clickedThis should, every 5 seconds, hide/show at random. Why doesn't this work?
reset timer
forever
if <((timer) mod (5)) = [0]> then
if <(pick random (0) to (1)) = [1]> then
show
else
hide
end
end
end
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/
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.
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?
This is your best solution. Why not replace the if timer mod 5=0 with wait 5 seconds?
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?
Have to say, @KingOfAwesome58219 that I find your signature graphic particularly annoying!This is your best solution. Why not replace the if timer mod 5=0 with wait 5 seconds?
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.
- 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?
Why not start your own topic, give more details and share what you have so far. Wait, can someone give me some tips for a good tweening code for my Wonderland meme?
- BrownydaKat
- Scratcher
7 posts
Why does this script not work?
Oki *Wait, how do you do that? Sorry, Idk…*Why not start your own topic, give more details and share what you have so far. Wait, can someone give me some tips for a good tweening code for my Wonderland meme?
Last edited by BrownydaKat (Dec. 10, 2017 19:46:52)
- xXLORDPEKKAXx
- Scratcher
18 posts
Why does this script not work?
Oki *Wait, how do you do that? Sorry, Idk…*Why not start your own topic, give more details and share what you have so far. Wait, can someone give me some tips for a good tweening code for my Wonderland meme?
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?
https://scratch.mit.edu/discuss/topic/285446/?page=1#post-2920203Oki *Wait, how do you do that? Sorry, Idk…*Why not start your own topic, give more details and share what you have so far. Wait, can someone give me some tips for a good tweening code for my Wonderland meme?
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.
- Discussion Forums
- » Help with Scripts
- » Why does this script not work?