How to Stop a Script, but Then Be Able to Start it Again
id: 750637
category: Help with Scripts
posts: 6
Mar 27, 2024 21:44:17
How to Stop a Script, but Then Be Able to Start it Again
view on scratch
view on legacy ocular
mkahlua
loading
I have been working on a project recently and I'm having trouble with some of the buttons I am coding. I usually just use the “hide” block when trying to make a button disappear, but that only makes it invisible, and you can still accidentally click it even when you don't know the button is there. It can mess some things up. In the case of the project I'm working on, I have a button for the settings menu. When entering the menu, the Start game button should disappear and not work anymore. I have tried using the “Stop all other scripts” block, but this is pretty permanent and you have to click the green flag to start those scripts up again. (The “Stop all other scripts” block also does not work, because I want the Start game button to come back and be usable when the player exits the Settings menu). Is there any way to stop the scripts (and hide them), until a button is pressed to make them start again (and show)? I would appreciate any and all help I get.
Thank you so much!
My browser / operating system: MacOS Macintosh X 10.15.7, Safari 15.6.1, No Flash version detected
Thank you so much!
My browser / operating system: MacOS Macintosh X 10.15.7, Safari 15.6.1, No Flash version detected
Mar 27, 2024 21:49:00
How to Stop a Script, but Then Be Able to Start it Again
view on scratch
view on legacy ocular
CHEEZ_ITZ_12oz
loading
I'm pretty sure if you hide the sprite it shouldn't be able to be clicked on.
Anyways, you should start your scripts by using broadcast blocks, that way you can use “stop other scripts” to stop them, and then “broadcast” to start them again.
Anyways, you should start your scripts by using broadcast blocks, that way you can use “stop other scripts” to stop them, and then “broadcast” to start them again.
Mar 27, 2024 21:56:57
How to Stop a Script, but Then Be Able to Start it Again
view on scratch
view on legacy ocular
mkahlua
loading
shouldn't be able to be clicked on.I'm pretty sure if you hide the sprite it
Anyways, you should start your scripts by using broadcast blocks, that way you can use “stop other scripts” to stop them, and then “broadcast” to start them again.
Thank you for your response! I will try that.
Mar 27, 2024 22:28:29
How to Stop a Script, but Then Be Able to Start it Again
view on scratch
view on legacy ocular
mkahlua
loading
Can you please show me an example of a script using the “hide” block that works to not let you click on it? Thanks,
Mar 27, 2024 23:46:24
How to Stop a Script, but Then Be Able to Start it Again
view on scratch
view on legacy ocular
kingKASEtheGREATalt
loading
you can use broadcast blocks to do so:
you use however many "when i receive " hats you need, start it up whenever, and stop whenever
when green flag clicked
broadcast [settings scripts]
...
stop [other scripts in sprite]
when I receive [settings scripts]
show
...
when I receive [settings scripts]
show
...
you use however many "when i receive " hats you need, start it up whenever, and stop whenever
Mar 27, 2024 23:53:18
How to Stop a Script, but Then Be Able to Start it Again
view on scratch
view on legacy ocular
mkahlua
loading
Thank you so much for you help!!! I figured it out. Another solution would be able to use a variable, which is what I did, but it's the same idea. Thanks so much again!!
when green flag clicked
if <<(foo) = [false]>> then
...
else
end