Answering Machine

An answering machine, which allows visitors to a room to leave messages. The owner can view the messages, as well as a list of recent visitors.

Author: Stranger@TinyTIM
Category: Other
Functions: name(), owner(), strlen(), time(), v().

Instructions

Copy and paste the below code into a compatible MUSH or MUX.

MUSHCode for Answering Machine

@create Answering machine
@desc Answering machine=A simple answering machine, it listens for people to arrive, then records the time they visited. If you want to leave a message for the owner, type 'memo <whatever you want to say>'.
@va answering machine=<+>
@vb Answering machine=<_>
@vc Answering machine=@switch strlen(v(va))=3,{},{"People have visited.};@switch strlen(v(vb))=3,{},{"You have messages.}
@vd Answering machine=NOTES: the commands to use this machine are 'show guests', 'play messages', 'clear guests', 'memo <message>', and 'clear messages'. These commands do exactly what you would expect them to. The AHEAR on the machine makes it so when the owner of the machine arrives, his/her name is not recorded(to save space). The AHEAR will trigger VC when the owner arrives. VC checks to see if anyone has visited, or if there are any messages, and will notify the owner of such facts. If there are no visitors, nor any messages, the answering machine will do nothing when the owner arrives.
@ve Answering machine=CREDITS: This exhibit appears courtesy of Stranger.
@vu Answering machine=$memo *:@edit me/vb={<_>},{"[v(0)]" - [name(owner(v(n)))]...<_>};"I'll give [name(owner(me))] the message.
@vv Answering machine=$show messages:"Here are the messages:;"[v(vb)]
@vw Answering machine=$clear messages:@switch name(owner(v(n)))=[name(owner(me))],{"Messages cleared.;@vb me=<_>},{"Only [name(owner(me))] can clear the messages.}
@vy Answering machine=$show guests:"Here's who has visted:;"[v(va)]
@vz Answering machine=@switch name(owner(v(n)))=[name(owner(me))],{"Guest register cleared.;@va me=<+>},{"Only [name(owner(me))] can clear the guest register.}
@listen Answering machine=* has arrived.
@ahear Answering machine=@switch name(owner(v(n)))=[name(owner(me))],{@trigger me/vc},{@edit me/va={<+>},{%N stopped by [time()]...<+>}

ex Answering machine/VD