I hope I will get this question described correctly:
I want a Sprite that has no code in it, to do a "thing" that I pass to it from another Sprite via the "TELL Sprite" command. i do not mean clones of each other. Two individual Sprites.
The "thing" I want it to do is what I have coded under a "When I receive " hat.
I tried writing a function, and passing the function. But that does not work, because functions have their own hat already !
However, no mattter how I tried, I cannot pass a HAT in the TELL block to another Sprite.
I have succeeded in getting the core of the HAT code passed WITHOUT the HAT.
But then in the code I have to have a LOOP that checks for the particular message and then execute related code. Not quite like to actual "When I receive " hat.
The actual code and what it does is not important. The point is that I want the receiving Sprite to behave as if it noticed the broadcast message by itself, with my coded "message check" loop.
Is there a clean way to achieve this?
I'm not sure I understand. There is no need to pass a hat block as a message. If you have written a procedure, let's say it's called FOO, you just put a FOO block (copied out of the palette as usual) into the ring in the TELL. There is also no need for a WHEN I RECEIVE in the receiving sprite; the TELL causes a thread to start in the other sprite that will run the FOO block you sent it.
WHEN I RECEIVE is for the Scratch-style BROADCAST messages, which are text strings, not code.
Am I answering your question?
I think it'd be easier to understand what you need if you attach a screenshot of the actual code
Do you mean you want to tell another sprite to do something when a certain event happens?
You could just put the "tell" block underneath an event hat
You can't ringify a script with a hat, so you should workaround and try this
@pr0grammer 's idea might be very doable for my purposes. I need to test it.
@bh: yes I wanted to achieve exactly the broadcast type action in another Sprite without explicitely coding it in the Sprite. I had already tried passing the actual body of the code, and that works. But it is not tied to the broadcasted message. I believe @pr0grammer's idea might just be right.
Thanks to all for the suggestions and help.