jmoenig/Snap

Unable to call a private block in another sprite with Tell

Closed this issue · 5 comments

You could also make the HI block sprite-local too, and arrange for such blocks to be inherited by clones.

And (also related to #3282 ) note that you can use the " _ of _ " block to do these things, because with it, the contexts are clearly defined.
GlobalWithLocal

The error is very intentional — it prevents a common error from happening. I suppose it can be useful exclude TELL but in general patterns like this get complicated quickly. A “private” or local block is meant to private, accessible only to that sprite. In this example you could generally work around it using broadcasts. -- Michael BallFrom my iPhonemichaelball.coOn Nov 29, 2023, at 11:28 AM, 000 @.> wrote: image.png (view on web) —Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.>

What if I want to pass in some parameters?
Broadcast can't do that.

Also, I don't see how this thing gets complex easily. This is equivalent to object.method();.
And different can define different methods that has the same name:
object1.SetOffset_X(100);
object2.SetOffset_X(150);
The code of SetOffset_x of object1 can be completely different to the one in object2, and calling SetOffset_X of object1 won't affect object 2.

And (also related to #3282 ) note that you can use the " _ of _ " block to do these things, because with it, the contexts are clearly defined. GlobalWithLocal

This is a pretty smart way to get around! Thank you very much for helping. I'll try that.