blackhornet
The iid isn't related to picking, it's the instance number of the object type. I've utilized this to access values in unpicked objects. Off the top of my head, one use could be to compare two random instances of the same type.
global number other=0
pick random sprite instance
--- set other to sprite.iid
pick random sprite instance
sprite x < sprite(other).x
--- destroy sprite
liev04
I didn't look into it previously but after a quick test iids are an instance number of a object type, not a family. So the object.iid will give the instance number of that type and not instance number in that family. However, the family(3).x style expression will give you the forth (counting from 0) instance in the family.
A brute force solution could be to change the function to:
on function "getiid"
for each family
system: compare function.param(0)=family.uid
--- function: set return value to loopindex
--- stop loop
Another way could be to give the family an instance variable that you set to their index number when you create it. You'll also need to update it when an instance is destroyed. There's probably other ways too.