Closet Example Code

Mush Code

Mush Code is the general term for MUD/MUSH in game scripting. It's used by players to simplify often repeated tasks and by designers to add custom commands to special objects.

Getting it to work requires the object/player use:

@set <object>=!no_command

This allows the object to process the Mushcode commands that are being added.

Some common uses include creating a closet to simplify changing clothing, creating vehicles, and processing vending machine requests.

Closet Example

Copy and paste the code into the command line for your mush client. 

@desc me=%b%b[u(description`person)]%r[ansi(h,He is dressed in:)%r%b%b[iter([u(description`clothes_worn)],[u(description`clothes`##)], ,%r%b%b)]

&command`closet`add_clothes me=$aclothes * *:@set me=description`clothes`%0:%1

&command`closet`delete_clothes me=$dclothes *:&description`clothes`%0 me

&command`closet`get_dressed me=$dress *:@set me=description`clothes_worn:%0

&command`closet`list_clothes me=$lclothes:@emit Closet:%r[regeditall(edit(lattr(me/description`clothes`,-,DESCRIPTION`CLOTHES`,),-,%r)]

&command`closet`undress me=$undress:&description`clothes_worn me

&command`closet`describe_me me=$descme *:@set me=description`person %0

Usage

aclothes <name> <description> - creates a piece of clothing named <name> that adds <description> to your description when worn.

 dclothes <name> - removes a piece of clothing named <name> from the closet.

 dress <name1> [<name2> <name3> ...] - sets the clothing currently worn.

 undress - clears the list of clothing worn

 lclothes - lists the <name> of all of the pieces of clothing in the closet.

 descme <description> - sets the character's description.