Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Code not running
- _taylor_t
- New to Scratch
2 posts
Code not running
I’m working on a school project (a quiz). Everything was running fine. However, when the start flag is clicked, nothing happens. Everything is connected where it needs to be, but the yellow border (that shows when the code is running) doesn’t show up. This could be a bug, but i’m not sure.
- mlcreater
- Scratcher
1000+ posts
Code not running
Is the project shared, so people can look at what may be the problem?
← there are 3 sig figs and 0 kumquats
- _taylor_t
- New to Scratch
2 posts
Code not running
It is, here:
https://scratch.mit.edu/projects/338061478
https://scratch.mit.edu/projects/338061478
- deck26
- Scratcher
1000+ posts
Code not running
Your project is stopping as soon as it starts - the red stop button is always dim.
You have a lot of ‘stop this script’ blocks which you should be able to avoid. If you use wait until touching mouse-pointer and mouse-down you don't need a lot of the forever loops which might make things a bit more obvious.
I suspect there's a stop all in there somewhere as well.
You have a lot of ‘stop this script’ blocks which you should be able to avoid. If you use wait until touching mouse-pointer and mouse-down you don't need a lot of the forever loops which might make things a bit more obvious.
I suspect there's a stop all in there somewhere as well.
Last edited by deck26 (Nov. 9, 2019 11:15:55)
- deck26
- Scratcher
1000+ posts
Code not running
You really need to learn to generalise your code. You don't need separate scripts to ask different questions or handle different scores. As a rule when coding, if you find yourself repeating what is essentially the same code over and over you should find a way of coding it once.
For example, using next backdrop might be better than always naming it. You can also use a variable - eg
For example, using next backdrop might be better than always naming it. You can also use a variable - eg
switch backdrop to (join [backdrop] (current-backdrop))
- deck26
- Scratcher
1000+ posts
Code not running
Compare your code with mine here https://scratch.mit.edu/projects/105090404/
I can add more questions without adding any more code - I just add more data to the lists and costumes to the sprites. So if I decide to make changes it is trivial to do so. In your project if you decide to change one script you may end up having to change dozens of scripts to match! You then potentially introduce other errors and spend a lot of time debugging.
I can add more questions without adding any more code - I just add more data to the lists and costumes to the sprites. So if I decide to make changes it is trivial to do so. In your project if you decide to change one script you may end up having to change dozens of scripts to match! You then potentially introduce other errors and spend a lot of time debugging.
Last edited by deck26 (Nov. 9, 2019 11:46:41)
- Discussion Forums
- » Help with Scripts
- » Code not running