Discuss Scratch

Pokemon-master124
Scratcher
3 posts

Spamming key

I would like to know how to make it so you need to spam a key in order to achieve brocasting a message so you can move on. However, while attempting to create this, i can only come up with solutions where you can continue to hold the button and it will function this way. How do i prevent this?
BrilliantStar114
Scratcher
100+ posts

Spamming key

Pokemon-master124 wrote:

I would like to know how to make it so you need to spam a key in order to achieve brocasting a message so you can move on. However, while attempting to create this, i can only come up with solutions where you can continue to hold the button and it will function this way. How do i prevent this?
Make something like this:
whenthisspriteclickedForeverifmousedown?andtouchingmouse pointerthenifmousedown?andtouchingmouse pointerthenifmousedown?andtouchingmouse pointerthenifmousedown?andtouchingmouse pointerthenifmousedown?andtouchingmouse pointerthenifmousedown?andtouchingmouse pointerthenifmousedown?andtouchingmouse pointerthenifmousedown?andtouchingmouse pointerthenifmousedown?andtouchingmouse pointerthenbroadcastbutton spammed

Last edited by BrilliantStar114 (April 20, 2024 10:08:57)

youormeletsbringit
Scratcher
69 posts

Spamming key

Pokemon-master124 wrote:

I would like to know how to make it so you need to spam a key in order to achieve brocasting a message so you can move on. However, while attempting to create this, i can only come up with solutions where you can continue to hold the button and it will function this way. How do i prevent this?

This code works perfectly as intended

whenclickedforeveriftouchingmouse-pointer?andmousedown?thenrepeatHowevermanyclicksyouwantresettimerwaituntiltouchingmouse-pointer?andmousedown?waituntilnottouchingmouse-pointer?andmousedown?iftimer>1thenstopthis scriptbroadcastbutton spammed

Last edited by youormeletsbringit (April 21, 2024 06:39:03)

PBfriedpanSTUDIOS
Scratcher
60 posts

Spamming key

whenyour choicekeypressedresettimerrepeatuntiltimer=0.375ifkeyyour choicepressed?thenresettimerrepeatuntiltimer=0.375ifkeyyour choicepressed?thenresettimerrepeatuntiltimer=0.375ifkeyyour choicepressed?thenresettimerrepeatuntiltimer=0.375ifkeyyour choicepressed?thenresettimerrepeatuntiltimer=0.375ifkeyyour choicepressed?thenresettimerrepeatuntiltimer=0.375ifkeyyour choicepressed?thenYourCode
i hope this works!
BigNate469
Scratcher
1000+ posts

Spamming key

somehatblockrepeatnumberoftimesyouwantpersontohitkeyresettimerifkeypressed?andtimer<maximum timethenchangespammed?by1ifspammed?=numberoftimesyouwantpersontohitkeythendosomething

Last edited by BigNate469 (April 20, 2024 20:35:47)

-TUB-
Scratcher
100+ posts

Spamming key

A lot of these solutions seem like they are either way to repetitive or don't work as intended. Here is my solution:

whenclickedsetbutton pressto0foreverifkeypressedthenchangebutton pressby1elsesetbutton pressto0whenclickedsetspam counterto0foreverifbuttonpress=1thenchangespam counterby1elsechangespam counterby-0.1 changes how fast the spamming must be only occurs the first frame a key is heldifspamcounter<0thensetspam counterto0

If spam counter is above a certain number, spamming is detected. Note that the second function can be adjusted, for example, by adding a timer so that the counter resets after a certain amount of time with no button presses.
just-a-hriday
Scratcher
100+ posts

Spamming key

deleted

Last edited by just-a-hriday (April 21, 2024 03:10:41)

Powered by DjangoBB