What is the code for each of the hat blocks?

title is self-explanatory.

What do you mean by "code"?

the JS
also this is ABOUT snap, not help with JS.

When you stick a hat block inside a script, like, with a block above it (either by editing the xml or other means) the hat block doesn't get activated. I don't think there is a way to create your own hat block using js (unless you edit snap)

What does that have to do with my reply?

just so it's not flagged

Couldn't you put that in the original post?