Discuss Scratch

fred87321
Scratcher
23 posts

when stop button pressed and or hat blocks

hi,
you should make when stop button pressed and or blocks like the things down bellow
when stop button pressed :: events
and
{when green flag clicked} or {when i receive [message1 v]} :: events
but hat blocks, and yes i know i could just do this.
when green flag clicked
do stuff
when [message1 v] key pressed
do stuff
but it saves time.

Last edited by fred87321 (July 17, 2014 19:37:38)

turkey3
Scratcher
1000+ posts

when stop button pressed and or hat blocks

One way to perform actions after the stop sign is pressed is with this:

when gf clicked
forever
reset timer

when [timer v] > (0.1) //will work when the stop sign is clicked
...

PH-zero
Scratcher
100+ posts

when stop button pressed and or hat blocks

fred87321 wrote:

{when green flag clicked} or {when i receive [message1 v]} :: operators hat   //   <-- you mean like this? =)
but hat blocks
you can do this:
when green flag clicked
doSomthing //category=custom

when i receive [message1 v]
doSomthing //category=custom

define doSomthing
...

Ever wanted to rotate the stage? Or to
go to x:() y:() z:() ::custom
Click me!
Splodge5
Scratcher
1 post

when stop button pressed and or hat blocks

turkey3 wrote:

One way to perform actions after the stop sign is pressed is with this:

when gf clicked
forever
reset timer

when [timer v] > (0.1) //will work when the stop sign is clicked
...


Thanx!!!
Rockstar2352
Scratcher
42 posts

when stop button pressed and or hat blocks

turkey3 wrote:

One way to perform actions after the stop sign is pressed is with this:

when gf clicked
forever
reset timer

when [timer v] > (0.1) //will work when the stop sign is clicked
...

Actually, I ran some tests and whenever the green flag is clicked it does that action because the timer when the green flag is clicked goes to 0.1 seconds before the forever reset timer goes off. To fix this do this:


when gf clicked
forever
reset timer


when [timer v] > (0.2) //will work when the stop sign is clicked and not when the green flag is clicked
...



Last edited by Rockstar2352 (Dec. 5, 2014 20:47:16)


Click here to see my brand new game in beta called Goop's Adventures! Tell me what you think!
Scratcher1002
Scratcher
1000+ posts

when stop button pressed and or hat blocks

Wordwide
New to Scratch
6 posts

when stop button pressed and or hat blocks

turkey3 wrote:

One way to perform actions after the stop sign is pressed is with this:

when gf clicked
forever
reset timer

when [timer v] > (0.1) //will work when the stop sign is clicked
...
WOW!
minekraftkid
Scratcher
100+ posts

when stop button pressed and or hat blocks

when [timer v] > (0.2)
forever

broadcast [time loop v] and wait
end
when I receive [time loop v]
forever
reset timer

end

THATS HOW YA DO IT

Play [Hugo! v] :: sensing :: block // https://scratch.mit.edu/projects/638843573
minekraftkid
Scratcher
100+ posts

when stop button pressed and or hat blocks

define when stop pressed
...
when [timer v] > (2)
repeat until <not <(timer) = [2]>>
broadcast [when stop pressed v] and wait

end
when I receive [when stop pressed v]
forever

reset timer
when stop pressed
end
when green flag clicked
forever

reset timer
end



DATS HOW U DO IT

Play [Hugo! v] :: sensing :: block // https://scratch.mit.edu/projects/638843573
Langdon35
Scratcher
500+ posts

when stop button pressed and or hat blocks

No support.

Woohoo!
Charles12310
Scratcher
1000+ posts

when stop button pressed and or hat blocks

No Support. This has been rejected, since Scratch Team explained that Stop Sign was used to stop all scripts, not to activate a script.

I found a solution, however:
when green flag clicked
forever
set [timer v] to ((timer) + (0.1))
end

when [timer v] > (timer :: variables )
if <(timer) > (timer :: variables)> then // you must use an if block for this, even though the hat block defines this, for certain reasons.
...
end
You may do this:

when green flag clicked
forever
reset timer
end

when [timer v] > (0.2)
...
However, the first one is better because the script won't ruin projects if they need a timer.

Last edited by Charles12310 (Sept. 25, 2017 01:46:16)



A few internet communication companies want to corrupt the internet by getting rid of net neutrality. Stop Them!
coderKingsley
Scratcher
54 posts

when stop button pressed and or hat blocks

Here's how it could be.

when green flag clicked
set [ timer] to [0.1]
forever
change [ timer] by (0.1)
end
when [ timer] > ((timer))
your script here
this is because when you stop the project, the scratch timer still runs.

THIS is a bad signiture

;
BosenChang
Scratcher
1000+ posts

when stop button pressed and or hat blocks

1.2 “When stop sign clicked” hat block
The block below would allow users to click the stop sign to run a script. However, the stop sign is designed to stop all the scripts in the project. With this block in place, more scripts will start when you want the project to stop, thus defeating the purpose of the stop sign. This could also be rather confusing for the “stop all” block. Regardless, there is a workaround that uses the “when (timer) > (number)” hat block; one such workaround can be found in this post.

This is the part. The offical list of rejected suggestions

Last edited by BosenChang (June 20, 2020 17:33:17)


Last edited by kaj (The day after tomorrow 01:01:01)
Tomatoes are salty? I didn't know that!
Be moist
(-!*o_o*!-) // protecty, my signature kumquat protector. *power level: infinty *magic level: infinty
(?-i_i-?) // claculately, caculates weaknesses and finds out strengths to...
// evil qumquats



My signature change:
Some people don't have empathy; while others do.
Some people false-report projects, and more necropost.

Hello there! I can sometimes help you, or you can help me!


See my projects
I am not advertising. This is a signature. It appers underneath everything I write! To change your signature, go to Discussion Home and scroll down to “change my signature.”
see my projects::looks
say [hello]
If you want to see my topic “What makes a good topic?”, then go to Which topics are good?
Other helpful:
Lists of suggestions by SSB20 *please call him by his nickname*
Which topics are good? (already included) by me
BosenChang
Scratcher
1000+ posts

when stop button pressed and or hat blocks

for number 2 just do:
[when green flag clicked v] or [when I recieve [message1 v]:: hat :: control

Last edited by BosenChang (June 20, 2020 17:36:42)


Last edited by kaj (The day after tomorrow 01:01:01)
Tomatoes are salty? I didn't know that!
Be moist
(-!*o_o*!-) // protecty, my signature kumquat protector. *power level: infinty *magic level: infinty
(?-i_i-?) // claculately, caculates weaknesses and finds out strengths to...
// evil qumquats



My signature change:
Some people don't have empathy; while others do.
Some people false-report projects, and more necropost.

Hello there! I can sometimes help you, or you can help me!


See my projects
I am not advertising. This is a signature. It appers underneath everything I write! To change your signature, go to Discussion Home and scroll down to “change my signature.”
see my projects::looks
say [hello]
If you want to see my topic “What makes a good topic?”, then go to Which topics are good?
Other helpful:
Lists of suggestions by SSB20 *please call him by his nickname*
Which topics are good? (already included) by me
Nambaseking01
Scratcher
1000+ posts

when stop button pressed and or hat blocks

Like BosenChang said, one suggestion here is rejected, and additionally, multiple topics in a single topic isn't allowed on Scratch. I imagine this rule wasn't emphasized back in 2014, so I won't blame the OP, but I'll report this topic to be closed.

Hey there! My name is Nammy. I'm a male Forum Helper and Scratch Wiki Editor.
Profile | Test Account | Talk with me here! | Griffpatch is quitting Scratch?!

Powered by DjangoBB