Discuss Scratch

lolguy416859
Scratcher
5 posts

A New Block Idea!

([ v] Appears in list x times:: list)

Thats The Concept, To Detect How Many Times A Certian Thing Is In A List, Ex: If You Have 1, 1 And 2 On A List, Ill Detect If There Are 2 Ones, If There Are, Remove Them And Put A 2, Same For 2 As Well

( I Know The Name I Gave It Isnt That Good, You Can Name It Whatever You Want If Anyone Even Sees This)

Last edited by lolguy416859 (Oct. 21, 2017 05:12:40)

DaEpikDude
Scratcher
1000+ posts

A New Block Idea!

So you mean
(amount of [item] in [list v]::list)
Yeah, it seems simple enough, but are there really that many times where it's useful?
I'll say semi-support for now. wow this is my first semi-support in forever

And all the world over, each nation's the same,
They've simply no notion of playing the game.
They argue with umpires, they cheer when they've won,
And they practice beforehand, which ruins the fun!
njb14
Scratcher
100+ posts

A New Block Idea!

There's probably a workaround, but a single block would be a lot easier… semi-support, because as DaEpikDude said, there aren't many times where you'd use it.

he/him ♕ art student ♕ scottish
Charles12310
Scratcher
1000+ posts

A New Block Idea!

I'm sure this would be useful.

Or you can do something like this:

define find number of (string) from list (list)
set [item v] to [0]
set [count v] to [0]
repeat (length of (list) :: list )
change [item v] by (1)
if <(item (item) of (list)) = (string)> then
change [count v] by (1)
end
end

Last edited by Charles12310 (Oct. 21, 2017 16:21:03)



A few internet communication companies want to corrupt the internet by getting rid of net neutrality. Stop Them!
--Waterfall--
Scratcher
500+ posts

A New Block Idea!

Eh… Semi-Support.


lolguy416859
Scratcher
5 posts

A New Block Idea!

Charles12310 wrote:

I'm sure this would be useful.

Or you can do something like this:

define find number of (string) from list (list)
set [item v] to [0]
set [count v] to [0]
repeat (length of (list) :: list )
change [item v] by (1)
if <(item (item) of (list)) = (string)> then
change [count v] by (1)
end
end

Thanks for a workaround, though it would be cool as a regular block, thanks though

Last edited by lolguy416859 (Oct. 21, 2017 19:38:46)

lolguy416859
Scratcher
5 posts

A New Block Idea!

DaEpikDude wrote:

So you mean
(amount of [item] in [list v]::list)
Yeah, it seems simple enough, but are there really that many times where it's useful?
I'll say semi-support for now. wow this is my first semi-support in forever
Yeah, that's a better name for it, I guess your right about about usefulness though, I was thinking for a crafting system, like, if “wood” is in a list at least 3 times, remove them and add “door” to a list

Powered by DjangoBB