camera.u
mud/samples/camera.u · 1.5 KB
From the archive ubermud1.13.tar.gz
Download the archive « Back to the archive contents
/*
a polaroid one-step
Marcus J. Ranum, 1990
*/
/* this hard-codes the number of the camera-object */
#define CAMNUM #142
/* describe */
CAMNUM.dsc = "the camera is a cheap-looking polaroid one-step. it appears to be full of film, and has a flash attachment. there are directions written on the back in small letters";
/* directions */
CAMNUM.txt = "the directions say: 'to use the camera, use it and then try \"photograph <personname>\" where the person is in the room. a picture will be added to your inventory.'";
/* snap a picture. */
func CAMNUM.photograph
{
$here = #actor._loc;
if($# < 1) {
@.emote("looks around, fidding with the camera.");
echo("you aren't sure who or what you want to take a picture of\n");
return;
}
/* what to photograph ? */
$at = match($1,$here._ply,"nam");
if($at == NULL) {
echo("I see no \"",$1,"\" here.\n");
return;
}
/* make the photograph - don't waste film :) */
if($at.dsc == NULL) {
echo("why waste your film on nothing special?\n");
@.emote("considers photographing",$at.nam,"but decides not to.");
return;
}
/* make a new object */
$photo = @.create(str("a photograph of ",$at.nam));
if($photo == NULL) {
echo("out of film:",error($photo),"\n");
return;
}
/* bind the description to the photo */
$photo.dsc = str("a somewhat grainy photograph of ",$at.nam,", ",$at.dsc);
$photo.txt = str("taken by ",#actor.nam," on ",strtime());
@.emote("snaps a picture of",$at.nam,"in a brilliant >POP< of light");
}