Skip to Content

BYOB question

« How do I...?
4 replies [Last post]
anne mulhern
Member

 HI!

This is the best venue I can think of for my question although I know it's not quite the right one.

Does anybody know how I can check if a BYOB sprite has  a parent? I'm looking to delete all clones except the prototype. There is an 

 

attribute parent

 

block

 

but I don't know how to check if this block is null or not.

 

Thanks!

Replies
anne mulhern
Member

The answer was a big help. But I think it raises a problem that has arisen in programming languages over and over again.

When I evaluate <attribute parent> I get <nil>. Now, it turns out that <nil> is equal to <false> which is why the suggestion works. But, even though <nil> is equal to <false> if I try to use it in the same way as <false> I run into difficulties.

This creates a sort of semantic difficulty because the two values are clearly not equal.

Would a separate <isnil?> operator be better?

Stefano Federici
Member

> Would a separate <isnil?> operator be better?

 

Yes, I guess it would. A "nil" could be added to the list of the "is a" operator.

anne mulhern
Member

Thanks!

 

Works a charm.

 

- mulhern

Stefano Federici
Member

Compare the <attribute parent> block to <false> (from Operators). If the comparison in True than the sprite has no parent.