Translator Earpiece

An earpiece that allows you to speak and translate messages in Covow.

Author: Giotto@M*U*S*H
Category: Other
Compatibility: CobraMUSH, PennMUSH.


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

MUSHCode for Translator Earpiece

@create Translator Earpiece
@link Translator Earpiece = #0
@lock/Command Translator Earpiece=#9806
@lset Translator Earpiece/Command=no_inherit
@set Translator Earpiece = TRUST
@set Translator Earpiece = VISUAL
@set Translator Earpiece = MONITOR
&AMOVE Translator Earpiece=think [if(ulocal(f.worn),[pemit(v(d.wornby),You are no longer wearing the [name(me)].)][ulocal(f.remove)])]
@set Translator Earpiece/AMOVE=no_command prefixmatch
&C.+COVOW Translator Earpiece=$+covow *:@fo %#=think [oemit(%#,name(%#) says (in Covow), "[setr(0,[ulocal(f.covow,%0)])]")][pemit(%#,You say "%q0", which is Covow for "%0")]
&C.+ROT13 Translator Earpiece=$+rot13 *:@emit %N says, "[tr(%0,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM)]"
&C.+TRHELP Translator Earpiece=$+trhelp:@pemit %#=%r[ansi(y,ucstr([name(me)]))]%r%rAvailable commands:%r%r+covow <message> : Say a message in Covow.%r+trwear: wear the translator earpiece.%r+trremove: remove the translator earpiece.%r%rNOTE:%r%rTo allow the earpiece to hear what others are saying while you're carrying it (so it can translate Covow into English), you must enter the command @listen me=* so that the messages emitted to the room can propagate through your inventory (or something like that, if you know what you're doing).
&C.+TRREMOVE Translator Earpiece=$+trremove:think [if(ulocal(f.worn),[ulocal(f.remove)][pemit(%#,You remove the [name(me)].)][oemit(%#,%N removes the [name(me)].)],[pemit(%#,You are not wearing the [name(me)]!)])]
&C.+TRWEAR Translator Earpiece=$+trwear:think [if([ulocal(f.worn)],pemit(%#,You are already wearing the [name(me)]!),[ulocal(f.wear)][pemit(%#,You wear the [name(me)].)][oemit(%#,%N wears the [name(me)].)])]
&D.WORNBY Translator Earpiece=
&DESCRIBE Translator Earpiece=It looks like a small white earpiece, designed to fit neatly in any ear. It will give you the ability to speak Covow, and it will translate what others say for you!%r%rType +trhelp for help.
@set Translator Earpiece/DESCRIBE=no_command visual prefixmatch public nearby
&F.COVOW Translator Earpiece=[tr(%0,abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,ipgtovchajqrnmebklsdyfxwuzIPGTOVCHAJQRNMEBKLSDYFXWUZ)]
&F.REMOVE Translator Earpiece=[set(me, d.wornby:NOT_WORN)]
&F.WEAR Translator Earpiece=[set(me,d.wornby:%#)]
&F.WORN Translator Earpiece=[isdbref(v(d.wornby))]
&L.COVOW Translator Earpiece=^* says (in Covow), "*":think [if(isdbref(setr(0,v(d.wornby))),pemit(%q0,From the [name(me)], a synthetic voice says, "[ulocal(f.covow,%1)]"))]
&LISTEN Translator Earpiece=*
@set Translator Earpiece/LISTEN=no_command prefixmatch

look Translator Earpiece