Discuss Scratch
- Discussion Forums
- » Developing Scratch Extensions
- » Scratch 3 Dictionary (Key/Value) Extension
- JGames101
-
Scratcher
100+ posts
Scratch 3 Dictionary (Key/Value) Extension
This extension adds new blocks to allow for scratch to have Maps/Dictionaries, like most programming languages. The name is undecided, as “Map” may make people think that it gives a map of a location. It's currently dictionary, but that might give users the idea that it give you word definitions.
New Blocks:
Issues:
You can try it using @Sheep_tester's Scratch 3 Extensions Loader at https://sheeptester.github.io/scratch-gui/?url=https://jamesbmadden.github.io/scratch-extensions/dictionary-stable.js

New Blocks:
set [hello] of [my dictionary v] to [world] :: #ef5350 // Sets key (hello) of dictionary to value (world)
change [hello] of [my dictionary v] by [!] :: #ef5350 // Will add to a number or add on to the end of a string
get [hello] of [my dictionary v] :: #ef5350 reporter // "world!"
[my dictionary v] :: #ef5350 reporter
// All inputs accept variables!
Issues:
- You can't yet add a new dictionary, “my dictionary” is the only choice
- Scratch 3 has a bug where reporters from URL extensions don't work. I'll be looking into that more
- Dictionaries are not saved to the project. I'm looking into how to get around that.
You can try it using @Sheep_tester's Scratch 3 Extensions Loader at https://sheeptester.github.io/scratch-gui/?url=https://jamesbmadden.github.io/scratch-extensions/dictionary-stable.js

Last edited by JGames101 (March 27, 2019 19:24:58)
- clawthirtythree
-
Scratcher
100+ posts
Scratch 3 Dictionary (Key/Value) Extension
What's the point of the
change [hello] of [my dictionary v] by (1)block? Seems kinda useless since you can just use join
- JGames101
-
Scratcher
100+ posts
Scratch 3 Dictionary (Key/Value) Extension
What's the point of theYeah, but variables have that block, and the idea is to emulate the variable blocks, so if you're making a counter, for example, you can writechange [hello] of [my dictionary v] by (1)block? Seems kinda useless since you can just use join
change [index] of [my dictionary v] by (1) :: #ef5350instead of
set [index] of [my dictionary v] to ((get [index] of [my dictionary v] :: #ef5350) + (1)) :: #ef5350
also, reporters currently don't work properly on URL extensions in Scratch 3, so would be unable to do the latter anyway.
Last edited by JGames101 (Jan. 6, 2019 02:17:20)
- venyanwarrior
-
Scratcher
1000+ posts
Scratch 3 Dictionary (Key/Value) Extension
Any way I can see the extension code? I'm trying to get into making Scratch extensions and I'm looking at 3.0 extensions to see how they work.
Last edited by venyanwarrior (Jan. 11, 2019 18:33:32)
- JGames101
-
Scratcher
100+ posts
Scratch 3 Dictionary (Key/Value) Extension
Any way I can see the extension code? I'm trying to get into making Scratch extensions and I'm looking at 3.0 extensions to see how they work.Here's the code:
https://gist.githubusercontent.com/jamesbmadden/a94227a2e1aaa467032649f9c87fa3f7/raw/843d8d0c03ffd958da93ba51d45acf56d1343a0d/dictionary.js
Ignore the icon variable at the top, it's an image encoded as a string.
Last edited by JGames101 (March 3, 2019 02:51:09)
- HarmonyCalcium
-
Scratcher
18 posts
Scratch 3 Dictionary (Key/Value) Extension
Sorry to bother you, but I'm quite new to Scratch 3.0 extensions. How do I load external extension like this to my project?
- JGames101
-
Scratcher
100+ posts
Scratch 3 Dictionary (Key/Value) Extension
Sorry to bother you, but I'm quite new to Scratch 3.0 extensions. How do I load external extension like this to my project?Scratch 3 currently has no way to load Unofficial Scratch Extensions. That will be coming later this year. For now, you can use https://sheeptester.github.io/scratch-gui to load extensions. Just press the extensions button (blue button in bottom left), select “choose an extension”, and paste a URL to a JavaScript file for the extension.
- HarmonyCalcium
-
Scratcher
18 posts
Scratch 3 Dictionary (Key/Value) Extension
Ty! I'm so excited to find out this! I will try making some extensions now!Sorry to bother you, but I'm quite new to Scratch 3.0 extensions. How do I load external extension like this to my project?Scratch 3 currently has no way to load Unofficial Scratch Extensions. That will be coming later this year. For now, you can use https://sheeptester.github.io/scratch-gui to load extensions. Just press the extensions button (blue button in bottom left), select “choose an extension”, and paste a URL to a JavaScript file for the extension.
- JGames101
-
Scratcher
100+ posts
Scratch 3 Dictionary (Key/Value) Extension
DuplicateThis isn't a suggestion, so it's not a duplicate, nor is it an actual dictionary. It's a Scratch 3 Extension for the Programming term dictionary, which is a series of key/value pairs.
.
- JoshyRobot
-
Scratcher
25 posts
Scratch 3 Dictionary (Key/Value) Extension
Hey! This is a pretty cool extension, and one I tried to make a while back. The issue I assume you're facing is that Scratch wont update the menu listing the dictionaries, and that's why only one works. Well, after some digging around in the code, I found a solution! Instead of calling the function to get the list (MAPS: this._getMaps()) you should just put the name of the function (MAPS: “_getMaps”). It should fix the issue!
- JGames101
-
Scratcher
100+ posts
Scratch 3 Dictionary (Key/Value) Extension
Hey! This is a pretty cool extension, and one I tried to make a while back. The issue I assume you're facing is that Scratch wont update the menu listing the dictionaries, and that's why only one works. Well, after some digging around in the code, I found a solution! Instead of calling the function to get the list (MAPS: this._getMaps()) you should just put the name of the function (MAPS: “_getMaps”). It should fix the issue!It breaks without the call. I think Scratch is expecting an Array there, not a function, so it breaks without an invocation.
- JGames101
-
Scratcher
100+ posts
Scratch 3 Dictionary (Key/Value) Extension
The code seems to be expecting a function (If I put in anything other than an array or function there's an error trying to call the other type, which obviously you can't do) so I don't know why it's not working… The _getMaps() function definitely returns the right format… idk.Hey! This is a pretty cool extension, and one I tried to make a while back. The issue I assume you're facing is that Scratch wont update the menu listing the dictionaries, and that's why only one works. Well, after some digging around in the code, I found a solution! Instead of calling the function to get the list (MAPS: this._getMaps()) you should just put the name of the function (MAPS: “_getMaps”). It should fix the issue!It breaks without the call. I think Scratch is expecting an Array there, not a function, so it breaks without an invocation.
- -Rex-
-
Scratcher
500+ posts
Scratch 3 Dictionary (Key/Value) Extension
Perhaps you may want to consider using a Map instead of an object… “__proto__” starts out as an empty dictionary (when it shouldn't even exist).
- Locness
-
Scratcher
100+ posts
Scratch 3 Dictionary (Key/Value) Extension
Hi,
This is an awesome thing! But, question : You can store a dictionnary into a variable, but can you do the reverse operation, parsing a variable storing a dictionnary as a dictionnary?
This is an awesome thing! But, question : You can store a dictionnary into a variable, but can you do the reverse operation, parsing a variable storing a dictionnary as a dictionnary?
- GuineaGod
-
Scratcher
500+ posts
Scratch 3 Dictionary (Key/Value) Extension
Hi,
This is an awesome thing! But, question : You can store a dictionnary into a variable, but can you do the reverse operation, parsing a variable storing a dictionnary as a dictionnary?
Maybe,
but that doesn't really make sense.
Like your thinking though!

- MikeDEV
-
Scratcher
1000+ posts
Scratch 3 Dictionary (Key/Value) Extension
I love the extension and the idea. Why not suggest it in RichieNB's 3.0 extensions directory?
also, @daneq_qwerty, please don't blockspam.
also, @daneq_qwerty, please don't blockspam.
Last edited by MikeDEV (Jan. 3, 2021 16:23:55)
- RichieNB
-
Scratcher
71 posts
Scratch 3 Dictionary (Key/Value) Extension
Now listed in the extension directory!
- CrokerCode
-
Scratcher
85 posts
Scratch 3 Dictionary (Key/Value) Extension
<error (...)>For scratch
Last edited by CrokerCode (May 8, 2021 18:01:52)
- CrokerCode
-
Scratcher
85 posts
Scratch 3 Dictionary (Key/Value) Extension
wait until <error (...)>this is a example
Last edited by CrokerCode (May 8, 2021 18:02:05)
- Discussion Forums
- » Developing Scratch Extensions
-
» Scratch 3 Dictionary (Key/Value) Extension