Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » (Plz close) Custom view counter broken!
- -_-Onscratch
- Scratcher
100+ posts
(Plz close) Custom view counter broken!
I have just released a project that uses a cloud variable to count how many people ran the project (yes I know there is a normal view counter on the project page I just thought it would be cool to make a custom one). But for some reason it doesn't save the variable when a user runs the project
as you can see Here. Multiple people have viewed the project but the views stay at 1 or 3. You can view the project with This link. The only code I have with the cloud variable is just so the counter only goes up once the first time the green flag is clicked to prevent people spamming the views. I do this with a variable called “First view” which is set to 1 everytime I run the project so when I save the project the variable gets set the 1 then when anybody but me views the project the “First view” variable is set to 0 and increments the cloud variable by 1. I really don't understand if this is a problem with my code or with scratch so any help would be great!
EDIT BUT STILL NOT SOLVED: I should also note that this is really my first time doing anything with cloud variables and that I have tried fixing the issue by doing
instead of
but this didn't make any change.
SECOND EDIT: I renamed the cloud variable and I think that fixed it! Still annoying that I had to do that but at least it works.
as you can see Here. Multiple people have viewed the project but the views stay at 1 or 3. You can view the project with This link. The only code I have with the cloud variable is just so the counter only goes up once the first time the green flag is clicked to prevent people spamming the views. I do this with a variable called “First view” which is set to 1 everytime I run the project so when I save the project the variable gets set the 1 then when anybody but me views the project the “First view” variable is set to 0 and increments the cloud variable by 1. I really don't understand if this is a problem with my code or with scratch so any help would be great!
EDIT BUT STILL NOT SOLVED: I should also note that this is really my first time doing anything with cloud variables and that I have tried fixing the issue by doing
set [☁ Views v] to ((☁ Views) + (1))
instead of
change [☁ Views v] by (1)
but this didn't make any change.
SECOND EDIT: I renamed the cloud variable and I think that fixed it! Still annoying that I had to do that but at least it works.
Last edited by -_-Onscratch (March 27, 2024 20:12:26)
- MineTurte
- Scratcher
500+ posts
(Plz close) Custom view counter broken!
Hmm. This should work unless it updates the cloud variable faster than it's 130 ms delay. Other than that I'm not too sure how to help. I have just released a project that uses a cloud variable to count how many people ran the project (yes I know there is a normal view counter on the project page I just thought it would be cool to make a custom one). But for some reason it doesn't save the variable when a user runs the project
as you can see Here. Multiple people have viewed the project but the views stay at 1 or 3. You can view the project with This link. The only code I have with the cloud variable is just so the counter only goes up once the first time the green flag is clicked to prevent people spamming the views. I do this with a variable called “First view” which is set to 1 everytime I run the project so when I save the project the variable gets set the 1 then when anybody but me views the project the “First view” variable is set to 0 and increments the cloud variable by 1. I really don't understand if this is a problem with my code or with scratch so any help would be great!
EDIT BUT STILL NOT SOLVED: I should also note that this is really my first time doing anything with cloud variables and that I have tried fixing the issue by doingset [☁ Views v] to ((☁ Views) + (1))
instead ofchange [☁ Views v] by (1)
but this didn't make any change.
15+ (not revealing age) girl. Pronouns are she/her.
Host of The Pi Counsel. Comment in studio to join.
Front-end web developer & software programmer. I use JS, HTML, & CSS. Learning python3 right now.
Grammar fanatic as well
If I helped you out consider following Juni-Bug!
Select this + shift + down arrow = view rest of signature
This is JuniperActias. AKA Moth mommy.
Signature gradients here
If you found this secret; reply with ‘uwu’ with absolutely no context
Host of The Pi Counsel. Comment in studio to join.
Front-end web developer & software programmer. I use JS, HTML, & CSS. Learning python3 right now.
Grammar fanatic as well
If I helped you out consider following Juni-Bug!
Select this + shift + down arrow = view rest of signature
This is JuniperActias. AKA Moth mommy.
Signature gradients here
If you found this secret; reply with ‘uwu’ with absolutely no context
- Discussion Forums
- » Help with Scripts
- » (Plz close) Custom view counter broken!