New addon: editor-copy-scratchblocks#7988
New addon: editor-copy-scratchblocks#7988just-a-hriday wants to merge 36 commits intoScratchAddons:masterfrom
editor-copy-scratchblocks#7988Conversation
|
This addon has already been submitted in #7748 but I haven't checked the differences in the implementation yet. |
Hmm. Mine only supports english, but does give better (and less buggy) output. Also, there's another implementation that might be possible - just reading the fields in the blocks instead of hardcoding everything. This would give complete language support too. I tried this a while ago when the forums were still using 2.0 scratchblocks. It didn't work, because a lot of 3.0 blocks have different text from their 2.0 counterparts, and language support was an issue too - but I think it could work with the 3.0 scratchblocks. |
|
@WorldLanguages could you review? |
|
If this will only support English, it might be a good thing to add a note to the addon explaining that that's intentional (for users of other languages)? |
Fixed. |
I don't think it's necessary to clarify that.
Sure, looks alright to me. Something along the lines of |
|
This conflicts with the other There are advantages of both versions of the addon. My addon uses the parse-sb3-blocks library by apple502j for block conversion, it has a few bugs but support for (almost?) every block and language in the Scratch editor. On the other hand, hriday's addon accesses blocks more directly and uses less code, but does not support other languages. I think language support is important for non-English Scratchers who write Forum posts, Scratch Wiki pages and other things, though most parts of the Forums only support blocks in English. It's fine if you want to use this version of the addon instead of mine. I just don't know if I should keep working on this or not. |
…editor-copy-scratchblocks
Co-authored-by: Samq64 <81489795+Samq64@users.noreply.github.com>
|
@Samq64 How should I add support for turbowarp blocks? Is there a way to check whether the addon is being run in turbowarp? It doesn't make much sense to add hardcoded turbowarp blocks inside the scratch editor too. |
|
I think mainatining |
|
The mapping is significantly simpler for turbowarp. With vanilla scratch blocks you have to work around all the inconsistencies and idiosyncrasies of scratchblocks. With the turbowarp blocks you have to override them all to make them render correctly anyways, so it's much simpler. In fact I think it's possible to automate mapping the extension blocks, and I believe that's the best solution here. For turbowarp blocks Lu Yifei's approach works well too. However it is not reliable for vanilla scratch blocks, so a complicated hybrid approach would have to be used in order to use that method for turbowarp extension blocks and mine for the vanilla blocks. On the other hand there's no need to build mappings for those 100+ extensions if it's done that way. |
|
If you used the scratch-translations then you'll get most of the mapping for free. But it would require quite a large change to how you're doing things. It is quite a different approach to things. But you should be able to do most of it dynamically instead of having to hardcode things anymore. |


Resolves #2336
Closes #7748
Closes #8572
Changes
Adds an addon that converts blocks in the editor to forums scratchblocks code.
Supports all obsolete blocks and handles all edge cases.
Known issues
Comments are not included in the output because scratchblocks only allows you to add comments to outer blocks (so comments on reporters inside other blocks, for example, can't be included), and long comments get cut off.Scratchblocks doesn't support matrix inputs (the ones used in micro:bit), so they get outputted as dropdowns containing a numerical representation of the matrix.
⬇️
Reason for changes
Makes it much easier to post scripts in the forums.
Tests
Testing with Chrome v131.0.6778.109 on 64 bit Windows.