Moria's Multi-Descer

Descer function

This descer comes with a built in help function, and can add, remove and list items in the following categories: core descriptions (basic), outfits (outfit) and knots (knot). If you have any questions or problems, please poke Moria. This descer is adapted from one used on CrystalMUSH.

This descer stores the outfits, knots and descriptions on itself. This keeps your character's object clean and clutter-free, but it means you will want to make an @decom of the descer regularly to archive your descs.

All commands to be entered into your terminal for creating this object are in offset text sections.

For those who want to just run everything without looking at what each step does, this link will drop you to the end of the page, where the full code is stored in a collapsed section. Copy & paste, and have fun.

How to Create

1) Create the actual object. For the purposes of this code, I'm calling it Descer.

@create Descer=10

2) You will need to enable to descer to affect you. As such, you will be enabling the INHERIT (I) flag on yourself. If you are curious about what this does, check out 'help inherit'. You are also going to set the COMMANDS ($) flag to enable the descer object to recognize and parse commands. As with INHERIT, see 'help commands' for more info about how this flag works.
@set Descer=inherit
@set Descer=commands

3) To prevent other people from triggering the Descer's commands, you will need to @lock it to yourself. See 'help @lock' for an in-depth explanation of what kinds of locks and keys are available for use.
@lock Descer=me
@lock Descer/use=me

4) Now you can load all the commands into the Descer:

a) +Setup configures your character's @desc and some other attributes (basic, wearing and knot) for the Descer to manipulate. Make sure you have your @desc backed up before you actually use this command!

&CMD-SETUP Descer=$+setup:@desc %#=\[u(BASIC)]\%r\%r\[u(WEARING)]\%r\%r\[u(KNOT)];&WEARING %#=;&KNOT %#=;@pemit %#=Setup successfully completed.

b) +add has three parts - one for each section of your desc - and adds a new description of the chosen type under the assigned name. It will throw an error if you have already used that name.
&CMD-ADDBASIC Descer=$+add basic *=*:@switch/first 1=sign(match(lattr(me/BASIC-*),BASIC-%0)),@pemit %#=Basic desc "%0" already exists.,{&BASIC-%0 me=%1;@pemit %#=Basic desc "%0" added.}
&CMD-ADDOUTFIT Descer=$+add outfit *=*:@switch/first 1=sign(match(lattr(me/OUTFIT-*),OUTFIT-%0)),@pemit %#=Outfit desc "%0" already exists.,{&OUTFIT-%0 me=%1;@pemit %#=Outfit desc "%0" added.}
&CMD-ADDKNOT Descer=$+add knot *=*:@switch/first 1=sign(match(lattr(me/KNOT-*),KNOT-%0)),@pemit %#=Knot desc "%0" already exists.,{&KNOT-%0 me=%1;@pemit %#=Knot desc "%0" added.}

c) +rem allows you to delete any desc off the Descer.
&CMD-REM Descer=$+remove/*=*:@swi/first 0=match(basic outfit knot,%0),{@pemit %#=Valid categories are basic, outfit and knot.},match(lattr(me),%0-%1),@pemit %#=There is no '[lcstr(%1)]' desc in category [lcstr(%0)].,{@wipe me/%0-%1;@pemit %#=Desc '[lcstr(%1)]' deleted from category [lcstr(%0)].}

d) +list has two parts - one to list the names of each desc and what category, the other to view the individual desc.
&CMD-LIST Descer=$+list:@pemit %#=[ljust(Basic Descs:,14)][parse(lattr(me/basic-*),%b[capstr(lcstr(after(##,-)))])]%r%r[ljust(Outfits:,14)][parse(lattr(me/outfit-*),%b[capstr(lcstr(after(##,-)))])]%r%r[ljust(Knot Descs:,14)][parse(lattr(me/knot-*),%b[capstr(lcstr(after(##,-)))])]%r%r
&CMD-LISTC Descer=$+list/* *:@swi/first 0=match(basic outfit knot,%0),{@pemit %#=Valid categories are basic, outfit and knot.},words(lattr(me/%0-%1)),@pemit %#=There is no '[lcstr(%1)]' desc in the [lcstr(%0)] category.,{@pemit %#=[lcstr(%1)]%r[u(%0-%1)]%r}

e) +change also has three parts, and lets you select which desc in each category you want to use.
&CMD-CHBASIC Descer=$+change/basic *:@switch/first 0=sign(match(lattr(me/BASIC-*),BASIC-%0)),@pemit %#=There is no "%0" basic desc.,{&BASIC %#=\[get_eval([num(me)]/BASIC-%0)];@pemit %#=You change your basic desc to "%0".}
&CMD-CHOUTFIT Descer=$+change/outfit *:@switch/first 0=and(match(lattr(me/OUTFIT-*),OUTFIT-%0)),@pemit %#={There is no "%0" outfit desc.},{&WEARING %#=\[get_eval([num(me)]/OUTFIT-%0)];@pemit %#=You change your outfit desc to "%0".}
&CMD-CHKNOT Descer=$+change/knot *:@switch/first 0=sign(match(lattr(me/KNOT-*),KNOT-%0)),@pemit %#=There is no "%0" knot desc.,{&KNOT %#=\[get_eval([num(me)]/KNOT-%0)];@pemit %#=You change your knot desc to "%0".}

f) Finally, @desc the Descer so you have a handy-dandy help file available to guide you through using it!
@Desc Descer=[repeat(-,78)]%r[center(Descer Help,78)]%r[repeat(-,78)]%r%r[ljust(+setup,20)]sets up a char's desc for changeable basic desc, outfits and knots.%r%rWARNING: Setting up will erase your current desc! Please make a record of it before setting up!%r%r[ljust(+add basic <name>=<desc>,35)]adds a basic desc saved, as <name>.%r[ljust(+add outfit <name>=<desc>,35)]adds a outfit desc, saved as <name>.%r[ljust(+add knot <name>=<desc>,35)]adds a knot desc saved, as <name>.%r%r[ljust(+change/basic <name>,25)]changes your basic desc to <name>.%r[ljust(+change/outfit <name>,25)]changes your outfit desc to <name>.%r[ljust(+change/knot <name>,25)]changes your knot desc to <name>.%r%r[ljust(+remove/<category>=<name>,28)]Deletes <name> from <category>.%r%r[ljust(+list,25)]lists the available descs in all categories by name.%r[ljust(+list/<category> <name>,25)]displays the <name> desc in <category>.%r[repeat(-,78)]%r

How to Use

Once you have your descer programmed, use +setup to configure your desc for it to update, then take a look at the object to get an idea of how it works. Have fun +add'ing your descs, and remember to +change into one of each category to make sure everything is running smoothly and to get your desc updated so you aren't a blank slate!

Full code

Here's the full code in a single set for those who want to just dump it into their terminal.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License