Find a block in your project

Early stages but this will find which sprites contain the specified search block item
Hoping to refine it into a custom reporter

Thanks to @cornelios207 for a bit of the code :slight_smile:

[edit 11Aug] Script updated to handle searching for variables as well as blocks. Its proving excellent at helping me find global variables that don't need to be global and can be made local to a sprite.
Also for finding that I don't use some that I've previously created :slight_smile:

[edit 14Aug] here is a custom reporter that does the same as above

findInProject

Note: Make sure you right-click and ringify the search block/variable you are looking for e.g.

image

so it looks like this

demo

[edit 16Aug] Updated to handles searching for plain text

Nice. Super cool that I can just export the picture to see all the helper blocks and so on!

Huh, it's not working for me.

I uploaded a new version earlier and your right - it didn't seem to contain the script

So I've re-uploaded a new script pic and I can now download and import it into a project as a script

Can you test again please?

Dragging and dropping from the forum doesn't work but doing it from
https://cdn.forum.snap.berkeley.edu/original/3X/9/d/9dde0e214738e85a94f15c9e0904fe2b8e74600a.png does for some reason

I'd never tried dragging and dropping directly between the forum and a project before -I've always used Image Save as and downloaded and then dragged the downloaded file into a project

So I just tried it now and got this error message
image

Not a real issue for me as it's not the technique I use - I don't have the real estate screen size to have the forum and a project visible at the same time

At least the error message tells you how to solve the problem!

Yes- it wins Error Message of The Day prize :slight_smile:

Now it works??

You need to click the image first, and drag the full res not the scaled down thumbnail.

At least for chrome, you have to drag the image, not the url.

I'm "finding" (pun intended) this block really useful in identifying unused global variables in my Mayflower project

I probably used a global variable called LOCK at one stage (or played about with it) but it's no longer needed in the project (as the only sprite referring to it is the sprite I'm running the find block in) so I can just simply delete it

You know about the "Unused blocks" option in the File menu, right?

Oh, does it not find variables? We should fix that.

Unused blocks only finds unused Library/custom blocks - completely different tool

It doesn't detect custom blocks just hanging around loosely in a script - it only detects Linrary/custom blocks that are not in any sprites editing pane

Got it. I'm glad you're enjoying metaprogramming! (There was a bunch of "who's going to use this?" in discussions at the conference. So now we have an answer: Hardly anyone will use it directly, but lots of people will use your library!)

PS I'm not convinced that FIND IN PROJECT has to be yellow and all caps; it doesn't do anything to the project.

My thinking is that I need Snappers who accidently/inadvertently come across my IDE helper blocks to stop and think - why does this block look so strange????

And then maybe they'll right-click and click help

They probably won't but at least I've tried my best to warn them

This find block, in itself, isn't dangerous, but the sort variable blocks are and I'm thinking best to just put them all in the one category

But maybe this one could just go into a standard category???

sensing????

control????

one of the others????

We could compromise: Same category, but not all caps.

But stick with the black labels?

Sure, if it works with zebra coloring.

Well I believe that manual overriding the colours of labels in custom reporters is not handled by the automatic zebra colouring algorithm :slight_smile:

But since these blocks are never intended to be used in scripts - I think that's a non-issue :slight_smile: