Personal Descer (Softcode)
(Redirected from User:Nerdvana/descer)
Jump to navigation
Jump to search
My descer code allows for the storage of descriptions in whole or in pieces. They are stored on your character object so it will make your personal examine spammy but it works well for me and so I wanted to share this with the MUSH.
In order to use it, copy the following lines to the MUSH and after setting them type .desc/help to see/read the help files about the commands for the descer.
&CMD-DESC-SAVE me=$.desc/save *:@switch hasattr(me,desc-%0)=1,{@pemit me=[udefault(FN-DESC,%xh%xb.Desc:%xn)] '[capstr(%0)]' is already a stored desc. Use '%xh%xy+desc/replace <name>%xn' if you want to overwrite it.},0,{@set/quiet me=desc-%0:[get(me/desc)];@pemit me=[udefault(FN-DESC,%xh%xb.Desc:%xn)] You have stored your current desc under '[capstr(%0)]'} &CMD-DESC-STORE me=$.desc/store *=*:@switch hasattr(me,desc-%0)=1,{@pemit me=[udefault(FN-DESC,%xh%xb.Desc:%xn)] '[capstr(%0)]' is already a stored desc. Use '%xh%xy+desc/replace <name>=<desc>%xn' if you want to overwrite it.},0,{@pemit me=[udefault(FN-DESC,%xh%xb.Desc:%xn)] You stored '[capstr(%0)]' as '%1';@set/quiet me=desc-%0:%1} &CMD-DESC-WEAR me=$.desc/wear *:@pemit me=[iter(%0,switch(hasattr(me,desc-##),0,%r[udefault(FN-DESC,%xh%xb.Desc:%xn)] '[capstr(##)]' is not a stored desc.,1,%r[udefault(FN-DESC,%xh%xb.Desc:%xn)] '[capstr(##)]' has been stored in your desc.))];@set/quiet me=desc:[iter(%0,[get(me/desc-##)]%b)];@set/quiet me=dlast:%0 &CMD-DESC-LAST me=$.desc/last:@pemit me=[udefault(FN-DESC,%xh%xb.Desc:%xn)] [get(me/dlast)] &CMD-DESC-LIST me=$.desc/list:@switch words(lattr(me/desc-*))=0,{@pemit me=[udefault(FN-DESC,%xh%xb.Desc:%xn)] You do not have any stored descs.},@pemit %#=%xh%xb[center(< .Desc Listing >,76,-)]%r%xn[iter(lattr(me/desc-*),[after(##,DESC-)] - [strtrunc(get(me/##),sub(77,strlen(##)))],,%r)]%r%xh%xb[repeat(-,76)]%xn &CMD-DESC-LIST2 me=$.desc/list *:@switch words(lattr(me/desc-*))=0,{@pemit me=[udefault(FN-DESC,%xh%xb.Desc:%xn)] You do not have any stored descs.},@pemit %#=%xh%xb[center(< .Desc Listing >,76,-)]%r%xn[iter(lattr(me/desc-*%0*),[after(##,DESC-)] - [strtrunc(get(me/##),sub(77,strlen(##)))],,%r)]%r%xh%xb[repeat(-,76)]%xn &CMD-DESC-FULLLIST me=$.desc/fulllist:@switch words(lattr(me/desc-*))=0,{@pemit me=[udefault(FN-DESC,%xh%xb.Desc:%xn)] You do not have any stored descs.},@pemit me=%xh%xb[center(< .Desc Full Listing >,76,-)]%xn;@dolist [lattr(me/desc-*)]=@pemit me=[after(##,DESC-)] - [get(%#/##)]%r%xh%xb[repeat(-,76)]%xn &CMD-DESC-FULLLIST2 me=$.desc/fulllist *:@switch words(lattr(me/desc-*))=0,{@pemit me=[udefault(FN-DESC,%xh%xb.Desc:%xn)] You do not have any stored descs.},@pemit me=%xh%xb[center(< .Desc Full Listing >,76,-)]%xn;@dolist [lattr(me/desc-*%0*)]=@pemit me=[after(##,DESC-)] - [get(%#/##)]%r%xh%xb[repeat(-,76)]%xn &CMD-DESC-LOOK me=$.desc/look *:@pemit me=%xh%xb[repeat(-,76)]%xn %r[udefault(FN-DESC,%xh%xb.Desc:%xn)] [switch(hasattr(me,desc-%0),0,'[capstr(%0)]' is not a stored desc.,[capstr(%0)] %r[u(me/DESC-%0)])] %r%xh%xb[repeat(-,76)]%xn &CMD-DESC-EXAM me=$.desc/exam *:@pemit me=%xh%xb[repeat(-,76)]%xn %r[udefault(FN-DESC,%xh%xb.Desc:%xn)] [switch(hasattr(%#,desc-%0),0,'[capstr(%0)]' is not a stored desc.,[capstr(%0)]: [get(%#/desc-%0)])] %r%xh%xb[repeat(-,76)]%xn &CMD-DESC-EDIT me=$.desc/edit *=*/*:@switch hasattr(me,desc-%0)=0,{@pemit me=[udefault(FN-DESC,%xh%xb.Desc:%xn)] '[capstr(%0)]' is not a stored desc.},{@pemit me=[udefault(FN-DESC,%xh%xb.Desc:%xn)] You changed '[capstr(%0)]' from %r%b [get(me/desc-%0)] %r TO %r%b [edit(get(me/desc-%0),%1,%2)];@set/quiet me=desc-%0:[edit(get(me/desc-%0),%1,%2)]} &CMD-DESC-REPLACE me=$.desc/replace *:@switch %0=*=*,{@pemit me=[setq(0,before(%0,=))][setq(1,after(%0,=))][udefault(FN-DESC,%xh%xb.Desc:%xn)] [switch(hasattr(me,desc-%q0),1,You overwrote '[capstr(%q0)]' as a stored desc with '%q1'.,'[capstr(%q0)]' wasn't a stored desc\, but is now.)];&desc-%q0 me=%q1},{@pemit me=[udefault(FN-DESC,%xh%xb.Desc:%xn)] [switch(hasattr(me,desc-%0),1,You overwrote '[capstr(%0)]' as a stored desc with your current desc.,'[capstr(%0)]' wasn't a stored desc\, but is now.)];@set/quiet me=desc-%0:[get(me/desc)]} &CMD-DESC-DEL me=$.desc/del *:@pemit me=[udefault(FN-DESC,%xh%xb.Desc:%xn)] [switch(hasattr(me,desc-%0),0,'[capstr(%0)]' is not a stored desc.,You deleted '[capstr(%0)]' from your stored descs.)];@set/quiet me=desc-%0: &CMD-DESC-CREDITS me=$.desc/credits:@pemit me=[udefault(FN-DESC,%xh%xb.Desc:%xn)] This code was adapted to player-based code by Vic from global-based code created by her player's RL spouse. &CMD-DESC-HELP me=$.desc/help:@pemit me=[center(%xh%xb< .Desc Help >%xn,78,%xh%xb-%xn)]%r%b %xh%xy.desc/help%xn%xy%[%xh2%xn%xy%]%xn%r%tPulls up this help file or its second part with 2 at the end.%r%b %xh%xy.desc/save%xn %xy<Descname>%xn%r%tStores your current @desc as <Descname> exactly as it is set.%r%b %xh%xy.desc/store%xn %xy<Descname>%xn%r%tStores the provided <Desc> as <Descname> without evaluating it.%r%b %xh%xy.desc/wear%xn %xy<List of Descnames>%xn%r%tStores the listed descs in the order provided in the command as your %r%t@desc, replacing your existing @desc.%r%b %xh%xy.desc/last%xn%r%tReturns the last list of Descnames worn with the /wear command.%r%b %xh%xy.desc/list%xn%r%tDisplays a list of your descs by Descname with a single line of text.%r%b %xh%xy.desc/fulllist%xn%r%tDisplays the complete contents of each of your stored descs.%r[center(%xh%xb< %xccontinued in %xy.desc/help2 %xb>%xn,78, %xh%xb-%xn)] &CMD-DESC-HELP2 me=$.desc/help2:@pemit me=[center(%xh%xb< .Desc Help %xcPart 2%xb >%xn,78, %xh%xb-%xn)]%r%b %xh%xy.desc/look%xn %xy<Descname>%xn%r%tDisplays <Descname> in its evaluated form.%r%b %xh%xy.desc/exam%xn %xy<Descname>%xn%r%tDisplays <Descname> in its unevaluated form.%r%b %xh%xy.desc/edit%xn %xy<Descname>%xh=%xn%xy<String1>%xh/%xn%xy<string2>%xn%r%tEdits <Descname> by replacing <string1> with <string2>.%r%b %xh%xy.desc/del%xn %xy<Descname>%xn%r%tDeletes <Descname> from your stored descs.%r%b %xh%xy.desc/replace%xn %xy<Descname>%xn%r%tDeletes the current contents of <Descname> and replaces it with your %r%tcurrent @desc. If <Descname> does not exist, it is created by storing %r%tyour current @desc in that <Descname>.%r%b %xh%xy.desc/credits%xn%r%tDisplays the information about the history of this code.%r[repeat(%xh%xb-%xn,78)]