I am making a project and I need a block to have different behaviour depending on whether it was ran from a ring in another block’s inputs or not. I know the this [caller V] block can be used to find info about a block’s location, but how would I use it in this way?
I’m not 100% sure, but I THINK if you use the built-in data with broadcast / receive you could probably figure smth out
My script is believe should work
Let’s start with a basic example. As you can see here, the caller of the ring is “run (ring)”. However, you want to detect “the block you want to detect”, not the internal definition.
You can use the OF block to move up one caller layer:
Note that “this caller of this caller” only includes the present block:
So, now that we have a visual representation of the block calling us, we should be able to programmatically determine that it is the correct block, right? Yup! Simply split the script “by blocks” and you’ll get a syntax tree where the first item is your block:
A simple Boolean check will suffice:
We now have a basic working model. But one issue you may notice is that this script errors when “this caller” or “this caller of this caller” is a sprite, because a sprite can’t be split by blocks. We’ll have to add a check for that.
Now that we have the basic functionality down, the question at this stage is simple: is it possible to “spoof” a caller situation that will make your program give a false positive? From my tests, no. This should work just fine. However, if you wish this to detect the block it is in if it isn’t in a ring, that’ll be more complicated.





