How to do "when pressed for milliseconds"



NOTE: This may not be perfect. If I change it, let me know if I should tag you.

So, I really only have screenshots.


This was inspired by @Gobli09 not knowing how to do this. I came up with it in five minutes, thus it being possibly flawed.


Thanks a lot! :smile:


No problem! I really enjoy helping people.


I'll help improve it! Mind if I make my own prototype? ^^

Tag me when you change it, please. :)


Nope. And sure, I'll tag you. :smiley:


Cool! I'll watch this topic as well. ^^


Wow, That's really cool!
I'm not sure I have anything to use it for, but I totally have to bookmark this.


Wut.... smarty! :stuck_out_tongue: I'm bookmarking that..


It's obvious. Really, it took more like 2 5 minutes.


Yeah, 2 mins. Show off! :stuck_out_tongue: lol, jk. Now I wanna be homeschooled even more.


I'm going to make a customizable button that you can change the press-time of. ^^


Cool! You should post it here!


Homeschool has nothing to do with it.


Actually, it does. There's some study that shows that homeschooled people are smarter and better-tuned to their jobs that people that go to a school.


I don't believe that. However, apparently because I want real butter, I'm homeschooled. XD


So I just figured out Hopscotch's normal FPS: 60. Sorry I'm taking so long to make this; there's a TV playing in this room and a little brother annoying me. XD

It'll be done within 10 minutes!


Cool! I was going to start making a custom block with only one or 2 variables, cuz I use too many. That's one of the reasons my draw pad might not have worked.

Hehe, I get the annoyance, I have a lil bro too. As for the TV, I don't have/want one.


I think it's awesome you were thinking about a workaround! (Even if it hadn't worked out!)

Do you happen to have a general topic, – I really wish I could do unschooling :cry: Actually, never mind


He has a GT, I'll invite you there, if you want..
But he is at mine most of the time. Idk why.


I've got it!

Okay, so there's a bit of code meta you'll need to know first to understand how I made this project.

Every second, a program/Hopscotch project processes a certain number of repetitions, known as frames, in a real-time second: this is called FPS, or frames per second. After a bit of experimenting, I figured out that the average FPS in Hopscotch is 60 FPS.

Since there are 60 frames in a second, that means if you increase a variable 60 times, 1 real life second will pass by!

So basically, I made "if pressed" and "if not pressed" conditions. When it's pressed, it'll increase the counter, while if it's not, it'll reset back to 0.

When you press the button, it'll count to 60 (a full second), then it'll change the colors! Let go, and it'll reset. ^^

Hope this helps!! When you want to make it wait a second, just make a counter variable count to 60! Half a second is 30, a fourth of a second is 15, etcetera. :D

New idea for a block!(tell me if I should put it in this category)
How do I make a stopwatch?