Discuss Scratch

ILSTINE
Scratcher
11 posts

If hidden, then don't do script?

Hello! I am not sure if this is even possible (or even exists for that matter) but is there a way that if a sprite is hidden, it won't do a script? I'll show you what I mean:

when green flag clicked
forever
if <[hide sprite] = [true]> then
repeat until <[hide sprite] = [true]>
don't do the following script
end
end
if <[hide sprite] = [false]> then
Blah balh. Do stoof!
end
end

Thank you!

Last edited by ILSTINE (Aug. 22, 2021 10:13:41)

Byron_Inc
Scratcher
1000+ posts

If hidden, then don't do script?

You can create a new variable that switches to one value when it's hidden and another when it's shown. Keep them consistent.
hide
set [shown? v] to [0]

show
set [show? v] to [1]

Then, when you need to check if the script is hidden, do

<(shown?) = [1]> // Shown
<(shown?) = [0]> // Hidden

This might be a hassle and make your script a mess if your script contains a lot of hide and show blocks, so you may want to create custom blocks for those.
define hide
hide
set [shown? v] to [0]

define show
show
set [shown? v] to [1]

when gf clicked
show :: custom

Planning on coming back soon.
Abcpunit
Scratcher
85 posts

If hidden, then don't do script?

sorry this post was unrelevent so it was removed for your sake

Last edited by Abcpunit (Aug. 22, 2021 11:20:31)


I make 3D projects on scratch.
ILSTINE
Scratcher
11 posts

If hidden, then don't do script?

Thanks but because my sprites are buttons they are still interactable when hidden.
ILSTINE
Scratcher
11 posts

If hidden, then don't do script?

Never mind, I found a workaround! Thanks though!

Powered by DjangoBB