You might take a look at this post: Creating an multi handler function in an extension - #2 by E-EnerG-Gamecentral
Here’s my answer from there, which might actually fit:
This may not solve your problems, but the MakeCode playground is a great tool to explore the block styles and prototype blocks. See: https://makecode.com/playground .
About the closest example is has is the in-line event handler.
You may want to follow the link and:
- Switch to the micro:bit view (The “Editor” drop down menu)
- Pick “Events” in the Sample menu
- Click
Run
- Select the Puzzle Piece palette to see what the examples look like. The “
on an inline event
” looks like a pretty good fit. It can be modified to have a parameter.
That being said, I’m not sure how easy/hard it is to get the behavior you want. I suspect it isn’t too bad.
Bill