Multiple Description Widget

BDM's multi-description system allows players to store and use multiple different descriptions in any number of combinations and order for their characters, as well as to access division descriptions for use.

Author: Sigc@M*U*S*H
Category: Other
Commands: @create, @describe, @lock, @pemit, @set.
Compatibility: CobraMUSH, PennMUSH.

Instructions

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

MUSHCode for Multiple Description Widget

@create Multiple Description Widget
@lock Multiple Description Widget==me
@set Multiple Description Widget = TRUST
@set Multiple Description Widget = !NO_COMMAND
&CMD.DELETEDESC Multiple Description Widget=$+desc/delete *:@pemit %#=u(fn.error,if(setr(d,grab(u(fn.listlocaldescs,%#),*`[edit(%0,%b,_)],%b)),wipe(%qd)Deleted.,Unknown Description. May be a forced description));@@ @DESC@ Keyword : Recycles your descriptions. Global descriptions cannot be deleted
&CMD.DESCQUICKEDIT Multiple Description Widget=$+desc/edit *=*:@pemit %#=u(fn.error,if(not(u(fn.getdesc,%#,%0)),A description by that name does not yet exist. Please use +desc/write instead.,if(u(fn.storedesc,%#,%0,decompose(%1)),Description '%0' stored.,Unknown Error.)));@@ @DOCX@ Name|Description : Edits an existing description.
&CMD.DESCQUICKWRITE Multiple Description Widget=$+desc/write *=*:@pemit %#=u(fn.error,if(u(fn.getdesc,%#,%0),A description by that name already exists. Please use +desc/edit instead.,if(u(fn.storedesc,%#,%0,decompose(%1)),Description '%0' stored.,Unknown Error.)));@@ @DOCX@ Name|Description : Writes a new description.
&CMD.DETAILWRITE Multiple Description Widget=$+desc/detail */*=*:@pemit %#=u(fn.error,if(not(u(fn.getdesc,%#,%0)),A description by that name doesnt exsist.,if(u(fn.storedetail,%#,%0,%1,decompose(%2)),Detail '%1' stored to description '%0',Unknown Error.)));@@ @DOCX@ Name|Description : Writes a new detail
&CMD.LISTDESC Multiple Description Widget=$+desc/list:@pemit %#=u(fn.header1,Descriptions,Wardrobe)%r[align(>20 -9 -9 -35,ansi(hw,Name),ansi(hw,Words),ansi(hw,Lines),ansi(hw,Brief))] %r[iter(setunion(iter(u(fn.listdescs,%#),last(%i0,`)),),align(>20 -9 -9 38,edit(%i0,_,%b),words(setr(d,stripansi(u(fn.getdesc,%#,last(%i0,`))))),words(wrap(%qd,78,78,|),|),left(extract(%qd,1,5),35)[switch(words(%qd),3,...)]) ,%b,%r)]%r[u(fn.header3)];@@ @DOCX@ None: Lists descriptions available.
&CMD.SETDESC Multiple Description Widget=$+desc/use *:@pemit %#=u(fn.error,if(and(words(decompose(%0),+),not(first(decompose(%0),+))),if(lmath(and,setr(d,iter(rest(decompose(%0),+),u(fn.getdesc,%#,%i0),+,|)),|),set(%#,describe:[get(%#/describe)]%b[iter(%qd,%i0%b,|,)])[set(%#,multidescstr:[get(%#/multidescstr)]%0)]Description(s) added to current.,Unknown description(s) - [itemize(itermatchall(%qd,,|),'[elements(%0,##,+)]',|))] ) ,if(lmath(and,setr(d,iter(%0,u(fn.getdesc,%#,%i0),+,|)),|),set(%#,describe:[iter(%qd,%i0[if(regmatch(%i0,([%%%\w]?)),,%b)],|,)])[set(%#,multidescstr:%0)]Set.,Unknown description(s) - [itemize(iter(matchall(%qd,,|),'[elements(%0,##,+)]',|))])));@@ @DOCX@ Descriptions : Description names either singular, in a list seperated by '+'
&CMD.STORECURRENT Multiple Description Widget=$+desc/save *:@pemit %#=u(fn.error,if(u(fn.storedesc,%#,%0,get(%#/describe)),Current Description stored as '%0'.,Unknown Error.));@@ @DOCX@ Name: Stores your current description under the given name
&CMD.VIEW Multiple Description Widget=$+view */*:@pemit %#=if(setr(p,locate(%#,%0,PXlhnm)),[u(fn.header2,MultiDescer)]%r[iter(u(fn.getinspect,%qp,%1),center(...[edit(u(fn.parsedesc,extract(get(%qp/[elements(%i0,1 2,`,`)]),bound(sub(setr(c,match(setr(u,get(%qp/[elements(%i0,1 2,`,`)])),%1)),4),1,1000000),5,%b),%qp,elements(%i0,2,`)),\\\[,\[,\\\],\])]...,78)%r[get(%qp/%i0)]%r ,%b,%r)]%r[u(fn.header3)],%zh%zc-%zn Unknown Person)
&CMD.VIEWDESC Multiple Description Widget=$+desc/view *:@pemit %#=if(setr(d,u(fn.getdesc,%#,%0)),u(fn.header2,%0)%r%qd%r[u(fn.header3)],u(fn.error,Unknown Description));@@ @DOCX@ Name : Takes a peak at given description.
&CMD.VIEWDETAILS Multiple Description Widget=$+desc/details *:@pemit %#=if(u(fn.getdesc,%#,%0),[u(fn.header2,Details for: %0)]%r[align(1 -20 50,,ansi(hw,Keyword),ansi(hw,Brief))]%r[iter(lattr(%#/multidesc`%0`*),align(1 20 50,,last(%i0,`),left(get(%#/%i0),48)),%b,%r)]%r[u(fn.header3)] ,u(fn.error,Invalid Description))
&DESCRIBE Multiple Description Widget=u(helpfile)%r%r%r[u(helpfile2)]
@set Multiple Description Widget/DESCRIBE=no_command visual prefixmatch public nearby
&FN.ERROR Multiple Description Widget=[@@(%0: Error message)]ansi(hb,\[)[ansi(c,Wardrobe)][ansi(hb,\])]%b[ansi(hw,%0)]
&FN.GETDESC Multiple Description Widget=[@@(%0:Player %1:Desc)]if(regmatch(decompose(%1),([%%%\w]+)),decompose(%1),ulocal(fn.parsedesc,u(grab(u(fn.listdescs,%0),*`[edit(%1,%b,_)],%b)),%0,%1))
&FN.GETINSPECT Multiple Description Widget=[@@(%0 Person, %1 Inspectable)]if(setr(l,iter(setunion(get(%0/multidescstr),,+),lattr(%0/multidesc`%i0`%1),+,%b)),%ql,#-3 NOT FOUND)
&FN.HEADER1 Multiple Description Widget=[@@(@DOCX@ Left | Right)]ansi(c,center(ansi(hb,\[)[ansi(hw,%0)][ansi(hb,\])],div(78,2),=))[ansi(c,center(ansi(hb,\[)[ansi(hw,%1)][ansi(hb,\])],div(78,2),=))]
&FN.HEADER2 Multiple Description Widget=[@@(@DOCX@ Center : Produces a centered header.)]ansi(c,center(ansi(hb,\[)[ansi(hw,%0)][ansi(hb,\])],78,=))
&FN.HEADER3 Multiple Description Widget=ansi(c,repeat(=,78))
&FN.LISTDESCS Multiple Description Widget=[@@(%0:Person)]setunion(iter(lattrp(%0/multidesc`*),%0/%i0),%b,@@(Find descs for orgs/divisions and species here. list as object/attribute ))
&FN.LISTLOCALDESCS Multiple Description Widget=[@@(%0:Person)]iter(lattrp(%0/multidesc`*),%0/%i0)
&FN.PARSEDESC Multiple Description Widget=[@@(%0 String (description)\, %1 Player\, %2 Description)][squish([setq(0,%0)][iter(lattr(%1/multidesc`%2`*),[iter(regraballi(%0,^([{[after(itext(0),ucstr(MULTIDESC`%2`))]}]([\\W])?)$),setq(0,regedit(%q0,{[edit(itext(0),.,)]},strreplace(edit([itext(0)],.,,\,,\\\,),0,strlen(secure(edit(itext(0),.,))),\\\[[squish(secure(edit(itext(0),.,))\\\])] ))))])]%q0)]
&FN.STOREDESC Multiple Description Widget=[@@(%0:Player\,%1:Desc Name\,%2:Description)]null(set(%0,multidesc`[edit(%1,%b,_)]:[decompose(%2)]))[hasattr(%0,multidesc`[edit(%1,%b,_)])
&FN.STOREDETAIL Multiple Description Widget=[@@(%0 Person, %1 Desc, %2 Detail name, %3 Detail)]set(%0,[edit(MULTIDESC`%1`%2,%b,_)]:%3)1
&HELPFILE Multiple Description Widget=[ansi(hb,Syntax)]:%r[ansi(hc,+desc/list)]: Lists the names of all saved descriptions. %r[ansi(hc,+desc/write <keyword>=<description>)]: Creates a new description and saves it under the keyword.%r[ansi(hc,+desc/edit <keyword>=<description>)]: Over-writes a currently saved desc with the new desc input.%r[ansi(hc,+desc/save <keyword>)]: Saves your current @desc under the keyword.%r[ansi(hc,+desc/view <keyword>)]: Views the given description.%r[ansi(hc,+desc/use <keyword>)]: Change your current @desc for the specified one.%r[ansi(hc,+desc/use +<keyword>)]: Appends the specified desc to your current one.%r[ansi(hc,+desc/use <keyword>+<keyword2>+<keyword3>)]: Allows you to chain together several descriptions in any particular order you choose. By default, they will string together with no carriage returns between them.%r[ansi(hc,+desc/use <keyword>+<formatting+<keyword2>)]: Allows you to chain together descriptions with formatting between each entry. %rEg: +desc/use body+\%r\%r+clothes+accessories.%r[ansi(hc,+desc/delete <keyword>)]: Deletes the specified description.%r%r[ansi(hb,Description:)] BDM's multi-description system allows players to store and use multiple different descriptions in any number of combinations and order for their characters, as well as to access division descriptions for use, such as Alliance uniforms.%r%rYou may also set +viewable details on your character descriptions. See +help +view for details.
&HELPFILE2 Multiple Description Widget=[ansi(hb,ADDING DETAILS TO A DESCRIPTION --%rSyntax)]: %r[ansi(hc,+desc/detail <desc keyword>/<detail keyword>=<detail description>)]: This will allow you to select a keyword in a description you have saved through the +desc system, and to add some detailed information about it.%rEg: [ansi(y,+desc/detail DailyOutfit/Boots=These boots are made for walking...)] %r[ansi(hc,+desc/details <desc keyword>)]: Allows you to view the details on a particular description you have stored.%r%r[ansi(hb,VIEWING DETAILS ON A CHARACTER --%rSyntax)]: %r[ansi(hc,+view <player>/<detail keyword>)]: If a character has any details added to their description, you will see \[Keyword\] to indicate the +viewable keywords.

look Multiple Description Widget