Here's a slight adjustment to fix the -n observers.
function SimObject::onCameraEnterOrbit(%obj,%camera)
{
%obj.observerCount = %obj.observerCount++;
}
function SimObject::onCameraLeaveOrbit(%obj,%camera)
{
%obj.observerCount = %obj.observerCount--;
}