As a debugging piece of code, this will set whatever object you point to as a wireframe, and leave the rest.
Prior to your loop:
dbBackdropColor(0)
dbBackdropOn();
dbShowMouse();
and within your loop:
int obj;
obj = objectEnd;
while (obj-- > 4)
{
dbSetObjectWireframe (obj, false);
}
obj = dbPickObject(dbMouseX(), dbMouseY(), 4, objectEnd);
if (obj)
{
dbSetObjectWireframe (obj, true);
}
Works for me... although the wireframes seem to not be showing correctly for scaled objects. But the dbPickObject() command seems to be working well in either case.
Edit: When you hide an object, the pick object command sees through it. So with your code there, it'll see it with one frame, then see whatever's behind it the next, and see what's behind that the next frame, etc.