Discuss Scratch

Redciao
New Scratcher
7 posts

Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)

Hi, I'm suggesting an extension for advanced users: Dynamic Variables / Lists.

PROBLEM:
Right now you have to create every variable manually in the editor. For procedural games you need to create 50+ variables like “slot_1, slot_2…”. It's messy.

SOLUTION (Extension, so it's optional and doesn't complicate Scratch for beginners):
Only 4 blocks, using text input instead of dropdown (like my screenshot):

- create variable (name)
- delete variable (name)
- set variable (name) to (value)
- (value of variable (name))

Same for lists:
- create list (name)
- add (thing) to dynamic list (name)
- etc…

This would work like a dictionary/map. It keeps the palette clean and allows dynamic data creation.

I already tested the logic and it works on TurboWarp as a custom extension.

What do you think?

Mockup by nembence, thanks!

Last edited by Redciao (Yesterday 22:38:43)

I_wantasheep
Scratcher
1000+ posts

Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)

please divide your text into paragraphs

also variables are fine as it is right now

Last edited by I_wantasheep (Yesterday 11:11:07)

Redciao
New Scratcher
7 posts

Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)

Thank you very much for your opinion! It's just an idea and I want it to be rated by the whole community.
Thanks also for your advice on formatting, it really helped me fix the text. I look forward to seeing what other scratchers think about this.
Thanks @I_wantasheep!
nembence
Scratcher
1000+ posts

Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)

Like this?
[Create / Delete / Rename v] variable []::extension
[Create / Delete / Rename v] list []::extension
[Rename v] variable [] to []::extension

How can you access the newly created variables in the code?
Redciao
New Scratcher
7 posts

Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)

Thanks @nembence! The block design looks perfect! Regarding how to use them during execution: I've thought about this too!

The extension will include two additional blocks designed like this:

- (Set / Change / Show / Hide) variable (variable_name)
- (and for the list there will be the standard blocks of the list but for the extension lists!)

(Note: these two blocks will only work with variables and lists created by the extension to avoid any issues or conflicts with standard ones).

Very thanks for your opinion and your image!

Last edited by Redciao (Yesterday 14:27:50)

Redciao
New Scratcher
7 posts

Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)

[Create / Delete / Rename v] variable [ ] :: extension
[Create / Delete / Rename v] list [ ] :: extension
Rename variable [ ] to [ ] :: extension
Rename list [ ] to [ ] :: extension

[Set / Change / Show / Hide v] variable [ ] to ( ) :: extension

add [ ] to code list [ ] :: extension
delete (1) of code list [ ] :: extension
insert [ ] at (1) of code list [ ] :: extension
replace item (1) of code list [ ] with [ ] :: extension
(item (1) of code list [ ] :: extension)
(length of code list [ ] :: extension)
<code list [ ] contains [ ]? :: extension>
[Show / Hide v] code list [ ] :: extension

Last edited by Redciao (Yesterday 14:33:51)

Redciao
New Scratcher
7 posts

Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)

This is an example of how the extension will look.

Thanks again @nembence!

(Note: “code list” means that these blocks only work with the lists created by the extension blocks)

Last edited by Redciao (Yesterday 14:41:42)

BW_CA_26
Scratcher
33 posts

Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)

This seems useful, I support this!
Redciao
New Scratcher
7 posts

Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)

Very thanks @BW_CA_26! Thanks for your support for this!
supercroissants
New Scratcher
47 posts

Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)

why?? it's fine as is.
medians
Scratcher
1000+ posts

Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)

supercroissants wrote:

why?? it's fine as is.
I don't think this is replacing the current variables and lists entirely. Also, it's useful for making temporary variables (e.g. variables that you only want to exist in custom blocks)

Last edited by medians (Yesterday 20:58:52)

Redciao
New Scratcher
7 posts

Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)

i know that is a “copy” of the standard system of the variables and the lists, but this can create a temporary variable or list and you don't have to create a lot of variables with also a short use in the project
(and that can create a variable/list named with an input, like “answer”, “username” etc..)

Last edited by Redciao (Today 10:58:30)

Powered by DjangoBB