Discuss Scratch

mister_dazzling
Scratcher
100+ posts

Amount of (item) in (list) variable

(amount of [thing] in [list v])
I think that this block would be very useful for games such as shopping games or card games. I've seen this brought up, but not actually suggested. While it is possible for one to make this variable themselves, it is a complicated process and it could make things much simpler for many Scratchers if this was added. Scratch Team, please take this block under consideration if you think the same!

Hey, nice to meet you! I like creating funny and surreal animations that also have story, action and emotion. I also allow advertisements on my profile!

I love jazz music, sea shanties and traditional Scottish music

I'm known as “Valdriks the Jazzborn” outside of Scratch.

Club Penguin Christmas music
Maximouse
Scratcher
1000+ posts

Amount of (item) in (list) variable

Workaround:

set [i v] to (0)
set [count v] to (0)
repeat (length of [list v])
change [i v] by (1)
if <(item (i) of [list v]) = [thing]> then
change [count v] by (1)


This is Maximouse's signature. Learn more about signatures.
mister_dazzling
Scratcher
100+ posts

Amount of (item) in (list) variable

Maximouse wrote:

Workaround:

set [i v] to (0)
set [count v] to (0)
repeat (length of [list v])
change [i v] by (1)
if <(item (i) of [list v]) = [thing]> then
change [count v] by (1)
Yes. This was just a suggestion to make that in to a block, though, as you and I have both stated, there is a workaround. The block would mostly help make lists a bit simpler for young Scratchers.

Last edited by mister_dazzling (April 7, 2020 00:59:55)


Hey, nice to meet you! I like creating funny and surreal animations that also have story, action and emotion. I also allow advertisements on my profile!

I love jazz music, sea shanties and traditional Scottish music

I'm known as “Valdriks the Jazzborn” outside of Scratch.

Club Penguin Christmas music
Paddle2See
Scratch Team
1000+ posts

Amount of (item) in (list) variable

It looks like this is a duplicate topic of this one over here so I'll close it to keep the conversation all in one place.

Please use the existing topic in the link above.

Scratch Team Member, kayak and pickleball enthusiast, cat caregiver.

This is my forum signature! On a forum post, it is okay for Scratchers to advertise in their forum signature. The signature is the stuff that shows up below the horizontal line on the post. It will show up on every post I make.
(credit to Za-Chary)



;

Powered by DjangoBB