> Another gift for you Inform coders out there.
OK, if the game's giving out useful snippets of code for Informers, here's
something small but handy. RemoveAbsentObjects(thing) goes through all
children of (thing) recursively and removes anything with the attribute
"absent". Normally, of course, you can't remove objects in an objectloop,
so just give them 'absent', then call this routine. I seem to use
removeabsentobjects(player); quite a lot.
(I know absent's used for something else, but you're unlikely to be
carrying anything 'absent', right? Except maybe a 'female' thing, but if so
you can use another attribute instead.)
[ RemoveAbsentObjects i j k;
j=child(i);
k=0;
while (j~=0)
{
if (j has container)
removeabsentobjects(j);
if (j has absent)
{
remove j;
if (k==0)
j=child(i);
else
j=sibling(k);
}
else
{
k=j;
j=sibling(j);
}
}
];
BCNU, AjC