NOTE: In this file I'm going to stop using parentheses to show placeholders in my code examples, since we're getting rather close to the point where you'll actually need parentheses in your code. Placeholders, which you should of course replace with something appropriate to your situation, are now in italics instead of parentheses.
Now that you know how to use @a-attributes, $-commands, ^-commands, @triggers, and all your other favorite punctuation characters to put at least some basic code on an object, something might have occured to you. How do you work with the code once you've put it on an object?
The big picture
To see everything you could possibly want to know about an object you own,
including all the attributes that are set on it, use the 'examine' command.
Just use examine (object)
the same way you would use look
(object)
. Your screen will soon fill up with information about the
object.
What if you want to make a backup copy of an object, such as by saving its code on your hard disk? You can use the '@decompile' command. This command is similar to 'examine', except instead of just showing you the data on an object, it shows you the MUX commands you should type in order to create an object containing that data.
You then take the many lines of code that appear, and either use your MUX client's log feature or cut and paste to put the text in a file and save it. Thus, @decompile can be used to save copies of your code or even to move it between MUXes.
Changing attributes
By now you should know how to set attributes, but here's a reminder.
The two
types of attributes are @-attributes (not quite the same as @a-attributes) and
&-attributes. @-attributes are predefined attributes by the MUX that do
stuff in response to something happening, such as someone picking up an object
or going through an exit, and the entire list of them can be seen in 'help
commands2'. You set an @-attribute by typing @(attribute name) me=(contents),
for example: @desc me=This is a really horrible description.
&-attributes can be named anything you want, and are not triggered by the MUX on their own. They can contain any kind of data, but it's useful to put things in them like $-commands and ^-commands. You set an &-attribute by typing &(attribute name) me=(contents).
What if you mistype an attribute or you decide later you want to put something better in it? It's very easy to change an attribute - you just set it again. The new attribute will overwrite the old one. If you want to remove an attribute, set it to nothing. Don't type anything for (contents). Heck, you don't even have to type the = in that case.
The trickier part is changing an attribute to something very similar, like to fix a typo. You could, of course, examine the attribute, copy and paste the attribute text (hoping that the spacing will remain intact) into your input window, and edit the code there before pressing ENTER to set the attribute again. In fact, on many clients, this is how you will end up doing it.
If you have SimpleMU, I recommend looking in its help files for /grab, and in TinyFugue you can download the FugueEdit macro from Kareila's webpage. These take an object's attribute and grab its code directly into your input window where you can edit it. This is a very nice alternative to copying and pasting.
If you just need to make a small change to an object, you don't have to worry about that stuff. You can use the @edit command. The syntax of the @edit command is:
@edit object/attribute={old text},{new
text}
This command will search through &attribute on object for old text, and replace it each time with new text.
Those {braces} up there ARE things you should type. If the text you're editing has no commas in it, you can get away with not using the braces, but otherwise you need to use them, and it's a good habit anyway.
Examples:
@desc me=Joe is a huge green flyingwombat with an excesively short
description.
@edit me/desc={flyingwombat},{flying wombat}
@edit me/desc={excesively},{excessively}
@cpattr and @mvattr
You might find yourself wanting to use these commands - they copy an attribute
and move an attribute, respectively. The problem with them is that, though they
have such similar purposes, the syntax is totally different. No, I don't know
why.
To make a copy of an attribute: @cpattr
object/attribute=object/attribute
Either object or attribute might be the same on both sides,
but obviously at least one of them has to be different. Incidentally, if
attribute stays the same, you can leave it out the second time.
However, to move an attribute: @mvattr
object=attribute,attribute
Note that the target object is left out. You can only @mvattr
something to the same object.
It's good to be aware of this discrepancy before you mess something up because of it. I certainly have done so before.