Discuss Scratch

50_scratch_tabs
Scratcher
500+ posts

How to make Scratch extensions whose projects can be opened in normal scratch?

How can I modify Scratch-GUI to make Scratch extensions whose blocks show up as custom blocks when a project is opened in regular scratch? Kind of like the
<Is TurboWarp? :: custom>
block… It can be imported into regular scratch, it just won't do anything.

Highlight this text and Shift+Down for more fun!

If my post is helpful and/or inspirational, please consider following me. If not, please consider following me.
I make awesome stuff in Python, Scratch, and PHP. If I'm feeling patient, I create decent stuff in C/C++. I create awesome stuff in Minecraft, but I don't care about making it look cool.
I don't mind if you post off-topic replies on my profile, but please don't post links to posts you think I missed. I follow every topic I post in, and I'm often too busy to be on Scratch.

I used to have the 9000th post on TOLORS.
My first post was an accident
Interesting comment thread


Tic-tac-toe :: events hat
(1::grey) (X:: variables) (3::grey):: stack grey
(4::grey) (O:: sensing) (6::grey):: stack grey
(X:: variables) (O:: control) (X :: variables):: stack grey

Colors :: events hat
50_scratch_tabs \(me) :: variables
8to16 :: sensing
SaberDragon73 :: control
Comment a move on my profile and I will add it.




If you have a signature that requires Shift+down, paste this at the bottom of it. If you actually read this far, you deserve my respect. -50_scratch_tabs
CST1229
Scratcher
1000+ posts

How to make Scratch extensions whose projects can be opened in normal scratch?

The is TurboWarp? block isn't actually an extension block, it's just a custom extension argument reporter.
For the vanilla palette, add something like this to src/lib/make-toolbox-xml.js:
<block type="argument_reporter_boolean"><field name="VALUE">boolean block name</field></block>
or
<block type="argument_reporter_string_number"><field name="VALUE">reporter block name</field></block>
You could also make stack blocks using custom block call blocks:
<block type="procedures_call"><mutation proccode="stack block name" argumentnames="[]" argumentids="[]"></mutation></block>

Then to implement the code, modify the code for the argument reporters/call blocks in scratch-vm. For example, you can look at TurboWarp's code:
implementation in the interpreter
implementation in the compiler

Last edited by CST1229 (Sept. 23, 2024 14:51:04)


This is a signature. It's a piece of text that appears below every post I write. Click here to learn more, including how to make your own.

Getting survey popups that look like this? It's normal, and is a thing the ST is doing. Read this topic for more info.




50_scratch_tabs
Scratcher
500+ posts

How to make Scratch extensions whose projects can be opened in normal scratch?

Can I make this with a Javascript addon? I've never messed with Scratch's default blocks, only created new extensions.

I did in a Scratch-gui mod, not Turbowarp.


Nevermind, reread your post.

Last edited by 50_scratch_tabs (Sept. 23, 2024 21:03:05)


Highlight this text and Shift+Down for more fun!

If my post is helpful and/or inspirational, please consider following me. If not, please consider following me.
I make awesome stuff in Python, Scratch, and PHP. If I'm feeling patient, I create decent stuff in C/C++. I create awesome stuff in Minecraft, but I don't care about making it look cool.
I don't mind if you post off-topic replies on my profile, but please don't post links to posts you think I missed. I follow every topic I post in, and I'm often too busy to be on Scratch.

I used to have the 9000th post on TOLORS.
My first post was an accident
Interesting comment thread


Tic-tac-toe :: events hat
(1::grey) (X:: variables) (3::grey):: stack grey
(4::grey) (O:: sensing) (6::grey):: stack grey
(X:: variables) (O:: control) (X :: variables):: stack grey

Colors :: events hat
50_scratch_tabs \(me) :: variables
8to16 :: sensing
SaberDragon73 :: control
Comment a move on my profile and I will add it.




If you have a signature that requires Shift+down, paste this at the bottom of it. If you actually read this far, you deserve my respect. -50_scratch_tabs

Powered by DjangoBB