How can I do this

How can I make a block do an entire code?

You might want to check out page 40 of the reference manual: https://snap.berkeley.edu/snap/help/SnapManual.pdf

what do you mean?

Can you please be more specific? "make a block do an entire code" is very very ambiguous and tells us nothing about what you want to do.

what?

Like put an entire script of a game into a custom block?

  1. click the "make a block" button in the blocks palette

  2. make sure to have the script that you want to put in your custom block

  3. after givign a name to yuor custom block, put the desired script under the hat block in the custom block editor tab

  4. press "ok", and you're done

ooh, I did that once

I mean like put a whole script into one block that I make

Well, what's stopping you from doing it?

I believe he is wondering if it’s possible (if it is) he wants to know how to do it. Like he wants to make a block do a intier code without a hat block.

You could make a custom hat that runs the code when the dev-mode only block message reports something like _go_start_ or something like that, and runs only the first frame that that is true, but why would you want that?

press the script...

@sathvikrias he wants to press the green flag and then with the”one block” that he is making he wants that to activate without a hat block.

I don’t think you understand the fundamental concept of a hat block.

Hat blocks are the only way to activate scripts. As was discussed in a previous forum discussion (which seems to have been deleted... why?), hat blocks other than when slot [ V]signals [menu V] don't work in custom block definitions. Either, you must do something like this:

when flag clicked
my custom block::motion

or create a custom hat block (note that the script shown here is a placeholder):

{$+ my $+ hat $+ ::hat}::define hat
move($my-0-0-0-1 $code-0-0-0-1::#ffffff) steps
repeat (10){
do other stuff
}
change [var V] by (1)

And have this custom hat block sitting in the scripting area.

I'm kinda confused by this, the variable (my code) seems like it comes from nowhere, and it since hats continuously run the script in the definition, what is the forever loop for?

Sorry, they were just place holders. And the variable had meant to be a text input, but because it was in the number slot... Fixed now.

me and @henhen123 go to school together idk if this is relevant to the topic but I talked to him on this topic and he said “I’m trying to make a game with no hat blocks at all” so no hat blocks (not trying to be mean) but no hat blocks that means no custom hat blocks too

no you didn't, what in the world?

that's not how snap (and programming languages in general) works. you can't have an event run if no blocks are listening for an event.