scratchfoundation / scratch-blocks

Scratch Blocks is a library for building creative computing interfaces.
https://scratch.mit.edu/developers
Apache License 2.0
2.58k stars 1.38k forks source link

How can I make a "copy list (A) into list (B)" custom block? #1866

Open towerofnix opened 5 years ago

towerofnix commented 5 years ago

Suppose I want to create a custom block which takes all the items in a given list and copies them into another given list. Hypothetically speaking, this is a quite simple - but useful - custom block:

"define copy items of (list A) into (list B): set index to 0; repeat (length of (list A)): add (item (index) of (list A)) to (list B); change index by 1"

However, it is impossible to drag blocks into list dropdowns, and therefore impossible to create a general custom block like this.

In a very real sense, no general custom blocks which apply to lists can be created. This is a barrier for teaching the uses of custom blocks and a hindrance to anybody who would otherwise make use of such custom blocks.

See also LLK/scratch-parser#47, which may be required or useful in allowing blocks to be placed into list dropdowns. Also see #1805, which recommends adding a "sprite dropdown" input type - in the same way, adding a "list dropdown" input type would be useful for general custom blocks like this.

apple502j commented 5 years ago

See also LLK/scratch-vm#1030

thisandagain commented 5 years ago

/cc @carljbowman @kchadha @ericrosenbaum

Wowfunhappy commented 1 year ago

See also: https://github.com/LLK/scratch-gui/issues/2194