Discuss Scratch

Scratch_Mapping
Scratcher
100+ posts

Previous costume

workaround
switch costume to ((costume #) - (1))
DadOfMrLog
Scratcher
1000+ posts

Previous costume

Lythium wrote:

NanoRook wrote:

switch costume to ((costume #) - (1))

No support.
Let's remove
next costume

because
switch costume to ((costume #) + (1))

I think it's worth remembering and considering that Scratch's purpose is not primarily to provide a ‘fully-featured’ programming language. Instead, its purpose is to help teach some of the fundamental things you need to know to be able to learn to code.

I'd suggest one of those things is learning to think in an algorithmic way – i.e. starting from what it is that you want to happen, and then figuring out how to ‘map’ that onto the scripting syntax (i.e. blocks) that are provided.


If you think about that, then it makes a degree of sense that Scratch has “next costume”, but doesn't have “previous costume”.

Having a single block named “next costume” makes you actually want a “previous costume” block. –But then you look and discover there isn't one! So you have to think about how you can use the blocks provided to get that functionality.

And bingo! –You've just had a (very basic) lesson in algorithmic thinking!


So, in summary, it was the existence of the “next costume” block that gave the ‘seed’ of the idea for “previous costume” (though it would've probably arrived eventually anyway). And it was the non-existence of “previous costume” that meant you had to actually construct an algorithm for it (albeit a very simple one) using the existing blocks.

All very clever, I think…


However, for completeness (for those who may not have noticed it already mentioned in previous posts, even recently), here's a slightly unusual and surprising alternative solution:


https://scratch-mit-edu.ezproxyberklee.flo.org/projects/69273706/

Last edited by DadOfMrLog (Feb. 21, 2017 19:48:33)

stickfiregames
Scratcher
1000+ posts

Previous costume

Scratch_Mapping wrote:

rejected
Wait, do people still think this is rejected? (it's not)

Support for
switch costume to [previous costume v]
to be available from the dropdown without having to mess around with costume names.
kenny2scratch
Scratcher
500+ posts

Previous costume

Sigh… I hate sarcasm on Scratch because it's not what Scratch is about.

Yes, this has been rejected because of its simple workaround,
switch costume to ((costume #) - (1))
The objection being raised here to this workaround is that
switch costume to ((costume #) + (1))
could also be a workaround for “next costume”.

I personally support this suggestion, despite the workaround, because of what we have in the Stage:
switch backdrop to [next backdrop v]
switch backdrop to [previous backdrop v] :: #8000ff // I'm highlighting this with a different color to emphasize
I say, if we have this in the Stage, why not in sprites as well? Instead of having
switch costume to [costume1 v]
next costume
switch costume to ((costume #) - (1))
we could have
switch costume to [costume1 v]
switch costume to [next costume v]
switch costume to [previous costume v]
which would improve cleanliness of scripts considerably.

Thanks for your time.
stickfiregames
Scratcher
1000+ posts

Previous costume

kenny2scratch wrote:

Yes, this has been rejected because of its simple workaround,
No it hasn't, please check your facts before you post.
MathlyCat
Scratcher
1000+ posts

Previous costume

stickfiregames wrote:

Scratch_Mapping wrote:

rejected
Wait, do people still think this is rejected? (it's not)

Support for
switch costume to [previous costume v]
to be available from the dropdown without having to mess around with costume names.
and thus my signature applies
braxbroscratcher
Scratcher
1000+ posts

Previous costume

zacadoole1 wrote:

I think we need this block because I don't think new Scratchers (and when I say new Scratchers I mean true beginners, not just people with the rank new Scratcher) are going to be able to easily figure out NoxSpooth's solution, being new Scratchers and all and not being completely familiar with all the blocks and their functions (especially custom blocks). That being said, I half-support, because I don't think we need an entirely new block for it, maybe just a change to the current “next costume” block to add a dropdown for next or previous costume?
[next v] costume ::looks
[previous v] costume ::looks
… so you say most starters on scratch don't understand that the costumes are listed numerically and that they don't understand what subtraction is?
stickfiregames
Scratcher
1000+ posts

Previous costume

braxbroscratcher wrote:

zacadoole1 wrote:

I think we need this block because I don't think new Scratchers (and when I say new Scratchers I mean true beginners, not just people with the rank new Scratcher) are going to be able to easily figure out NoxSpooth's solution, being new Scratchers and all and not being completely familiar with all the blocks and their functions (especially custom blocks). That being said, I half-support, because I don't think we need an entirely new block for it, maybe just a change to the current “next costume” block to add a dropdown for next or previous costume?
[next v] costume ::looks
[previous v] costume ::looks
… so you say most starters on scratch don't understand that the costumes are listed numerically and that they don't understand what subtraction is?
I'd say the fact that you can use numbers in the dropdown isn't very obvious, because it lists costumes by their name. When I started I didn't know you could put reporters in the dropdown at all, even if you used names.
WolfCat67
Scratcher
1000+ posts

Previous costume

(No longer a duplicate; the suggestions have been merged! Don't mind this post.)

Last edited by WolfCat67 (March 16, 2017 23:29:08)

Lythium
Scratcher
1000+ posts

Previous costume

WolfCat67 wrote:

Duplicate.
THis discussion is way more active than that one.
Paddle2See
Scratch Team
1000+ posts

Previous costume

WolfCat67 wrote:

Duplicate.
Thanks for the link! It does look like this is a duplicate topic so I'll close it to keep the conversation all in one place.

Please use the existing topic in the link above.
DadOfMrLog
Scratcher
1000+ posts

Previous costume

EDIT: Heh… well, the topics have been merged, so what I said below now no longer makes any sense…

But, still, it'd be a good idea to read through this post: https://scratch-mit-edu.ezproxyberklee.flo.org/discuss/post/2461268/

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


Hmmmmmm…!!

Do we really have to go through all the discussion again here that was had in the way more active just-closed duplicate…?

OK, before people start adding to this, I'll just say that it'd be a good idea to read through that other topic:

https://scratch-mit-edu.ezproxyberklee.flo.org/discuss/topic/109538/

(In particular, you may be interested in https://scratch-mit-edu.ezproxyberklee.flo.org/discuss/post/2461268/ as a discussion of why “previous costume” doesn't exist even though “next costume” does, as well a rather novel & surprising workaround!)

Thanks!

Last edited by DadOfMrLog (March 18, 2017 00:50:01)

dvargasews
Scratcher
500+ posts

Previous costume

SFollis wrote:

do switch to costume ((costume #) - 1)
By that logic, we don't need
next costume
because we can use
switch costume to ((costume #) + (1))
.

Last edited by dvargasews (March 17, 2017 23:43:52)

awesome5185
Scratcher
1000+ posts

Previous costume

No support sorry! It's just because the workaround only takes about 10 clicks to do.
jromagnoli
Scratcher
1000+ posts

Previous costume

dvargasews wrote:

SFollis wrote:

do switch to costume ((costume #) - 1)
By that logic, we don't need
next costume
because we can use
switch costume to ((costume #) + (1))
.

DadOfMrLog wrote:

EDIT: Heh… well, the topics have been merged, so what I said below now no longer makes any sense…

But, still, it'd be a good idea to read through this post: https://scratch-mit-edu.ezproxyberklee.flo.org/discuss/post/2461268/

_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
I think he provides an excellent explanation as to why we don't have this block.
LionHeart70
Scratcher
1000+ posts

Previous costume

You can try this:

switch costume to [ v<(costume #) = [-1]>]

It technically already exists, but I do have some support because it may be a little harder to try the block listed above.
WolfCat67
Scratcher
1000+ posts

Previous costume

Like @DadOfMrLog mentioned earlier, you can use a simple workaround that'll work on all projects. Here's how to do it.
  1. Create two costumes; one named “next costume”, and one named “previous costume”.
  2. Drag out two "switch costume to [ v]" blocks.
  3. Set one to “next costume”, and the other to “previous costume”.
  4. Backpack both of those blocks with those options.
  5. Delete the two costumes you made earlier.
  6. Place the blocks from your backpack into your project, and they will work exactly as it looks like it would.
Thelnvoker
Scratcher
100+ posts

Previous costume

There is a simple solution. Just use the script “switch costume to costume # - 1”
Charles12310
Scratcher
1000+ posts

Previous costume

Since costumes can also be identified with numbers (event if the costume names are words), here is a workaround for this:

define previous costume
switch costume to ((costume #) - (1))

Don't worry if the costume numbers are in the negatives, because it switches to the last costume of the sprite if the costume is switched to negative one, etc.

If the next costume block isn't there, this should be useful.

define next costume
switch costume to ((costume #) + (1))

I was also suggesting a “previous backdrop” block:

define previous backdrop
switch backdrop to ((backdrop #) - (1))

If the “change costume/backdrop by ()” block was still here, workarounds for switching to a previous costume/backdrop would be:

define previous costume/backdrop
change costume/backdrop by (-1) :: looks
Charles12310
Scratcher
1000+ posts

Previous costume

Ihaveexpectations wrote:

To everyone who is suggesting the workaround.
The workaround is not simple. To understand how it works, you have to look into the scratch source code to understand what causes the project player to behave in this abnormal way.
Most new scratchers dont even know you can put reporters in dropdowns, and even if they somehow by chance figure it out, how would they know that the switch costume block would switch to the costume number, and not the name? Even more confusing, is that it does also switch to the name of the costume when the input is a string.

This is not a simple workaround.
This is one of the most complex and hard to understand workarounds that requires knowledge of a potentially unintentional behaviour of scratch that could only be found by looking at the scratch code, and to a limited extent understanding how the flash player works.
First of all, they should learn the difference between a string and a reporter. A reporter stores a string. A string is text that you input on a block.

Also, simple workarounds are workarounds that do not use a lot of blocks. The only use at least one or two coding blocks.

Exaggeration won't convince us.

Powered by DjangoBB