"Create own block" dropdown list

id: 18928

category: Suggestions

posts: 333

Me_Tis Me_Tis loading
My suggestion is simple: that when you create your own block, along with boolean, string and number input, you were allowed to do a dropdown list like this:
define move [direcion]▾
if <(direction)=[up]>
point in direction (0 v)
move (10) steps
end
if <(direction)=[down]>
point in direction (180 v)
move (10) steps
end
when green flag clicked
move [down v]

You would create it like this:
https://www.dropbox.com/s/4t3sqpemud3e0y1/Dropdown%20list.png?dl=0

I would find this very useful (though admittedly my example wasn't very useful)
Any suggestions, improvements or just support?

PS this can be likened to enums in other programming languages.

UPDATE:
I know that this is possible through workarounds, but the entire premise behind scratch is to make programming easy, so a workaround isn't really a solution.
I am suggesting this because I think it will make some things easier, whereas using the workaround makes things harder, and may be intimidating to new programmers.
PullJosh PullJosh loading
Great idea! This was a feature that I always found BYOB (now SNAP) was lacking and needed badly. And now scratch needs it too. Support!
DotDash DotDash loading
Support, doesn't seem to be any duplicates, so nice original idea!
cobraguy cobraguy loading
Support! Just need to come up with a menu that lets edit the values for the dropdown.

Me_Tis wrote:

My suggestion is simple: that when you create your own block, along with boolean, string and number input, you were allowed to do a dropdown list like this:
define move [direcion]
if <(direction)=[up]>
point in direction (0 v)
move (10) steps
end
if <(direction)=[down]>
point in direction (180 v)
move (10) steps
end
when green flag clicked
move [down v]
I would find this very useful (though admittedly my example wasn't very useful)
Any suggestions, improvements or just support?
%d They will be added in future!
I have seen people do it. I can do a number drop down box but thats it!
cked
when random things happen[scratchblocks]
r[/scratchblocks]
do more random things!
chabad360 chabad360 loading
funny that was a suggestion I bought up a while ago along with the custom blocks being global meaning they can be declared once but used in every sprite.
Deerleg Deerleg loading
Support! Good idea!

PullJosh wrote:

Great idea! This was a feature that I always found BYOB (now SNAP) was lacking and needed badly. And now scratch needs it too. Support!
BYOB is now called SNAP? (off topic)
spgame05 spgame05 loading
Support!

Deerleg wrote:

BYOB is now called SNAP? (off topic)
Yep!
derpmeup derpmeup loading
Support! There is a way to get hacked custom blocks, but it isn't easy.

Me_Tis wrote:

Any suggestions, improvements or just support?
Support.

The Unicode white down-pointing small triangle (U-25BF) could be used to indicate the dropdown variable.

define move [direction ▿]
if <(direction ▿)=[up]>
point in direction (0 v)
end
if <(direction ▿)=[down]>
point in direction (180 v)
end
move (10) steps

when green flag clicked
move [up v]
move [down v]
c1ff c1ff loading
Yes Yes Yes Yes Yes Yes Yes Yes YES!!!!!!!!!!!!

I supports this cause!

say [YES!!!!!] for (inf.) secs
Me_Tis Me_Tis loading
Yay! Lots of support!!!
Me_Tis Me_Tis loading

TimothyLawyer wrote:

Me_Tis wrote:

Any suggestions, improvements or just support?
Support.

The Unicode white down-pointing small triangle (U-25BF) could be used to indicate the dropdown variable.

define move [direction ▿]
if <(direction ▿)=[up]>
point in direction (0 v)
end
if <(direction ▿)=[down]>
point in direction (180 v)
end
move (10) steps

when green flag clicked
move [up v]
move [down v]
Makes sense… the only thing is that although the input method for a dropdown input would be different it would behave pretty much like a string, so maybe it doesn't need an arrow symbol.. Although if this makes it easier to understand for beginners then I guess so…

Me_Tis wrote:

TimothyLawyer wrote:

The Unicode white down-pointing small triangle (U-25BF) could be used to indicate the dropdown variable.

define move [direction ▿]
if <(direction ▿)=[up]>
point in direction (0 v)
end
if <(direction ▿)=[down]>
point in direction (180 v)
end
move (10) steps

when green flag clicked
move [up v]
move [down v]
Makes sense… the only thing is that although the input method for a dropdown input would be different it would behave pretty much like a string, so maybe it doesn't need an arrow symbol.. Although if this makes it easier to understand for beginners then I guess so…

True.

When I saw your example it helped me to think about how this could be done.

define move [direction]

gave me an expectation of

move [ ] ::custom

//or

move () ::custom

but not

move [down v] ::custom

as the block it would define.

So a new solution occurs to me.

define move [direction] ▾ 






move [down v] ::custom
ScratchBlocks doesn't support v for a drop-down menu for the define block.

So the v is Unicode black down-pointing small triangle (U+25BE).

Clicking on the in the define block (where it's white) would show a menu of lists.

Select a list and the items of the list become the options in the drop-down menu in the custom block.

A blank list item would produce a non-selectable separator line (the black bar).

A list item of the form (number) string would produce menu options like in the direction block.

Thus, each drop-down menu in a custom block would be defined by a Scratch list.

Easy-peasy
Failord Failord loading
You can actually hack to do this, (don't ask me how) but the hack doesn't let you do anything with it. There's also the problem of filling up the dropdown, assuming they non-hack implement it. For now, reporters and strings work fien.

If we can get a good, simple way for this to be added, then you have my support.
Me_Tis Me_Tis loading

TimothyLawyer wrote:

I think your suggestion is almost perfect. The only thing I disagree with is having the create a block reliant on a scratch list. I was thinking more of a menu similar to the current “create a block” menu - like this:
https://dl.dropboxusercontent.com/u/17754076/Scratch/Dropdown%20list.png
AonymousGuy AonymousGuy loading
Should they maybe be called enumerations, like they are in real programming languages?
Quixotic Quixotic loading
LOVE THAT IDEA!
Should definitely be implemented!

Very original!
PH-zero PH-zero loading
Awsome! I definetly support!
Oh, and this came into my mind
define move (direcion = [up v]) //appearently the parser can't recognize the [up v] =)
if <direction =[up v]> //the red reporters should be custom-block-colored but i didn't get it to work
point in direction (0 v)
move (10) steps
end
if <direction =[down v]>
point in direction (180 v)
move (10) steps
end
when green flag clicked
move [down v] //category=custom
You could add/remove enumerations (list-entrys) by right-clicking on the block and then choose “edit”.
Tikolu Tikolu loading
There should be
move (up v)  //It should be dark purple )=
also.
Me_Tis Me_Tis loading

AonymousGuy wrote:

Should they maybe be called enumerations, like they are in real programming languages?
If it isn't too confusing for beginners… shall I suggest it on the original post?
Me_Tis Me_Tis loading

PH-zero wrote:

Awsome! I definetly support!
Oh, and this came into my mind
define move (direcion = [up v]) //appearently the parser can't recognize the [up v] =)
if <direction =[up v]> //the red reporters should be custom-block-colored but i didn't get it to work
point in direction (0 v)
move (10) steps
end
if <direction =[down v]>
point in direction (180 v)
move (10) steps
end
when green flag clicked
move [down v] //category=custom
You could add/remove enumerations (list-entrys) by right-clicking on the block and then choose “edit”.
Another good suggestion…
the workaround is too easy. Do a string where you want the dropdown. Then, in the string on the block, put in the direction, then make the appropriate changes to the definition.
Me_Tis Me_Tis loading

VoltageGames wrote:

the workaround is too easy. Do a string where you want the dropdown. Then, in the string on the block, put in the direction, then make the appropriate changes to the definition.
The whole point of programming languages (especially scratch) is to make programming easy. Using workarounds is annoying. If you wanted to do that kind of thing, you may as well be programming in assembly (http://en.wikipedia.org/wiki/Assembly_language)
minirag minirag loading
I support

The ST should add this!
Supporrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrt.

Support

I mean, I wouldn't have suggested this if I didn't like it!

TimothyLawyer wrote:

Me_Tis wrote:

Any suggestions, improvements or just support?
Support.

The Unicode white down-pointing small triangle (U-25BF) could be used to indicate the dropdown variable.

define move [direction ▿]
if <(direction ▿)=[up]>
point in direction (0 v)
end
if <(direction ▿)=[down]>
point in direction (180 v)
end
move (10) steps

when green flag clicked
move [up v]
move [down v]
Failord Failord loading
I have a new idea! You guys are going to hate this! Instead of "move [left v],“ you could make x number of custom blocks like this: ”move left“ ”move right“ move up” move down"

Thotz?

Failord wrote:

I have a new idea! You guys are going to hate this! Instead of "move [left v],“ you could make x number of custom blocks like this: ”move left“ ”move right“ move up” move down"

Thotz?
What if you have 100 variables in your project and you want a custom block to change one? You would need a lot of custom blocks.




__ __ __ _ __ __
/___ | | |__||__| / \ |__| | |
___/ \_/ | | \__/ | \ | .

pro4life pro4life loading
cool! great Idea!
chabad360 chabad360 loading
im working on a way to get custom menus in JSON, it will take a while and at this point i just started so…
I think that there should be pre-defined lists, for instance a list of all variables, or a list of all sprites. Why else would you need it?

theonlygusti wrote:

I think that there should be pre-defined lists, for instance a list of all variables, or a list of all sprites. Why else would you need it?
Blocks like
set rotation style [left-right v]
stop [all v]
have dropdowns exclusive to themselves, so it is possible that custom blocks would also need their own.
RPFluffy RPFluffy loading
Support, I would love the idea because then we could have multiple outputs in custom blocks!
xela888 xela888 loading
THANKS!!!!!!!!!!!!!!!!!!!!!!!!!!!! It helps me a ton!!!!!!!!!!!!!!!!!!!!!!
How do you type the dropdown symbol?

little_kitten wrote:

How do you type the dropdown symbol?
Type a space and the letter v (lowercase) in between [ ].
choose [item 1 v] :: custom 
Xelophelt Xelophelt loading
This is actually a really good idea. Support.
Me_Tis Me_Tis loading

chabad360 wrote:

im working on a way to get custom menus in JSON, it will take a while and at this point i just started so…
sounds good…
hornbeef hornbeef loading

derpmeup wrote:

Support! There is a way to get hacked custom blocks, but it isn't easy.
how?
when green flag clicked
say [tell me pleeeese??:/] for (2) secs