Discuss Scratch

parambula
New Scratcher
2 posts

How can you get points only if something is show.

I want to hide things and show other things. I want a person to only get points when something is shown. How do I do that?
Pylar
Scratcher
100+ posts

How can you get points only if something is show.

While it does look like you need help, This is the wrong place to ask for help with scripts. In the future, try the help with scripts forum, which can be found HERE. You'll probably get better luck getting help! I'll request for this to be moved so you don't have to create a new topic!
parambula
New Scratcher
2 posts

How can you get points only if something is show.

Thank you
drmcw
Scratcher
1000+ posts

How can you get points only if something is show.

You need to explain what you want as one answer to your question would be

show
change [points v] by (1)

but I expect that is not the answer you want.
Uniquename1
Scratcher
100+ posts

How can you get points only if something is show.

Depends on lots of things and preferences. Always best to show us your project you want help with. Normally if something is hidden other sprites cannot interact with it and you shouldn't get points or lose points from interacting with it in any way because it is not there to interact with. This is different from having something invisible by setting it's ghost at 100% where you can still interact with it but the player doesn't see it and shouldn't know it is there.

You may however have some unrelated thing shown or hidden and be getting points some other way. In this case you can set a point variable and change this always the same time you hide or show the thing you hide and show turning on and off your ability to gain points. You can set the variable to yes or no or use 0 and 1 in place of yes and no. Then when you do gain points you have to check for whatever you check to get points like touching another sprite and also check if you are allowed to get points at that moment. the check would look something like this.

if <<touching [ v] ?> and <(foo) = [yes]>> then
change [ points] by (1)
end

but you may well be asking something else entirely. As I say normally hidden things can't be interacted with in the first place so shouldn't effect your score keeping unless they are running their own code and adding points automatically or from a broadcast or something in which case you can do this other check if needed.

Last edited by Uniquename1 (May 10, 2017 17:15:17)

7076A-15
New Scratcher
1 post

How can you get points only if something is show.

nope, dont get it
rensmusicandart
Scratcher
71 posts

How can you get points only if something is show.

I would make a variable for whether the sprite is showing or not (one per sprite that gets shown or hidden)
whenever the sprite gets shown set the variable to “show” and whenever it gets hidden set the variable to “hidden”
then, with the points code, add a lil
“if (show/hide variable) = show then
*insert point code here*
else
*code depending on the situation; either ”stop this script“ or ”broadcast (no points)" might work*

lmk if this works or not, I'll fix if I need to
Woodfur
Scratcher
100+ posts

How can you get points only if something is show.

I often do this using an empty costume instead of the “hide” block. Then any script can detect the costume with “(costume #) of (sprite)”.
Recoin
Scratcher
100+ posts

How can you get points only if something is show.

rensmusicandart wrote:

I would make a variable for whether the sprite is showing or not (one per sprite that gets shown or hidden)
whenever the sprite gets shown set the variable to “show” and whenever it gets hidden set the variable to “hidden”
then, with the points code, add a lil
“if (show/hide variable) = show then
*insert point code here*
else
*code depending on the situation; either ”stop this script“ or ”broadcast (no points)" might work*

lmk if this works or not, I'll fix if I need to
i'd usually just set the sprite to an empty noname costume if hidden then detect the costume name of “ ”

edit: basically what Woodfur said:

Woodfur wrote:

I often do this using an empty costume instead of the “hide” block. Then any script can detect the costume with “(costume #) of (sprite)”.

Last edited by Recoin (May 9, 2024 01:06:04)

mastergamerx-details
Scratcher
100+ posts

How can you get points only if something is show.

parambula wrote:

I want to hide things and show other things. I want a person to only get points when something is shown. How do I do that?
I may not be correct, but this is the best I can do:
when green flag clicked
show
broadcast [give points v]
when I receive [give points v]
show

Try this, if it doesn't work, then use someone else's help
Also, if something needs to happen for the thing to show, replace “when green flag clicked” with “when i recieve _” or “when backdrop switches to” etc..

Last edited by mastergamerx-details (May 9, 2024 01:19:02)

Parotter681
Scratcher
12 posts

How can you get points only if something is show.

i need ideas for what to make and also what are the operator blocks for?
Woodfur
Scratcher
100+ posts

How can you get points only if something is show.

Parotter681 wrote:

i need ideas for what to make and also what are the operator blocks for?
That kind of question belongs in Project Ideas, and please make your own topic and don't necropost.

Powered by DjangoBB