Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Help with detecting own sprite name?
- JayMrGogo
-
Scratcher
17 posts
Help with detecting own sprite name?
Hi, I'm working on a project which uses loads of sprites (53) and I need a way to detect the sprites own name, the script is this:
If this is not possible then I would have to go and individually change each one.
Thanks!
when I receive [Load]
switch costume to [(Letter (sprite_name) of [variable])]
If this is not possible then I would have to go and individually change each one.
Thanks!
Last edited by JayMrGogo (Nov. 13, 2014 19:31:04)
- peppermintpatty5
-
Scratcher
1000+ posts
Help with detecting own sprite name?
To answer you shortly, there is no way to detect a sprite's name. However, I think I can make the scipts here work.
So in case you did not know, the costumes of a sprite are numbered and automatically recorded as a variable called:

So in case you did not know, the costumes of a sprite are numbered and automatically recorded as a variable called:
(costume #)The variable above can be changed using its respective block. Since this block has a string input, you can use set it equal to any variable, number, character, or list. For example:
switch to costume (variable)Try playing around with variables and the set costume block and you should be able to get the result you want. If you have any problems, feel free to reply back.

- Locomule
-
Scratcher
1000+ posts
Help with detecting own sprite name?
Give the sprites numerical names.
- JayMrGogo
-
Scratcher
17 posts
Help with detecting own sprite name?
Yeah, I tried that a bit but all the sprites have costumes named 1,2,3,4 and 5, and I would have to rename all the sprites' costumes.
Cheers
Cheers
- EddieBoy
-
Scratcher
2 posts
Help with detecting own sprite name?
I have the same problem, I need for it to detect the SPRITE NAME so it can add it to a list!
- EddieBoy
-
Scratcher
2 posts
Help with detecting own sprite name?
It is very annoying indeed. Could someone help, Pleeeease!!!
- AndrewBerezaafan
-
Scratcher
100+ posts
Help with detecting own sprite name?
Do this:
You will need to set your costumes to the Sprite's name…
What do you mean by “Detect?” Say the Sprite name? put it on a list?
You will need to set your costumes to the Sprite's name…
What do you mean by “Detect?” Say the Sprite name? put it on a list?
when gf clicked
add (Costume # = 1) to [list v]
Last edited by AndrewBerezaafan (April 7, 2016 19:25:39)
- deck26
-
Scratcher
1000+ posts
Help with detecting own sprite name?
As has been stated you cannot detect the sprite's name using standard blocks. But there are lots of workrounds - a local variable which you just set to the sprite's name is the obvious one.
- AndrewBerezaafan
-
Scratcher
100+ posts
Help with detecting own sprite name?
As has been stated you cannot detect the sprite's name using standard blocks. But there are lots of workrounds - a local variable which you just set to the sprite's name is the obvious one.Wouldn't my one work?
Just use the Costume name?
- deck26
-
Scratcher
1000+ posts
Help with detecting own sprite name?
That's another workaround but the answer to the original question is still the same - there is no way using standard blocks to detect the sprite's name in the same way that you can, for example, detect its x and y position using the sensing blocks. Giving the first costume the same name is a workaround.As has been stated you cannot detect the sprite's name using standard blocks. But there are lots of workrounds - a local variable which you just set to the sprite's name is the obvious one.Wouldn't my one work?
Just use the Costume name?
However I'm not sure I see a problem in the context of the original post which, incidentally, is actually rather old.
- windows11microsoft
-
Scratcher
100+ posts
Help with detecting own sprite name?
when green flag clicked
define name(name)
define name
ok
- windows11microsoft
-
Scratcher
100+ posts
Help with detecting own sprite name?
its easy guys
(costume [name})
- Kaomoji_Dude
-
Scratcher
89 posts
Help with detecting own sprite name?
when green flag clicked
define name(name)define name
ok
its easy guysPlease don't necropost. You can see this topic was posted in 2014, 7 years ago.(costume [name})
- csfirstgaufa
-
Scratcher
1 post
Help with detecting own sprite name?
I NEED help with the modern version
- Discussion Forums
- » Help with Scripts
-
» Help with detecting own sprite name?