prev | toc | next
 

3.2 Overview: MUF (cont'd)

Actually Beginning:

We'll get to MUF code itself soon, but a few words on the mechanics of making programs and their trigger actions may be in order first.

The command to make a program is @program <name of program>, or just @prog <name of program>. This does two things. It creates the program object (although there is no code in it yet), and it puts you into the MUF editor. The program is essentially a thing. You can pick it up, hand it to people, and so on, but it has the type flag F and so is treated as a different kind of object. The editor lets you enter and manipulate the text of your program, much like lsedit lets you enter and manipulate the text of a list (though the commands are different). Type q to get out of the editor (if you're in `insert' mode, you will need to type a . period and then q). Once the program is created, you can edit or add to the code with the @edit command, syntax @edit <program>.

The editor commands are:

<number> i    Insert text before line <number>. If you don't have any code in the program, you can just type `i' by itself to enter insert mode.
. Exit insert mode. (That's a period, btw)
<number> <number> l List lines <number> to <number>.
<number> <number> d   Delete lines <number> to <number>.
a Show macros (abridged version).
s Show macros (long version).
<program#> v List program's public functions.
n Toggle line numbering on and off.
c Compile the program you're editing.
u Uncompile it.
h Get help on the editor.
q Quit editor mode.

The editor is cumbersome, especially if you've never used a line-based editor (such as UNIX's ex). You may find it easier to work on your program in a text editor on your own computer or in your UNIX account, and upload it to the MUCK as needed. The following technique works well. Begin the file with:

    @q
    @edit <program name or #dbref>
    1 9999 d
    i

And end it with:

    .
    c
    q

Put the code of your program between those. Then, by pasting the whole file into your mucking window, or by using your client to upload the file onto the MUCK, you automatically quit any programs you have running, delete all old code, insert new code, and recompile. (To upload a file using TinyFugue, type /quote -0 `<filename> . The apostrophe in front of <filename> is required.) For other clients, see the program's Help menu or other documentation.

You will also need to make something that triggers the program. The most straightforward method is to open an action and link it to the program. You can also trigger it from a prop (see Section 2.1.4). If a program is set with the L flag, it is Link_OK and is in effect a public program: anyone can link to it or list it. Without the L flag, only you or a wizard can list and link to the program.

prev | toc | top | next