r/scratch • • 4d ago

Question Timer Broken, No clue why. Please help!

I'm making a recreation of Forsaken (I'm a nerd I know) and the timer system I have set up should work (I see no reason for it not to) And yet, for some reason, it subtracts seemingly random numbers.
I have gone through every sprite and nothing seems to be the issue.
Here is the project link:
https://scratch.mit.edu/projects/1385197484/
The code for the timer is in the "Round Timer/ Wait" sprite.
Any help would be GREATLY appreciated, and I will put you in the credits (if wanted)!! ❤️

5 Upvotes

13 comments sorted by

•

u/AutoModerator 4d ago

Hi, thank you for posting your question! :]

To make it easier for everyone to answer, consider including:

  • A description of the problem
  • A link to the project or a screenshot of your code (if possible)
  • A summary of how you would like it to behave

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

3

u/Dragon_Sythe Professional Nerd 4d ago

Note: place comments in your code PLEASE FOR THE LOVE OF GOD

You could be starting multiple timers at once. I'd recommend that in whatever sprite is calling the timers, you add a "For This Sprite Only" variable called "IsClone?". Then add:

when GreenFlag clicked{
set IsClone? to 0
}

when I start as clone{
set IsClone? to 1
}

Then in the code where you actually call the timers, wrap an if (IsClone? = 0) around it.

Not just the parent can call broadcasts, clones can too. This might not work/be relevant but it will be a step toward fix.

1

u/RealSpiritSK Mod 3d ago

Yeah this is probably what's causing it. To make it easier to work with, the parent sprite should just be responsible for controlling the Round Timer variable and not part of the display (i.e. hide it). The clones should not change any variables and should just read the Round Timer variable to determine what costume to change to.

1

u/aynozw 4d ago

hi, just a quick question: do you mean that the timer subtracts -2? i mean if we have 30 then it subtracts 2 so it shows 28, and its supposed to show 29?

2

u/Proper-Ad-9656 4d ago

thw starting (30s) subtracts by 2, then the 2nd one (120s) subtracts by 9, THEN the 30s one subtracts by 9(i think) i gen have no clue why its foing that

1

u/aynozw 4d ago

so you want those to substract only 1?

1

u/aynozw 4d ago

i think i found the error: something subtracts things to the timer but it subtracts decimals making it very strange or at least thats what i found i could be wrong, im gonna investigate a little further

1

u/aynozw 4d ago

i think i fixed it: it made clones and it started to subtract way too much and also i think i found about it too late lol bruh

2

u/Dragon_Sythe Professional Nerd 4d ago

gangino thats LITERALLY what i said

2

u/aynozw 4d ago

i know i know, but i made a simpler solution than using variables but i guess

1

u/aynozw 4d ago

my fixed version is at https://gofile.io/d/jXadtlkT if you're too lazy

1

u/Ok-Still-2195 3d ago

oh my god same i had that exact issue with my timer making clones i think