Discuss Scratch
- Discussion Forums
- » Suggestions
- » costume name
- Wes64test
-
Scratcher
38 posts
costume name
in the sensing category, the “() of ()” block can be used to report the costume name of other sprites. but there is no way for a sprite to get its own costume names. this should be added.
- DadOfMrLog
-
Scratcher
1000+ posts
costume name
@Wes64test:
IIRC you can work around this by going to a different sprite, setting the sprite you want on that reporter's menu, and then dropping it into the sprite you want - so now it says “costume name of sprite-i-want” within “sprite-i-want”.
Bit tedious, but it works (and avoids making a list of costume names, which has also been suggested as a workaround)…
(Still, it'd be nice just to have the reporter there ready and waiting.)
IIRC you can work around this by going to a different sprite, setting the sprite you want on that reporter's menu, and then dropping it into the sprite you want - so now it says “costume name of sprite-i-want” within “sprite-i-want”.
Bit tedious, but it works (and avoids making a list of costume names, which has also been suggested as a workaround)…
(Still, it'd be nice just to have the reporter there ready and waiting.)
- Wes64test
-
Scratcher
38 posts
costume name
@Wes64test:yes, i discovered that. it seems like it is a mistake that a sprite can't access its own costume names though, it it can access other sprites.
IIRC you can work around this by going to a different sprite, setting the sprite you want on that reporter's menu, and then dropping it into the sprite you want - so now it says “costume name of sprite-i-want” within “sprite-i-want”.
Bit tedious, but it works (and avoids making a list of costume names, which has also been suggested as a workaround)…
(Still, it'd be nice just to have the reporter there ready and waiting.)
- DadOfMrLog
-
Scratcher
1000+ posts
costume name
Having said that workaround exists, MrLog has just pointed out to me that, of course, it doesn't work for clones, since it refers to the original sprite only.
So, the topic noted above by PZ7 was perhaps closed a bit prematurely and should probably be revisited, with a new push to add an actual “costume name” reporter that will work for clones…
So, the topic noted above by PZ7 was perhaps closed a bit prematurely and should probably be revisited, with a new push to add an actual “costume name” reporter that will work for clones…
Last edited by DadOfMrLog (Aug. 1, 2013 22:54:21)
- mitchboy
-
Scratcher
1000+ posts
costume name
Couldn't you just use costume number…? Or am I not understanding?
- PERCE-NEIGE
-
Scratcher
100+ posts
costume name
I support, because it's up to you to choose the way you want create a program, you can call costume by number of by names, and it could be useful if the name is linked with an action.
By ex:
When event A —> set this variable to “running”
When event B1 —> Switch to costume “running”
When event B2—> Switch to costume n° X
There's already a way to report and use a costume by its name, but the glitch (?) is than you are only able to use it from another sprite, you can't use it from inside the same sprite.
By ex:
SPRITE 1 has 2 costumes called 1A, and 1B SPRITE 2 has 2 costumes called 2A and 2B
Script:
(Sensor block)
If “name of costume is ”2A“ then…
You CAN'T choose If ”name of costume is “1A”
I think you should be able, it would be a good add, to do that, but for now, you just can't.
By ex:
When event A —> set this variable to “running”
When event B1 —> Switch to costume “running”
When event B2—> Switch to costume n° X
There's already a way to report and use a costume by its name, but the glitch (?) is than you are only able to use it from another sprite, you can't use it from inside the same sprite.
By ex:
SPRITE 1 has 2 costumes called 1A, and 1B SPRITE 2 has 2 costumes called 2A and 2B
Script:
(Sensor block)
If “name of costume is ”2A“ then…
You CAN'T choose If ”name of costume is “1A”
I think you should be able, it would be a good add, to do that, but for now, you just can't.
Last edited by PERCE-NEIGE (Aug. 3, 2013 10:28:09)
- TimothyLawyer
-
Scratcher
1000+ posts
costume name
Support!
Or maybe add ‘myself’ as an option in the sensing block?
similar to
Or maybe add ‘myself’ as an option in the sensing block?
([costume name v] of [myself v])
similar to
create clone of [myself v]
- yclee0206
-
Scratcher
100+ posts
costume name
Actually, you can get the costume name of the sprit by using this:
([costume name v] of (join [sprite] [name] ))
Last edited by yclee0206 (May 16, 2015 03:55:55)
- yclee0206
-
Scratcher
100+ posts
costume name
If your sprite name is this; Text
than do something like this:
than do something like this:
([costume name v] of (join [Te] [xt] ))
Last edited by yclee0206 (May 16, 2015 03:55:38)
- TheLogFather
-
Scratcher
1000+ posts
costume name
Actually, you can get the costume name of the sprit by using this:([costume name v] of (join [sprite] [name] ))
Unfortunately, as I mention above, that doesn't work for clones - that sensor block will only return the costume name of the original sprite, not the clones themselves.
It's not that hard to work around it for clones, though, by having the original sprite make a list of costume names and then the clones can use that along with “costume #”. I made a demo project for this a while back: https://scratch.mit.edu/projects/21427539/
Having said all of that, here's the REAL surprise…
The “costume name” block *DOES* exist already internally within Scratch! However, it simply isn't available in the block palette, so you need to either hack the JSON to put it into your project, or get it from a project which already includes it.
Here is such a project: https://scratch.mit.edu/projects/23639677/#editor
Enjoy!

Last edited by TheLogFather (May 16, 2015 08:43:55)
- koopa_land
-
Scratcher
100+ posts
costume name
Did you mean
Workaround
(costume name :: looks)
Workaround
([Costume name v] of [wanted sprite (really) v])
- stickfiregames
-
Scratcher
1000+ posts
costume name
Did you meanRead the above posts, that workaround doesn't work for clones which is why this was suggested.(costume name :: looks)
Workaround([Costume name v] of [wanted sprite (really) v])
- DaSpudLord
-
Scratcher
1000+ posts
costume name
No support because of-
Actually, you can get the costume name of the sprit by using this:Or, if that doesn't work for you, then the([costume name v] of (join [sprite] [name] ))
(costume #)block should suffice. But, if you really need the costume name instead of the number, an index list with the names of every costume matched to the costume number will do the job just as well.
- Meese123
-
Scratcher
100+ posts
costume name
Technically workaroundable:
set [costume name v] to (item (costume #) of [costume names v]
- Discussion Forums
- » Suggestions
-
» costume name


















