Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My timer is slower than Scratch's timer #3666

Open
RixInGithub opened this issue May 25, 2022 · 3 comments
Open

My timer is slower than Scratch's timer #3666

RixInGithub opened this issue May 25, 2022 · 3 comments
Labels

Comments

@RixInGithub
Copy link

Hello, coding and Scratching guys,

since the past year's November, RixxyX's project was good as dead, to be honest. So, I sat down to my chair and thought that I wouldn't let this happen. And, I did sorta that what I wanted, but, I see, when I make code like:

when gf clicked
reset timer
start measuring time :: #773c00
wait until <(time :: #773c00) = [2000]>
end measuring time :: #773c00
say (timer)

I see, that the process took... 51.32 seconds, instead of 2?! As described in the title, my timer is slower than Scratch's timer. My code for time is:

	startTime(args) {
		time = 0
		isMeasure = true
	}
	endTime(args) {
		isMeasure = false
	}
	returnTime(args) {
		if (isMeasure == true) {
			time += 1
		}
		return time
	}

In the start, written as:

var isMeasure = false
var time = 0

I have no explanation to what cause to my extension going... Nuts. Finally, can somebody help me to make my timer equal to Scratch's one?

@CST1229
Copy link

CST1229 commented Jun 4, 2022

Your time block increments every time it is used, and the wait until block runs every frame (1/30th of a second). As such, your script essentially waits for 2000 frames (66.6... seconds, i have no explanation why it took 51.32 seconds for you, possibly inconsistent framerate) instead of 2 seconds.

@RixInGithub
Copy link
Author

How could I make it increment every millisecond, not frame?

@showierdata9978
Copy link

You could multiply it by 1000 (milliseconds are 1000 times smaller then seconds)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants