This works wonderfully! The only problem was that the procedure was called incorrectly. It should instead read:
(if (== IsOwnedBy(INV_ITEM gRoomNumber) TRUE)
...
)
or for Ego:
(if (== IsOwnedBy(INV_ITEM ego) TRUE)
...
)
There were also some bracket issues with the actual procedure declaration, but it's simple enough to sort out. Here's the code again for those who just want to copy and paste:
(procedure public (IsOwnedBy invItem roomOrActor)
(var checkObject)
= checkObject (send gInv:at(invItem))
(if(IsObject(checkObject))
return (send checkObject:ownedBy(roomOrActor))
)(else
return(0)
)
)
Thank you so much, Lars! Truly invaluable! Now I don't have to make several if cases for what objects ego is carrying! All I have to do is make the script check whether the room owns it or not. I'm sure this will save on memory and size.