Converting Standard Library Code to Triform 1.2b ------------------------------------------------ This file contains information on how to convert existing, standard-library code, with very little discussion of new features. Note that this may be less helpful if you've used library extensions or added any unusual hacks of your own. 1. Locations 2. Objects 3. Containers 4. People 5. Doors 6. Printing Text 7. Everything Else == 1 Locations == Change any references to the (location) or (real_location) variables to (player.location). Any reference to (actor_location) should be changed to (actor.location). "The Dark" is no longer a separate object. Thus any instances of "if (location == thedark)" should be replaced by "if (LightToSeeBy(player) == false)". This means that actors can interact with things in a dark room without the need for new scope rules. All rooms should be of the class Room. The main change you need to worry about is that the -visited- attribute has been replaced by (visited) properties for all Rooms, which are false by default. == 2 Objects == All objects should be of the class Thing. All Things have been supplied with some new properties: insideofparent ontopofparent behindparent beneathparent attachedtoparent location visibility_ceiling visibility_levels size The *parent properties keep track of the Thing's relationship to its parent. They should always be either true or false. It is acceptable for a Thing to be both inside and attached, or on top and attached, etc., but other overlaps will confuse the library. If none of them are true, the Thing will be invisible and inaccessible to any actor for as long as its parent is not a Room. See section 3 for an explanation of Containers. Note that if only (attachedtoparent) is true, the Thing will be listed as being "on" its parent. The rest are fairly self-explanatory. (location) is the Room which directly or indirectly contains the Thing; (visibility_ceiling) and (visibility_levels) work just as did the old global variables, which have been deleted. Size is used to determine if an item can fit into a Container (see section 3) and has a default value of 1. So your object tree should look something like this: Room -> Shrine Container -> Samovar Person -> Monk Thing ->-> Prayer_Beads The move and remove directives have been replaced by Move(obj, target) and Remove(obj). The behavior of MovePlayer() can be replicated by calling Move(player, target, 4). To replicate the original behavior of PlayerTo(), call Move(player, target, 1); take care only to do this if moving the player to a Room. Every object which has been seen by the player will be given the -topic- attribute. Anything that has -topic- is fair game for conversation, such as ASK PAUL ABOUT THE GLOWING SLUG. It is also used in the optional extension 3Who.h. == 3 Containers == A new class Container has been added, eliminating the attributes -container-, -supporter-, and -enterable-. This class provides the following properties: inside_capacity ontop_capacity behind_capacity beneath_capacity attached_capacity sack_object So to allow a Container to act as a supporter, simply set its (ontop_capacity) to true. And similarly for the other properties. The original (capacity) object property has been replaced by the six properties (inside_capacity), (ontop_capacity), (behind_capacity), (beneath_capacity), and (attached_capacity). Note that the -open- attribute has been replaced by the -closed- attribute. Consider: Container electric_chair "electric chair" with name "chair", adjective 'electric', description "The chair No-Teeth Malone met his end in.", ontop_capacity 10, beneath_capacity 5, has scenery; Container spiral "Endless Spiral of Despair" with name "spiral", adjective 'endless', description "An inky void, clouding your vision and judgment.", inside_capacity 1; Container washer "washing machine" with name "washer" "machine", adjective 'washing', ontop_capacity [; if (self hasnt closed) return 3; else return 10; ], after [ x i; Open: objectloop (x in self && x.insideofparent == true) { i++; if (i > 3) "There is too much on top of it."; } ], inside_capacity 25, beneath_capacity 2, behind_capacity 2, has scenery openable; Thing -> laundry "laundry" with name "laundry" "clothes" "clothing", insideofparent true; Note that the washing machine can store fewer items on its top when it is open than when it is not, just as you might expect. If a Container has items beneath or behind it, they will be left behind if it is moved or picked up. The SACK_OBJECT constant has been removed. The library will automatically attempt to choose a suitable sack object if an actor's hands are full, choosing only from objects of the Container class. A Container's (sack_object) property will allow you to assign a higher priority to it. Additionally, the parser will try to move multiple items into the chosen sack object if necessary. Simply, to make a certain Container the default sack object, give it a (sack_object) of 1 and leave every others' at 0 (the default value). When you use the fake action ##LetGo, bear in mind that a complicated Container may want to use something like this: before [; LetGo: if (noun.insideofparent == true) { ..... } if (noun.ontopofparent == true) { ..... } ], The attributes -lockable- and -locked- have been replaced by the class Lockable, which provides the following properties: lockstate = 0 if not lockable. = 1 if lockable only when closed. (default) = 2 if lockable only when open. = 3 if lockable in either state. Adding 10 to these numbers makes it so that will not be immediately obvious that the item is locked, and thus implicit unlock actions will not be tried. lockstate can also be a routine returning any of these numbers. locked = false or true. with_key = The key which unlocks it, if any. If -1, the object cannot be locked/unlocked. Can be a routine but cannot be an array. If the player types something like LOCK PENDANT, the library will test if she has the appropriate key and use it. However, you could create the pendant thus: Lockable -> pendant "pendant" with name "pendant", with_key 1, locked true, before [; Lock, Unlock: if (self.with_key == 1 && second == gold_key) self.with_key = gold_key; else "You don't seem to have the right key."; ]; Thing -> gold_key "gold key" with name "key", adjective 'gold'; Thing -> silver_key "silver key" with name "key", adjective 'silver'; This would make a pendant which is not auto-unlocked unless the player has either already discovered the gold key can unlock it or is trying the gold key for the first time. The silver key will always be rejected. If with_key were 0, then no key would be required to lock or unlock the pendant. This would be useful for a briefcase that locks with clasps, for example. See features.txt for a full discussion of the interesting new functions of keys. == 4 People == All people should be of the class Person. The -animate- attribute still lives, so that a Person without -animate- is treated as dead. The player, or anybody else for that matter, can remove any objects contained by a non-animate Person. The -male- and -female- attributes are not automatic, however, so you must set them manually. == 5 Doors == The -door- attribute has been replaced by the class Door, so (door_to) and (door_dir) are no longer common properties. Those properties are also taken care of automatically; just specify the locations being connected, like so: Door living_room_door "living room door" with name "door", article "the", found_in living_room kitchen, has openable; Room kitchen "Kitchen" with s_to living_room_door; Room laundry_room "Laundry Room" with n_to living_room_door; == 6 Printing Text == (describe) is now a general-purpose tool, eliminating (when_on), (when_off), (when_lit), (when_unlit), and (initial). It operates whenever the object is visible to the player, except, of course, in inventory. == 7 Everything Else == (deadflag) is now (gameover), since stories don't always end in death. The -general- attribute is gone, so if your game uses it, just add it back in. "Attack", "break", "crack", "destroy", "fight", "hit", "kill", "murder", "punch", "smash", "thump", "torture", and "wreck" are no longer synonyms. "Kick" has been added. "Swallow" redirects to Eat. In general, many library messages have been altered to make better sense in wider contexts. The points system has been slightly altered. The -scored- attribute has been removed. All Things and Rooms have a (points) property, with a default value of 0 and which can be positive or negative, or a routine. OBJECT_SCORE and ROOM_SCORE have likewise been removed. Changing the lookmode has been slightly altered. There is now just one verb routine, LookModeSub, replacing LMode1Sub, LMode2Sub, and LMode3Sub. A global normalmode has been added; it stores the value of the default lookmode, which is 'verbose'. When the description of the default mode is printed, it will be noted that it is the default mode. CANTGO__TX has been replaced by L__M(##Go, 2).