Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to Stop a Script, but Then Be Able to Start it Again
- mkahlua
- Scratcher
37 posts
How to Stop a Script, but Then Be Able to Start it Again
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
- CHEEZ_ITZ_12oz
- Scratcher
64 posts
How to Stop a Script, but Then Be Able to Start it Again
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.
Last edited by CHEEZ_ITZ_12oz (March 27, 2024 21:49:30)
-Cheese Guy
- mkahlua
- Scratcher
37 posts
How to Stop a Script, but Then Be Able to Start it Again
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.
- mkahlua
- Scratcher
37 posts
How to Stop a Script, but Then Be Able to Start it Again
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 <<(variable: shop open) = [false]>> then
hide
else
end
when green flag clicked
forever
if <[variable: shop open] = [true]> then
show
broadcast [Code to make button work v]
else
end
end
Last edited by mkahlua (March 27, 2024 23:56:50)
- Discussion Forums
- » Help with Scripts
- » How to Stop a Script, but Then Be Able to Start it Again