/
lib/banish/
lib/d/
lib/doc/
lib/doc/domains/
lib/doc/efun/
lib/doc/examples/
lib/doc/examples/armour/
lib/doc/examples/contain/
lib/doc/examples/food/
lib/doc/examples/magic/
lib/doc/examples/monster/
lib/doc/examples/room/
lib/doc/examples/weapons/
lib/function/
lib/include/
lib/include/fn_specs/
lib/include/skills/
lib/info/
lib/inherit/base/
lib/log/
lib/manuals/312/
lib/news/
lib/obj/party/
lib/objects/components/
lib/open/
lib/open/library/
lib/open/party/
lib/players/
lib/players/zilanthius/
lib/room/
lib/room/city/arena/
lib/room/city/creator/
lib/room/city/garden/monst/
lib/room/city/obj/
lib/room/city/shop/
lib/room/death/
lib/room/registry/
lib/secure/
lib/secure/UDP_CMD_DIR/
lib/skills/
lib/skills/fighter/
lib/skills/thief/
lib/usr/
lib/usr/creators/
lib/usr/players/
                 -=[ LPC Basics ]=-

Introduction:

The purpose of this document is to introduce to the new wizard
the basic concepts of LPC coding. My experience has shown that
there is a large number of wizards who are able to use
configurable object files (room, armour, weapon, etc), but
have little idea on why, or what they are coding.

The examples shown are in my coding style, which is one of a
number I have seen. I will also be coding using strict types,
as this is more correct. I hope I don't make too many typo's
in the lpc examples.



LPC mud structure:

LPC is object orientated. A sword is a complete "object",
entirely separate from all other code. Actions are an
interaction between one object and another. A player is
interactive action between the object player and other
objects. A room is an object, A player is an object placed in
the room object, A sword is an object in the player object in
the room object. You might already summise that you need
particular functions that allow you to find the position of an
object, and interaction between objects.

Though not strictly true I will I will call the source file,
the object. This is more convenience then anything else.



Objects:

The most basic object is created from a source file which is
empty (0 bytes). This of course would do nothing. There are a
number of "standard" functions, if placed in an object will
allow it to interact with the "player" object. But before we
can look at this you must understand some basic LPC language.
I am going to work on the assumption that you have only very
basic concepts of programming, programming algorithims, and 
the language C.



Language:

LPC is a 'block-structured' language, and like
Kernighan/Ritchie C, was developed for the UNIX. The game
parser is usually compiled on FSF's GNU g++. That is why
LPCMuds use a unix style file, and directory system. Though
there are those trying to port it to other platforms with a
minimum of success. 



Debugging at home:

For those with micros at home, there is an amiga port
available by anonymous ftp at "ftp.cd.chalmers.de"; I have
never used it. There is a Msdos port that needs a minimum of a
386-sx. It is found at "ftp.ccs.neu.edu" (ok312exe.exe,
ok312lib.exe). I have used this, it is good for debugging (and
it won't run via a net...so forget about tryiny to start your
own mud on an msdos platform - Why bother ;) ). Though I have
found it tends to scramble files occasionally. 



Editor:

LPCMud has an on-line line editor. Unless the administrator of
your mud has a large and fast machine, you will not see a VI
editor on a mud. If you want this, then code it at home or on
the PC. I personally use wordperfect (text-out), and use the
file insert mode of the telnet application, or ftp if the mud
has such a facility.



Basic editor usage:
  
ed file.c  open a file for writing in your current directory 
:          prompt symbol.
i          start writing to file line above current line
.          return to prompt
Q          quit without saving
x          quit and save file
d          delete current line
2,4d       delete from line 2 to 4
2,4m10     move lines 2 to 4, to line 10
h          help
z          page through next 20 lines
4          goto line 4, etc
-2         go back 2, etc lines
/example   search for the text "example"



Loading source files:


update <object>   

if object loaded in memory, remove it. You should update an
object if you make any changes to a source file. Then try to
load it.


load <file>       

load object into memory. Failure to do so will produce an
error that is logged into /log/lower_case_your_name. I
personally make an alias on my quicktyper, "error". (alias
error tail /log/your_lower_case_name).


clone <filename>    make a clone of an object

dest <object>       destruct a clone object