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.


Link:
https://c.gethopscotch.com/p/yoy7bjmdg

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

18 Likes

Thanks a lot! :smile:

5 Likes

No problem! I really enjoy helping people.

4 Likes

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

Tag me when you change it, please. :)

4 Likes

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

3 Likes

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

4 Likes

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

6 Likes

Wut… smarty! :stuck_out_tongue: I’m bookmarking that…

3 Likes

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

3 Likes

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

5 Likes

Cool! You should post it here!

4 Likes

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!

4 Likes

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.

2 Likes

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

5 Likes

https://c.gethopscotch.com/p/yoyd4llz3

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

7 Likes

Very interesting

3 Likes

Thanks! ^^

3 Likes

Also, if you need clarification on anything in there, ask away! I worded it kinda weird. ^^;

3 Likes

I had forgotten that I did a project inspired by the Hopscotch “hold for 3 seconds” (when it used to play a click after each second, I just really liked hearing it for some reason :laughing:)

there probably weren’t sounds at the time so I had done red, yellow, green circles instead

https://c.gethopscotch.com/p/elq9hil

(This is imprecise though)


I’m not sure about the lag but I think @Rawrbear was talking about the FPS rate of the device as well :smiley:

2 Likes

kinda off-topic, but

@Rawrbear got it! I forgot about the 60FPS that the games have (I don’t know if I ‘knew’ that since back, so ‘forgot’ might be the wrong term) when it was running 60fps, and not 100 nor 1000 (as there are a thousand milliseconds in a second).

3 Likes