Discuss Scratch
- Discussion Forums
- » Suggestions
- » Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)
- Redciao
-
Scratcher
8 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!
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 (Sept. 11, 2026 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
also variables are fine as it is right now
Last edited by I_wantasheep (Sept. 11, 2026 11:11:07)
- Redciao
-
Scratcher
8 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!
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?
How can you access the newly created variables in the code?
[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
-
Scratcher
8 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!
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 (Sept. 11, 2026 14:27:50)
- Redciao
-
Scratcher
8 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 (Sept. 11, 2026 14:33:51)
- Redciao
-
Scratcher
8 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)
Thanks again @nembence!
(Note: “code list” means that these blocks only work with the lists created by the extension blocks)
Last edited by Redciao (Sept. 11, 2026 14:41:42)
- BW_CA_26
-
Scratcher
37 posts
Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)
This seems useful, I support this!
- Redciao
-
Scratcher
8 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
100+ 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)
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 (Sept. 11, 2026 20:58:52)
- Redciao
-
Scratcher
8 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..)
(and that can create a variable/list named with an input, like “answer”, “username” etc..)
Last edited by Redciao (Sept. 12, 2026 10:58:30)
- medians
-
Scratcher
1000+ posts
Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)
It would also be nice to have variables that auto-delete at the end of a script or after a loop ends, sorta like this:
define type (text) and end after (t) seconds
set [msg] to []::#0869c2//creates the variable with that value set
set [index] to [0]::#0869c2
repeat (length of (text))
change [index] by (1)::#0869c2
set [letter] to (letter (get [index]::#0869c2) of (text))::#0869c2
set [msg] to (join (get [msg]::#0869c2) (get [letter]::#0869c2))::#0869c2
say (get [msg]::#0869c2)
wait (0.04) seconds
end
say (text) for (t) seconds
Last edited by medians (Sept. 14, 2026 17:42:24)
- knowitall1237
-
Scratcher
100+ posts
Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)
so basically just temporary variables?
massive support, it would make code cleaner
I usually put large math equations into a variable I can use later in the script, but its not something I would need to keep for very long. right now I just make one or two “temp” variables that I assign to whatever, but that gets a bit messy. also, its annoying to make an entire separate variable as an increment for loops.
massive support, it would make code cleaner
I usually put large math equations into a variable I can use later in the script, but its not something I would need to keep for very long. right now I just make one or two “temp” variables that I assign to whatever, but that gets a bit messy. also, its annoying to make an entire separate variable as an increment for loops.
- Redciao
-
Scratcher
8 posts
Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)
thanks @knowitall1237! yes, the objective of the extension is what you have said!
- BotLuv
-
Scratcher
56 posts
Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)
Support!
(Also here is a temporary workaround I was inspired to make because of this post: https://scratch.mit.edu/projects/1381391436 ) (4 now)
(Also here is a temporary workaround I was inspired to make because of this post: https://scratch.mit.edu/projects/1381391436 ) (4 now)
- Discussion Forums
- » Suggestions
-
» Extension Suggestion: "Variables and Lists in the Code!" (Compact 2-Block Design)