How to Stop a Script, but Then Be Able to Start it Again

id: 750637

category: Help with Scripts

posts: 6

mkahlua 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
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.

mkahlua mkahlua loading

CHEEZ_ITZ_12oz wrote:

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.



Thank you for your response! I will try that.
mkahlua 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,
you can use broadcast blocks to do so:

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
mkahlua 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