MG Mud User | 88f1247 | 2016-06-24 23:31:02 +0200 | [diff] [blame^] | 1 | LPC Basics |
| 2 | Written by Descartes of Borg |
| 3 | first edition: 23 april 1993 |
| 4 | second edition: 25 may 1993 |
| 5 | |
| 6 | CHAPTER 1: Introduction to the Coding Environment |
| 7 | |
| 8 | 1.1 UNIX file structure |
| 9 | LPMuds use basic UNIX commands and its file structure. If you know |
| 10 | UNIX commands already, then note (with a few exceptions) options are |
| 11 | not available to the commands. Like DOS, UNIX is heirarchical. The |
| 12 | root directory of which all directories are sub-directories is called |
| 13 | root(/). And from those sub-directories you may have further |
| 14 | sub-directories. A directory may be referred to in two different ways: |
| 15 | 1) by its full name, or absolute name, or 2) by its relative name. |
| 16 | Absolute name refers to the directory's full path starting from / winding |
| 17 | down the directory tree until you name the directory in question. For |
| 18 | example: |
| 19 | |
| 20 | /players/descartes/obj/monster |
| 21 | |
| 22 | refers to the directory monster which is a sub-directory of obj which |
| 23 | is a sub-directory of descartes which is a sub-directory of players |
| 24 | which is a sudirectory of /. |
| 25 | |
| 26 | The relative name refers to the name relative to another directory. |
| 27 | The above example is called monster relative to /players/descartes/obj, |
| 28 | but it is also called obj/monster relative to /players/descartes, |
| 29 | descartes/obj/monster relative to /players, and finally |
| 30 | players/descartes/obj/monster relative to /. You can tell the |
| 31 | difference between absolute names and relative names because absolute |
| 32 | names always start with /. In order to know exactly which directory |
| 33 | is being named by a relative name, you naturally must know what |
| 34 | directory it is relative to. |
| 35 | |
| 36 | A directory contains sub-directories and files. LPMuds only use text files |
| 37 | inside the mudlib. Like directories, files have both absolute and |
| 38 | relative names. The most basic relative name is often referred to as the file |
| 39 | name, with the rest of the absolute name being referred to as the path. So, |
| 40 | for the file: /players/descartes/castle.c, castle.c is the file name, and |
| 41 | /players/descartes is the path. |
| 42 | |
| 43 | On some muds, a file with a file name beginning with a . (like .plan) is |
| 44 | not visible when you list files with the regular file listing command. |
| 45 | |
| 46 | 1.2 UNIX Commands |
| 47 | Along with the UNIX file structure, LPMuds use many UNIX commands. Typical |
| 48 | UNIX commands on most muds are: |
| 49 | pwd, cd, ls, rm, mv, cp, mkdir, rmdir, more, head, cat, ed |
| 50 | If you have never before seen UNIX commands, you probably are thinking this |
| 51 | is all nonsense. Well, it is, but you got to use them. Before getting |
| 52 | into what they mean though, first a discussion of current directory. |
| 53 | If you know DOS, then you know what a current working directory is. |
| 54 | At any given point, you are considered to be "in" some directory. This |
| 55 | means that any relative file or directory names you give in UNIX commands |
| 56 | are relative to that directory. For example, if my current directory is |
| 57 | /players/descartes and I type "ed castle.c" (ed is the command to edit), |
| 58 | then it assumes I mean the file /players/descartes/castle.c |
| 59 | |
| 60 | pwd: shows you your current working directory |
| 61 | cd: changes your current working directory. You may give either relative |
| 62 | or absolute path names. With no arguments, it changes to your home |
| 63 | directory. |
| 64 | ls: lists all files in the directory named. If no directory is named, |
| 65 | it lists the files of the current working directory |
| 66 | rm: deletes the file named |
| 67 | mv: renames the file named |
| 68 | cp: copies the file named |
| 69 | mkdir: makes a new directory |
| 70 | rmdir: deletes a directory. All files must have been first removed. |
| 71 | more: pages the file named so that the file appears on your screen one |
| 72 | page at a time. |
| 73 | cat: shows the whole file to you at once |
| 74 | head: shows you the first several lines of a file |
| 75 | tail: shows you the last several lines of a file |
| 76 | ed: allows you to edit a file using the mud editor |
| 77 | |
| 78 | 1.3 Chapter Summary |
| 79 | UNIX uses a heirarchical file structure with the root of the tree being |
| 80 | named /. Other directories branch off from that root directory and |
| 81 | in turn have their own sub-directories. All directories may contain |
| 82 | directories and files. Directories and files are referred to either |
| 83 | by their absolute name, which always begins with /, or by their relative |
| 84 | name which gives the file's name relative to a particular directory. |
| 85 | In order to get around in the UNIX files structure, you have the |
| 86 | typical UNIX commands for listing files, your current directory, etc. |
| 87 | On your mud, all of the above commands should have detailed help commands |
| 88 | to help you explore exactly what they do. In addition, there should |
| 89 | be a very detailed file on your mud's editor. If you are unfamiliar |
| 90 | with ed, you should go over this convoluted file. |