Custom hat blocks (NOT the when block!)

i've heard plenty of times that the when block is slow, because it's essentially a forever loop.
surely a custom hat block should be event based!

look at what i need to do here to get a custom event:

how would i go about sending this around, especially in a large library? mark all the relevant blocks and ask the user to set it up by themself? what happens if that broadcast name is already used? i need to explain what "data" is supposed to be for every block? what happens if the user finds out later they don't need the broadcast, will they remember to remove the other code?

this doesn't even have state for the individual block, this is one block that needs to handle all the sprites. what if i want to access the code under the hat and transform it? imagine a custom hat where when the project is loaded, all the blocks under it are transformed and used elsewhere. it would be really nice if some script could grab some other code based on the hat block used over it. currently i don't think any script related blocks can touch hat blocks.

I actually like this idea

I'm not sure I understand what custom hat block you'd want to use in your example. The relevant event, a key press, has a hat block, which you're using.

the broadcast here is what i'm suggesting would be replaced by a custom hat block. it broadcasts when a key is pressed, but not when it is held. currently, there's no way to put it in a library, it has to be manually created every time.

So, the hat block would be WHEN I RECEIVE KEY PRESSED ?

something like that, but i probably wouldn't name it that if that's what you mean. "recieve" sounds too much like a broadcast, and ideally there wouldn't be any named broadcast, because the names of broadcasts in different libraries could conflict.

the way i would design the ui for a custom hat block is that you would place any number of existing hat blocks in it with any scripts, and you have a variable representing the code under the hat block, which you MAY run, or even just do other things with. it would be similar to running or modifying a continuation.

an example would be a block to compile code or to replace blocks with one C-slot

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.