___________________________________

A TADS Tutorial: Lesson Two

Some Common Mistakes

___________________________________

Review

During Lesson 1 you had an opportunity to work with a text editor, the TADS compiler, and the TADS run-time engine. You were asked to use your text editor to type in a program called "exercise1.t". Then you compiled it, which produced a game file called "exercise1.gam". Then, you ran your program with the TADS runtime engine.

Hopefully you understood the exercise well enough to begin creating a story on your own. If you didn't, you might want to re-read the lesson, carefully, or examine the help files for your operating system to learn how to launch different programs and quit them, and how to navigate through directories or folders. You should also play a game written in TADS to get a better idea what we are trying to accomplish.

___________________________________

Common Mistakes

As many of you discovered, computers are picky. If you don't type in the program correctly, the computer can't figure out what you meant. In fact, every little mistake that you made when typing the program really screwed up the compiler. But try not to get flustered when you see a long list of compiler errors. Initially, these error messages will seem really confusing, but eventually, you'll learn to make sense out of them. Many of the error messages mention line numbers in parentheses that can help you track down the problem. You can also ask a friend to look over your program to see if he can help you spot a mistake.

Programmers don't expect their programs to run perfectly the first time. It is normal to have many mistakes the first time you run the program. In computer lingo, we call programming mistakes "bugs." The process of fixing mistakes is called "debugging." With more experience, you will make less mistakes, but you will always make some mistakes that need to be fixed.

Here is a list of the most common mistakes that I see people make. Please keep these tips in mind when completing this exercise or working on future exercises:

The lines at the beginning of the program:

#include <adv.t>
#include <std.t>

must be flush left with no extra spaces for the program to work properly. Many people forget the semicolon at the end of each room. Some people also forget to save the file to directory they use for TADS. This causes some confusion when looking for the game file to run.

Give your program a name that has no spaces in it (like "exercise1.t", not "My Exercise 1.t").

Check your quote marks ("). Make sure that each description (sdesc or ldesc) begins and ends with a quote mark. Since quote marks have a special meaning to the compiler, don't use quote marks as part of your description. We'll talk about how to do that in a later class.

Check your spelling. Several errors were caused by the misspelling of a property name, like ldesc or north. For now, the only words you need to use on the left side of an equal sign are one of the following:

sdesc, ldesc, north, south, east, west, ne, se, nw, sw, up, down, in, out

If you find a mistake in your game while you are playing it, make sure to quit the game before recompiling your program, otherwise the compiler might not be able to rewrite the new game file.

Every room must have a name (like startroom or cave). This name is not something the player will ever see, but is the way that you will refer to the room when programming your game. The name must not contain spaces and must not be enclosed in quotes. Quotes are only used to surround descriptions that the player will see.

Use the tab key to properly indent your program. Although the indenting doesn't matter to the compiler, it will make it easier to spot mistakes.

___________________________________

The Exercise From Lesson One

If you had difficulty with the last exercise, please continue working on it. It is very important that you master this initial material before continuing to the next exercise.

___________________________________

Exercise for Lesson Two

Download the file "plant_2.zip" from http://www.ifarchive.org/games/tads/. This game, called "The Plant," took third place in the 1998 Interactive Fiction competition. The game takes about two to three hours to play. At any time, you can "SAVE" your progress, and then "RESTORE" at a later time to resume your game. This game contains a number of challenging puzzles, so if you get stuck, play it with a friend, or ask the Usenet discussion group rec.games.int-fiction for help (be patient).

Draw a map of the game on notebook paper as you play the game. Each room should be represented by a box. The box should contain the "short description" name of the room. You should also list in the corner of the box all the key objects in the room that are visible. Use a dotted line to represent any connection between rooms that cannot be traversed until after a puzzle is solved. Use an arrow to represent one-way pathways. Clearly mark pathways representing up or down directions with a "U" or "D," respectively.

I have begun the map for you, so you can see how it should look:

Map

Playing this game should give you a good idea of what we're trying to accomplish. By the end of this tutorial, you all should have the necessary skills to write your own interactive fiction at this level of quality. Maybe next year, your story will win the competition!
Go on to Lesson Three
Go Back to Lesson One
See the Table of Contents

The Text Adventure Development System
Version 2.2
This page is part of Mark Engelberg's TADS Tutorial
Copyright © 1999 Mark Engelberg