How to make a <green flag clicked> predicate

  • Open dev mode. [1] You can do this by:
    • Shift-clicking the Snap! logo
    • Clicking Switch to dev mode
  • Create a predicate with title: $flag-1.5-0-200-0 clicked [2]
  • In the block editor, use this:
  • Click the Ok button. Tada! You have made a green flag clicked predicate! [3]

Details

[1] Two of the blocks in the definition require dev mode.
[2] The title can be anything you want, but or the sake of this tutorial, I'll just use this.
[3] It's not perfect but It's good enough.

honeslty, I feel like the SELECT block (and the
TYPE OF block) has so many uses and deserves to be a normal primitive. anyway, that's genius, never would have thought of that. but can you please replace snapblocks with script pic? thank you!

Fun fact: the deselect option can be replicated perfectly by putting the text string in the JOIN block.

But why doesn't this work for me?

oh... ive just realised, this doesnt work when the green flag button is clicked, but instead when the Snap!+ script pic (3) block runs so i guess its more of a [scratchblocks]<@greenFlag broadcast called :: control>[/scratchblocks]

The reason this doesn't work, is because when you click the green flag, it stops the project, then runs the when green flag clicked hat blocks.

so what do you suggest

Yield can just be replaced with wait (0) secs (that does pretty much the same thing).

oh ok. I didn't realize. is that EXTENSION menu option just useless?

Well, there might be some specific use case for it (that I don't know), but most of the time a simple wait (0) secs should do.

ok makes sense. the EXTENSION SNAP_YIELD is used in the repeat block.

its fine but i want to create a custom block and this script is exposed to the project editor

Yeah, this is why I want to be able to hide global/local/block variables and hat blocks in custom blocks.but whatever.

heres my attempt

this probably wont work because clicking the green flag wont broadcast the green flag message

btw i forgor the flag icon bruh :skull: :skull: :skull:

um common mistake, don't write IF <condition> THEN <TRUE> ELSE <FALSE>, instead write <condition>.