Creating and working with files This lesson discusses the basics of editting files directly within the Dreamverse environment. By the end of this section, you
should be able to create a file from scratch, modify existing files, and choose whether or not to save your changes. Let's create a new file for us to work in. To do this, we will use a program called ed. ed is Dreamverse's default editor. We'll talk about more advanced ones later, but ed works well for most applications. For this exercise, we're going
to create a file called professor.c. The Professor is an NPC. For now, we're not going to worry about making it run. We're going to use the ed
program to enter text and save it into professor.c. Be careful! All MUDs are very picky about syntax. Every punctuation mark, lower case or capital letters, and space matters. Be exact when you type in these lines.
First, make sure you're in your DVU direcotry. (See about directories for more) Type <ed professor.c>. This will
open the editor. Since "professor.c" is a new file, you will see the following:
The asterisk (*) tells you that you are in input mode. Any time you see this, you are writing to the file. Type the following. Don't worry about what it means yet, but be
VERY careful with your punctuation and capital letters!
#include <lib.h> inherit LIB_NPC void create() { npc::create(); SetKeyName("professor");
SetId( ({"the professor","professor"}) ); SetShort("The Professor"); SetLong("One of the professors from Dreamverse U."); }
|
Notice that each time you press the enter key, an asterisk (*) precedes the next line. This tells you you are still in edit mode.When you have typed the last line, it's time to leave
input mode. Do this by typing a period <.> and press enter. Next exit the editor by type <x> and press enter. If you're
having trouble getting out of the editor, you most didn't enter a period properly. Type <ls>. You should see the following:
Congratulations! You created your first file! To learn about loading this file into the game, click the "Next", or click here for a full list of ed commands. |