Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Ranking system
- wei04787
-
Scratcher
100+ posts
Ranking system
https://scratch.mit.edu/projects/1159755671
So in my project when you add things to the ranking list, for soem reason the first 4 things you answer just dont add to the list. Can anyone find out why? and how to fix this?
So in my project when you add things to the ranking list, for soem reason the first 4 things you answer just dont add to the list. Can anyone find out why? and how to fix this?
- kansees
-
Scratcher
51 posts
Ranking system
I am unfamiliar with these types of projects, I can't solve the problem without knowing the problem, and because i'm dum, can you explain your problem more clearly?
- wei04787
-
Scratcher
100+ posts
Ranking system
When you click start, and it asks you what you want to add to the list, the first three things you answer (even when you type “nothing” which should make it so it stops asking question) are just disregarded and not added to the list
- ItBeJC
-
Scratcher
1000+ posts
Ranking system
I could find nothing wrong with your code. Everything seems to be spot on, so I'd probably say it is a glitch with Scratch. I took the argument that checks if the answer is equal to “nothing”/“NOTHING” out of the if statement, stopped clicking & dragging, and then put it back in and everything seemed to work fine.
- deck26
-
Scratcher
1000+ posts
Ranking system
The Ask the Question receiver is being restarted multiple times so my guess is it gets as far as the ask block but never processes the response because the script is restarted. Improve your control so that script only starts once.
it is easy to check this. Add a debug list and at the top of that receiver add a line to the list.
it is easy to check this. Add a debug list and at the top of that receiver add a line to the list.
- wei04787
-
Scratcher
100+ posts
Ranking system
When I went back into my project again to test, the first time I completed it, it worked, the second it did not (the first 2 were not even added to the list “Ranking Items”) and the third and forth time it worked even though I switched nothing. Is this just a bug?
- deck26
-
Scratcher
1000+ posts
Ranking system
Sounds to me like you don't have a proper initialisation stage. Good practice is to ensure all variables, costumes etc are set before any game scripts run. Ideally a single green flag script as follows
In your case you started the project from a reload where certain variables had specific values which allowed the other scripts to run or wait until something changed. When you ran the project again it had values from the previous run which no longer allowed the project to just run properly. For example, perhaps you have a script that only runs when a certain variable has a certain value. If that script is allowed to run too early (or doesn't run at the right time) as a result of the variable being incorrect other things can fail to work.
when green flag clicked
broadcast [initialise v] and wait // sprites respond by setting variables, costumes, positions etc
broadcast [ready v] //only now do game scripts run
In your case you started the project from a reload where certain variables had specific values which allowed the other scripts to run or wait until something changed. When you ran the project again it had values from the previous run which no longer allowed the project to just run properly. For example, perhaps you have a script that only runs when a certain variable has a certain value. If that script is allowed to run too early (or doesn't run at the right time) as a result of the variable being incorrect other things can fail to work.
- Discussion Forums
- » Help with Scripts
- » Ranking system
