Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to find out the amount of certain items in a list
- Bord89
- Scratcher
1 post
How to find out the amount of certain items in a list
Im trying to make a game and I the inventory list to be like “Name x4”
Im trying to get the amount of said Name via list but it just doesn't work, can anybody help??
Im trying to get the amount of said Name via list but it just doesn't work, can anybody help??
Last edited by Bord89 (March 25, 2024 03:14:13)
- malicondii
- Scratcher
100+ posts
How to find out the amount of certain items in a list
set [i v] to (1)
set [count v] to (0)
repeat (length of [list v])
If <(item (I) of [list v]) = (whatever)> then
Change [count v] by (1)
end
change [i v] by (1)
end
Last edited by malicondii (March 25, 2024 03:30:10)
- Wolf_Link21
- Scratcher
100+ posts
How to find out the amount of certain items in a list
I think I did what you wanted. https://scratch.mit.edu/projects/988969591/
This is dave
:D :: hat :: motionHe protects my from evil kumquats.
Please follow me if you find my response helpful and give me any ideas for my game https://scratch.mit.edu/projects/992371983/
- Discussion Forums
- » Help with Scripts
- » How to find out the amount of certain items in a list