MultiDescer for MUX

Instructions

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

MUSHCode for MultiDescer for MUX

@pemit me=Now working with object #1438, name: TSC_MultiDescer:MUX
@create TSC MultiDescer:MUX=55
@lock TSC MultiDescer:MUX=#0
&DO_LISTDESC TSC MultiDescer:MUX=$+desc/list:@switch isdbref(u(%#/DESCS))=1,{@pemit %#=-=-=-=-=-=-=-=-=-=-=-=-=-=-> Your Descriptions <-=-=-=-=-=-=-=-=-=-=-=-=-=-; @pemit %#=[edit(columns(iter(lattr(u(%#/DESCS)/DESC-*),capstr(lcstr(edit(##,DESC-,)))),25),_,%b)]; @pemit %#=-=-=-=-=-=-=-=-=-=-=-=-=-> End Your Descriptions <-=-=-=-=-=-=-=-=-=-=-=-=-},0,{@pemit %#=I'm sorry, but you are not yet set to use the multidescer. Please type '+desc/setup' before continuing.}
&DO_SWITCHDESC TSC MultiDescer:MUX=$+desc *:@switch/first [isdbref(u(%#/DESCS))][words(lattr(u(%#/DESCS)/DESC-[setr(0,edit(ucstr(%0),%b,_))]))]=0*,{@pemit %#=I'm sorry, but you are not yet set to use the multidescer. Please type '+desc/setup' before continuing.},?0,{@pemit %#=I don't have any such description {'%0'}},11,{@cpattr [u(%#/DESCS)]/DESC-%q0=%#/desc; @pemit/c %l=[u(u(%#/DESCS)/EMIT-%q0)]; @switch [u(u(%#/DESCS)/NAME-%q0)]=?*,{@name %#=[u(u(%#/DESCS)/NAME-%q0)]},{@name %#=[u(u(%#/DESCS)/ROOTNAME)]}; @dolist setdiff(lattr(u(%#/DESCS)/*-%q0),EMIT-%q0 NAME-%q0 DESC-%q0)={@cpattr u(%#/DESCS)/##=%#/[extract(##,1,sub(words(##,-),1),-)]}; @pemit %#=The current description is now '{[capstr(lcstr(edit(%q0,_,%b)))]}'.},1?{@pemit %#=How on earth did you get TWO descriptions with the same name on you?}
&DO_DESCADD TSC MultiDescer:MUX=$+desc/add *:setq(0,edit(first(%0,=),%b,_)); setq(1,rest(escape(%0),=)); @switch/first [isdbref(u(%#/DESCS))][gt(strlen(%q0),0)][gt(strlen(%q1),0)][hasattr(u(%#/DESCS),DESC-%q0)]=0*,{@pemit %#=You are not yet set to use the multidescer. Please type '+desc/setup' before continuing.},?0??,{@pemit %#=I'm sorry, but you simply MUST give the description a name. See +desc/help.},??0?,{@pemit %#=I'm sorry, but you simply MUST type in a description of some sort. See +desc/help.},???0,{&DESC-%q0 [u(%#/DESCS)]=%q1; @pemit %#=You have stored a new description named '{[capstr(lcstr(edit(%q0,_,%b)))]}'.},{@pemit %#=I'm sorry, but there is already a description with that name.}
&DO_DESCDELETE TSC MultiDescer:MUX=$+desc/delete *:setq(0,edit(%0,%b,_)); @switch/first [isdbref(u(%#/DESCS))][hasattr(u(%#/DESCS),DESC-%q0)]=0*,{@pemit %#=I'm sorry, but you are not yet set to use the multidescer. Please type '+desc/setup' to continue.},?0,{@pemit %#=I'm sorry, but I can't find that description.},?1,{@wipe [u(%#/DESCS)]/*-%q0; @pemit %#=You have removed the description '{[capstr(lcstr(edit(%q0,_,%b)))]}'.}
&DO_DESCSAVE TSC MultiDescer:MUX=$+desc/save *:setq(0,edit(%0,%b,_)); @switch/first [isdbref(u(%#/DESCS))][hasattr(u(%#/DESCS),DESC-%q0)][strlen(%q0)]=0*,{@pemit %#=I'm sorry, but you are not yet set to use the multidescer. Please type '+desc/setup' before continuing.},?1?,{@pemit %#=I'm sorry, but there is already a description with that name.},??0,{@pemit %#=I'm sorry, but you simply MUST provide a name for the description},{&DESC-%q0 [u(%#/DESCS)]=[get(%#/desc)]; @pemit %#=You have saved the current description as '{[capstr(lcstr(edit(%q0,_,%b)))]}'}
&DO_DESCVIEW TSC MultiDescer:MUX=$+desc/view *:@switch/first [isdbref(u(%#/DESCS))][hasattr(u(%#/DESCS),DESC-[edit(%0,%b,_)])]=0*,{@pemit %#=I'm sorry, but you are not yet set to use the multidescer. Please type '+desc/setup' before continuing.},?1,{setq(7,edit(ucstr(%0),%b,_)); setq(0,Description: [capstr(lcstr(%0))]); @pemit %#=[setq(9,switch(isnum(extract(%q0,2,1,|)),1,extract(%q0,2,1,|),0,75))][setq(8,switch(isnum(extract(%q0,2,1,|)),1,extract(%q0,1,1,|),0,%q0))][setq(5,sub(div(sub(%q9,add(strlen(%q8),2)),4),1))][setq(1,mod(sub(%q9,add(strlen(%q8),2)),4))][repeat(-=,%q5)]-> %q8 <-[repeat(=-,%q5)][switch(%q1,3,=-=,2,=-,1,=)]; @pemit %#=[center(Name: [switch(u(u(%#/DESCS)/NAME-%q7),?*,u(u(%#/DESCS)/NAME-%q7),u(u(%#/DESCS)/ROOTNAME))],75)]; @pemit %#=%b[iter(setdiff(lattr(u(%#/DESCS)/*-%q7),NAME-%q7 DESC-%q7),[capstr(lcstr(extract(##,1,sub(words(##,-),1),-)))]: [u(u(%#/DESCS)/##)]%r)]; @pemit %#=[repeat(-,75)]; @pemit %#=[u([u(%#/DESCS)]/DESC-[edit(%0,%b,_)])]; setq(0,End Description: [capstr(lcstr(%0))]); @pemit %#=[setq(9,switch(isnum(extract(%q0,2,1,|)),1,extract(%q0,2,1,|),0,75))][setq(8,switch(isnum(extract(%q0,2,1,|)),1,extract(%q0,1,1,|),0,%q0))][setq(5,sub(div(sub(%q9,add(strlen(%q8),2)),4),1))][setq(1,mod(sub(%q9,add(strlen(%q8),2)),4))][repeat(-=,%q5)]-> %q8 <-[repeat(=-,%q5)][switch(%q1,3,=-=,2,=-,1,=)]},?0,{@pemit %#=I can't find that description to view.}
&DO_DESCEDIT TSC MultiDescer:MUX=$+desc/edit *:setq(0,edit(first(%0,=),%b,_)); setq(1,rest(escape(%0),=)); setq(2,rest(%q1,/)); setq(1,first(%q1,/)); @switch/first [isdbref(u(%#/DESCS))][hasattr(u(%#/DESCS),DESC-%q0)]=0*,{@pemit %#=I'm sorry, but you are not yet set to use the multidescer. Please type '+desc/setup' before continuing.},?0,{@pemit %#=I can't find that description.},?1,{@edit [u(%#/DESCS)]/DESC-%q0={%q1},{%q2}; @pemit %#=You have edited the description named '{[capstr(lcstr(edit(%q0,_,%b)))]}'.}
&DO_DESCSETUP TSC MultiDescer:MUX=$+desc/setup:@switch isdbref(u(%#/DESCS))=0,{@fo %#={@create %N's Descriptions}; @fo %#={&DESCS %#=setr(0,locate(%#,%N's Descriptions,in)); &ROOTNAME %%q0=%N; @cpattr %#/desc=%%q0/DESC-MAIN; @pemit %#=switch(isdbref(%%q0),1,You are now set up to use the global multi-descer.,0,An error occurred setting you up. You are probably out of quota.)}},1,{@pemit %#=I'm sorry, but you already are setup to use the multidescer.}
&DO_DESCEMIT TSC MultiDescer:MUX=$+desc/emit *:setq(0,first(%0,=)); setq(1,rest(escape(%0),=)); setq(2,edit(%q0,%b,_)); @switch [isdbref(u(%#/DESCS))][hasattr(u(%#/DESCS),DESC-%q2)]=0*,{@pemit %#=I'm sorry, but you are not yet set to use the multidescer. Please type '+desc/setup' before continuing.},?0,{@pemit %#=I'm sorry, but you don't a description named {'%q0'}.},?1,{&EMIT-%q2 [u(%#/DESCS)]=%q1; @pemit %#=You have set the emit for {'%q0'}.}
&DO_DESCNAME TSC MultiDescer:MUX=$+desc/name *:setq(0,first(%0,=)); setq(1,rest(escape(%0),=)); setq(2,edit(%q0,%b,_)); @switch [isdbref(u(%#/DESCS))][hasattr(u(%#/DESCS),DESC-%q2)]=0*,{@pemit %#=I'm sorry, but you are not yet set to use the multidescer. Please type '+desc/setup' before continuing.},?0,{@pemit %#=I'm sorry, but you don't have a description named {'%q0'}.},?1,{&NAME-%q2 [u(%#/DESCS)]=[switch(%q1,clear,,%q1)]; @pemit %#=You have set the name for {'%q0'}.}
&DO_DESCROOTNAME TSC MultiDescer:MUX=$+desc/rootname *:@switch isdbref(u(%#/DESCS))=1,{&ROOTNAME [u(%#/DESCS)]={%0}; @pemit %#=You have set your default name to '{%0}'.},0,{@pemit %#=I'm sorry, but you are not yet set to use the multidescer. Please type '+desc/setup' before continuing.}
&FN_GENERIC_COLUMNS TSC MultiDescer:MUX=switch(gt(words(%0,%2),switch(gt(div(75,%1),0),0,1,div(75,%1))),1,iter(extract(%0,1,switch(gt(div(75,%1),0),0,1,div(75,%1)),%2),ljust(##,%1),%2)%r[u(FN_GENERIC_COLUMNS,extract(%0,add(1,switch(gt(div(75,%1),0),0,1,div(75,%1))),words(%0,%2),%2),%1,%2)],0,iter(%0,ljust(##,%1),%2))
@Desc TSC MultiDescer:MUX=-=-=-=-=-=-=-=-=-=-=-=-=-=-> MultiDescer Help <-=-=-=-=-=-=-=-=-=-=-=-=-=-=%r%b+desc/setup[space(15)]Sets you up to use the multidescer%r%b+desc/list[space(16)]Shows you all currently available descriptions%r%b+desc/view name[space(11)]Shows you the description%r%b+desc/add name=desc[space(7)]Adds a description named 'name', with desc of%r[space(27)]'desc'%r%b+desc/delete name[space(9)]Deletes the named description%r%b+desc/save desc[space(11)]Saves the current desc with a name of 'desc'%r%b+desc/edit name=old/new[space(3)]Changes the description named 'name' so that%r[space(27)]'old' text becomes 'new' text.%r%b+desc name[space(16)]Changes the current description to 'desc'%r%b+desc/emit name=emit[space(6)]Sets the message to emit when you switch to%r[space(27)]'name'%r%b+desc/name desc=name[space(6)]Sets the character name to use when you switch%r[space(27)]to 'desc'. Note that if 'name' is 'clear', the%r[space(27)]name will be your rootname until you reset it.%r[space(27)]See the next command for information on your%r[space(27)]rootname.%r%b+desc/rootname name[space(7)]Sets your default name. This is the name which%r[space(27)]is used when you don't explicitly state a name.%r%b+desc/attrib name:attr=value%r[space(27)]Set an attribute for use with a description.%r[space(27)]Note that this can be any legal attribute,%r[space(27)]including attributes for use in +finger,%r[space(27)]@oxtport, etc.%r%rInstallation Notes: In order to use this multidescer globally, simply drop it into the master room on your mux. In order to use it personally, simply quote up the multidescer, and then do: &DESCS me=\[num(MUSH)] :and you'll be set to go.%r%rUse on tinymush: In order to use this multidescer on tinymush, you will need to make a change to the DO_LISTDESC command. Simply change the call to 'columns()' in this attribute to a call to 'u(FN_GENERIC_COLUMNS), with everything else completely the same. Alternatively, you can simply grab the tinymush version of this code in the Free Code Room from the StoryTeller's Circle at games.io.com 6666%r-=-=-=-=-=-=-=-=-=-=-=-=-> End MultiDescer Help <-=-=-=-=-=-=-=-=-=-=-=-=-=
&DO_DESCATTRIB TSC MultiDescer:MUX=$+desc/attrib *:setq(0,edit(first(%0,=),%b,_)); setq(1,rest(%q0,:)); setq(0,first(%q0,:)); setq(2,rest(escape(%0),=)); setq(3,u(%#/DESCS)); @switch/first [isdbref(%q3)][hasattr(%q3,DESC-%q0)][strmatch(%q2,clear)]=0*,{@pemit %#=You are not yet set to use the multidescer. Please use '+desc/setup'},10?,{@pemit %#=No such description '{%0}'.},??0,{&%q1-%q0 %q3=%q2; @pemit %#=You have set the [capstr(lcstr(%q1))] for your [capstr(lcstr(%q0))] description.},??1,{&%q1-%q0 %q3; @pemit %#=You have cleared the [capstr(lcstr(%q1))] from your [capstr(lcstr(%q0))] description.}
@set TSC MultiDescer:MUX=INHERIT