Discworld Documentation:

LPC for Dummies

Written by Drakkos Wyrmstalker

N.B - This is a work in progress... a living document if you like. If it appears to be dead when you view it, don't worry. It's most likely just playing possum.

Comments on these chapters and tutorials can be e-mailed to Drakkos.

Introduction

The intention behind this set of documents is to provide an introduction to some of the fundamental concepts you'll need to understand as a creator on Discworld. We'll be taking a quick drive through scary looking territory: Inheritance, functions, logical operators and data types. However, don't be alarmed, as you'll soon see that these are things that are Notte To Be Feared! Hopefully by the end of these documents you'll feel comfortable with some of the basic concepts that are needed to appreciate the later tutorials.

Disclaimer: Please note that these documents are a work in progress. Feedback would be appreciated on all aspects, particularly if you are a newbie creator looking at these documents as a teaching aid. Areas that are deficient or need further explanation (or are just plain wrong), can be mudmailed or emailed to me, Drakkos, and I shall endeavour to modify the documents accordingly. Many thanks.

N.B. Large patches of these documents were written at three in the morning, on any number of seperate occasions. Go easy on me. :-P

Table Of Contents

Theory:

Part One :A brief introduction to LPC and a short explanation of high and low level programming languages. We use LPC here on Discworld... read this, and you'll learn why.

Part Two : An introduction to the various data types in LPC, and examples of how and when they would be used.

Part Three : Lfuns and Efuns and Sfuns, oh my!

Part Four : An overview of inheritance, and how it works in respect with LPC's object orientated hierarchy.

Part Five: Flow Control... sequential, selection and repetition structures, unveiled in all their glory!

Part Six : Operators in LPC, and how they can be used to Control Your Flow With Style!

The above sections cover the theory of coding, such as control flow, inheritance, data types and functions. Even if you are familiar with coding in other environments, you should have at least a glance over the above to familiarise yourself with the peculiarities of LPC.

If you have never coded before, you should make sure you read and understand everything above before you progress on to the tutorials.

Practical:

Tutorial One : Tutorial one starts off with the basics and explains how one goes about creating a basic NPC.

Tutorial Two : Tutorial two builds on what we did in tutorial one, and covers the basics of creating a room and moving an NPC into that room.

Tutorial Three : Tutorial three further expands on what we've already learned and explains how to create basic objects. It also touches on virtual objects and how they work.

Tutorial Four : Tutorial four builds on what was learned about rooms in the basic tutorial, and explains day/night longs/items/chats, search functions, modify_exits, the linker, and more besides!

Tutorial Five : Tutorial five expands a little on what we learned about NPCs, and discusses unique NPCs, guilds and races, spells and combat actions, and more!

Tutorial Six : Tutorial six finishes off this document and looks at coding objects again. It covers creating containers, wear and remove functions, wield functions and attack functions.

If you are familiar with the material in the theoretical parts above, you should attempt to work your way through each of these tutorials. They cover the basics (and the not-quite-so-basics) of room, NPC and object coding. If you follow and practise the instructions in these, you should be comfortable with everything you need to know for starting out on your first project.

Tutorial Exercises

For those who wish to try learning some extra code after completing the six tutorials above, there is also a list of possible exercises here. The answers to these tutorial questions are located here.

No peeking before you've given the exercises a shot yourself!

Other Useful Documents

Although not directly related to coding, The Ten Commandments of Room Descriptions is another document I wrote that will go over some of the more important Dos and Don'ts of writing good room descriptions.