++ knife: Thing ‘knife dagger blade’ ‘knife’
"A <<isBloody ? ‘blood-smeared’ : ‘gleaming’>> silver dagger. "
isBloody = nil
iobjFor(CutWith) {
verify() {}
check() {
if (gDobj != me) failCheck ('You can’t cut {the dobj} with the knife. ');
else if (isBloody) failCheck ('Don’t you think cutting yourself once is enough? ');
}
action() {
"You make a small cut on your palm and draw blood. ";
isBloody = true;
cmdDict.addWord (knife, ‘bloody’, &adjective);
name = ‘bloody knife’;
}
}
;[/code]
the cmdDict.addWord() function is really useful in situations like this – you can learn about it by searching for cmdDict in “Learning T3”. Once you’ve used it, the player will be able to refer to the knife as “bloody knife”.
Oddly enough, the dobjFor(CutWith) has to have an empty action() statement, as the reportFailure macro is being called from there in the library code for the Thing class (from which Actor is derived).