Discuss Scratch

Rosyda
Scratcher
85 posts

an event that occurs when the stop button is clicked

I don't know if this is the right section to post this. Anyway, this is a bad idea, since we all know that when the stop button is clicked, the project should've stopped. But I found there's a way to do this (to trigger an event after the project is stopped), you can see this project for an example https://scratch.mit.edu/projects/126398420/

timer in scratch will start when you start your project,
(timer)
 when green flag clicked 

but if you make it like the block below, the timer won't tick
when green flag clicked
forever
reset timer
end

But I realized that the timer still ticks even though that you stopped your project, and if you made the code above, then the timer will actually start when you stop your project

and there's a condition-based event block
when [timer] > (10)

if you make it like this after the reset timer loop:
when [timer] > (0.2)
say [you clicked the stop button] for (2) secs

the sprite will say “you clicked the stop button” after you stop the project

if you make it like this:
when [timer] > (0.2)
forever
reset timer
end

then our project will run infinitely and you can't stop the project

I don't know if this is a feature or not, if this was not intended, then the scratch team should be notified
liam48D
Scratcher
1000+ posts

an event that occurs when the stop button is clicked

Oh yeah, this is a less-known handy trick!

I've used it in one of my unpublished projects, to do this:



The script that makes the variable display (which is clearly of a parser's index in a string) is on the run-even-when-the-project-stops hat. That way I can use the stop sign to kill the actual program, but I won't need to click the green flag again to run the display script.

202e-202e-202e-202e-202e UNI-CODE~~~~~
MegaApuTurkUltra
Scratcher
1000+ posts

an event that occurs when the stop button is clicked

liam48D wrote:

Oh yeah, this is a less-known handy trick!

I beg to differ…

$(".box-head")[0].textContent = "committing AT crimes since $whenever"
PullJosh
Scratcher
1000+ posts

an event that occurs when the stop button is clicked

MegaApuTurkUltra wrote:

liam48D wrote:

Oh yeah, this is a less-known handy trick!

I beg to differ…
I had never seen it before.
MegaApuTurkUltra
Scratcher
1000+ posts

an event that occurs when the stop button is clicked

PullJosh wrote:

MegaApuTurkUltra wrote:

liam48D wrote:

Oh yeah, this is a less-known handy trick!

I beg to differ…
I had never seen it before.
Really? Did you join Scratch yesterday?

$(".box-head")[0].textContent = "committing AT crimes since $whenever"
CodeLegend
Scratcher
500+ posts

an event that occurs when the stop button is clicked

MegaApuTurkUltra wrote:

PullJosh wrote:

MegaApuTurkUltra wrote:

liam48D wrote:

Oh yeah, this is a less-known handy trick!

I beg to differ…
I had never seen it before.
Really? Did you join Scratch yesterday?
To be fair…
It's less well-known than how to make things happen when the flag is pressed.
jb1013
Scratcher
1 post

an event that occurs when the stop button is clicked

Nice! Will totally use this!
o0yiii
Scratcher
1 post

an event that occurs when the stop button is clicked

when [ timer] > (10)

when green flag clicked


Just put these 2 blocks SEPRATE and you got a project that never stops

Powered by DjangoBB

Standard | Mobile