Learning TADS 3 by Eric Eve (For Version 3.1)
Total Page:16
File Type:pdf, Size:1020Kb
Learning TADS 3 by Eric Eve (for version 3.1) 2 Table of Contents 1 Introduction.........................................................................8 1.1 The Aim and Purpose of this Manual...........................................................8 1.2 What You Need to Know Before You Start..................................................10 1.3 Feedback and Acknowledgements.............................................................11 2 Map-Making – Rooms..........................................................12 2.1 Rooms..................................................................................................12 2.2 Coding Excursus 1: Defining Objects.........................................................13 2.3 Different Kinds of Room..........................................................................15 2.4 Coding Excursus 2 – Inheritance...............................................................17 2.5 Two Other Properties of Rooms.................................................................18 3 Putting Things on the Map....................................................20 3.1 The Root of All Things.............................................................................20 3.2 Coding Excursus 3 – Methods and Functions...............................................23 3.3 Some Other Kinds of Thing......................................................................24 3.4 Coding Excursus 4 – Assignments and Conditions.......................................27 3.5 Fixtures and Fittings...............................................................................30 4 Doors and Connectors.........................................................35 4.1 Doors...................................................................................................35 4.2 Coding Excursus 5 – Two Kinds of String....................................................37 4.3 Other Kinds of Physical Connector.............................................................40 4.4 Coding Excursus 6 – Specials Things to Put in Strings..................................46 4.5 TravelConnectors....................................................................................51 5 Containment......................................................................60 5.1 Containers and the Containment Hierarchy................................................60 5.1.1 The Containment Hierarchy...............................................................60 5.1.2 Moving Objects Around the Hierarchy..................................................61 5.1.3 Defining the Initial Location of Objects................................................61 5.1.4 Testing for Containment....................................................................63 5.1.5 Containment and Class Definitions......................................................64 5.1.6 Bulk, Weight and Container Capacity...................................................65 3 5.1.7 Items Hidden in Containers...............................................................66 5.1.8 Notifications....................................................................................67 5.2 Coding Excursus 7 – Overriding and Inheritance.........................................70 5.3 In, On, Under, Behind.............................................................................75 5.3.1 Kinds of Container............................................................................75 5.3.2 Container Materials..........................................................................78 5.3.3 Other Kinds of Containment...............................................................79 5.4 Coding Excursus 8 – Anonymous and Nested Objects..................................81 5.5 Complex Containers................................................................................83 6 Actions..............................................................................88 6.1 Taxonomy of Actions...............................................................................88 6.2 Coding Excursus 9 – Macros and Propertysets............................................91 6.2.1 Macros............................................................................................91 6.2.2 Propertysets....................................................................................93 6.3 Customizing Action Behaviour..................................................................94 6.3.1 Actions Without Objects....................................................................94 6.3.2 Actions With Objects.........................................................................95 6.3.3 Stages of an Action..........................................................................96 6.3.4 Remap ...........................................................................................96 6.3.5 Verify.............................................................................................99 6.3.6 Check...........................................................................................102 6.3.7 Action...........................................................................................103 6.3.8 Precondition..................................................................................105 6.4 Coding Excursus 10 – Switching and Looping............................................107 6.4.1 The Switch Statement ....................................................................107 6.4.2 Loops...........................................................................................108 6.5 Defining New Actions............................................................................111 7 Knowledge.......................................................................117 7.1 Seen and Known..................................................................................117 7.1.1 Tracking What Has Been Seen..........................................................117 7.1.2 Tracking What Is Known..................................................................118 7.1.3 Revealing......................................................................................120 7.2 Coding Excursus 11 – Comments, Literals and Datatypes...........................121 7.2.1 Comments.....................................................................................121 4 7.2.2 Identifiers.....................................................................................121 7.2.3 Literals and Datatypes....................................................................122 7.2.4 Determining the Datatype (and Class) of Something...........................122 7.2.5 Property and Function Pointers.........................................................123 7.2.6 Enumerators..................................................................................125 7.3 Topics.................................................................................................126 7.4 Coding Excursus 12 – Dynamically Creating Objects..................................128 7.5 Consultables........................................................................................129 8 Events.............................................................................132 8.1 Fuses and Daemons..............................................................................132 8.2 Coding Excursus 13 – Anonymous Functions.............................................135 8.3 EventLists............................................................................................137 8.4 Coding Excursus 14 – Lists and Vectors...................................................143 8.5 Initialization and Pre-initialization...........................................................150 8.5.1 Initialization..................................................................................150 8.5.2 Pre-Initialization.............................................................................150 8.5.3 Static Property Initialization.............................................................151 9 Beginnings and Endings.....................................................153 9.1 GameMainDef......................................................................................153 9.2 Version Info ........................................................................................155 9.3 Coding Excursus 15 – Intrinsic Functions.................................................156 9.4 Ending a Game.....................................................................................158 10 Darkness and Light..........................................................161 10.1 Dark Rooms and Light Levels................................................................161 10.2 Coding Excursus 16 – Adjusting Vocabulary............................................164 10.2.1 Adding Vocabulary the Easy Way....................................................164 10.2.2 Dictionary....................................................................................165 10.2.3 ThingState...................................................................................165 10.3 Sources of Light..................................................................................167 11 Nested Rooms.................................................................172 11.1 Types and Characteristics of NestedRoom...............................................172 11.2 Nested Rooms and Postures.................................................................173 5 11.3 Nested Rooms in Complex