-- Alan Tutorial -- file : lesson7.ala -- Lesson 7 Example Program -- opening story quote -- save, restore -- examine/look at verb alternatives -- winning/losing game -- doors -- enter/exit 'exits' OBJECT ATTRIBUTES Takeable. NOT Openable. NOT Open. LOCATION Street NAME A City Street DESCRIPTION "Either side of the street is full of shops. The shops are a typical mixture of old houses converted into trendy boutiques and a few new glass-fronted shopping arcades. The exception is one house, to the north of you, which looks like a deserted house. A sign on the front door says $n$tPrivate $n$tThis is my home$n$tDon't Annoy Me!$p" EXIT north TO Porch. END LOCATION. SYNONYMS can=tin. garbage=rubbish. note=notepaper. paper=notepaper. 'message'=notepaper. OBJECT Note NAME Notepaper AT Street DESCRIPTION "There is a piece of grubby notepaper here with some scrawled writing on it." VERB Read DOES SCORE 5. "The scrawled handwriting is very bad but you think the message reads$p $t'I hate what you people have done to my street. $n$tYou're not going to have my house as well. I'd rather be dead. $n$tI'd rather you people were dead too! $n$tGood bye people!' $pHmmm .. that's a scarey little message!" END VERB Read. VERB eat CHECK Note in Inventory ELSE "You don't have that." DOES LOCATE Note AT Nowhere. "The note is surprisingly tasty. But, now that you think about it, eating it was rather pointless." SCORE 5. -- hey how can that be 'pointless'!! (sample 'bug') END VERB. VERB Examine, look_at DOES ONLY "The grubby piece of notepaper has some scrawled writing on it." END VERB. END OBJECT. OBJECT Tin NAME Rubbish Tin AT Street CONTAINER IS NOT Takeable. DESCRIPTION "A rubbish tin is bolted to one side of a lamppost." LIST tin. END OBJECT. OBJECT Bomb AT Street -- IS NOT Takeable. DESCRIPTION "There is bomb securely bolted to the other side of lamp post." VERB Take,remove,unbolt DOES ONLY "The vibrations as you try to remove the bomb from the lamp post upset its delicate internal mechanism. The bomb explodes.$p$p You have lost the game.$p" SCORE. QUIT. END VERB. VERB Examine, look_at DOES ONLY "The bomb is a small metal box welded to a metal bracket similar to the one used to fix the rubbish tin to the other side of the lamp post. The bracket is firmly bolted to the lamp post. There is a small radio antenna protruding from box." END VERB. END OBJECT. -- a couple of extra verbs defined so can be used as alternative verbs -- for 'take for the bomb object SYNTAX remove=remove (obj)*. SYNTAX unbolt=unbolt (obj)*. -- the following 'scenery' objects included so the player can look at -- them without the game saying 'I don't know that word' -- in this example game scenery objects have only been defined at the 'Street' OBJECT Post NAME Lamp Post AT Street IS NOT Takeable. DESCRIPTION END OBJECT Post. OBJECT Houses AT Street IS NOT Takeable. DESCRIPTION VERB Examine, look_at DOES ONLY "Most of the houses have been carefully restored except for one that is so run down it looks deserted." END VERB. END OBJECT Houses. OBJECT House NAME Deserted House AT Street IS NOT Takeable. DESCRIPTION VERB Examine, look_at DOES ONLY "This house looks very run down. It looks out of place amongst its carefully restored and maintained neighbouring buildings." END VERB. END OBJECT House. SYNONYMS boutiques=shops. arcades=shops. OBJECT Shops AT Street IS NOT Takeable. DESCRIPTION END OBJECT shops. -------------------------------------------------------------------- LOCATION Porch NAME Front Porch DESCRIPTION "The unpainted wood of the porch is rotting and feels like it could crack under your weight at any moment. The front door of the house, however, seems newly installed and very strong." SCORE 5. EXIT south TO Street. EXIT north, enter, 'in' to Hallway Check Front_Door IS open ELSE "The door is closed." END EXIT north. END LOCATION Porch. OBJECT Front_Door NAME Door AT Porch IS NOT Takeable. IS NOT Open. IS Openable. DESCRIPTION "" VERB Open DOES "The door is unlocked and opens easily. Inside the house you can see a dark corridor" MAKE Front_Door open. MAKE Door2 open. END VERB. VERB Close DOES "The door is now closed." MAKE Door2 NOT open. MAKE Front_Door NOT open. END VERB. END OBJECT Front_Door. LOCATION Hallway DESCRIPTION "Hallway is undecorated and messy. The door to the outside is to the south." SCORE 5. EXIT south, 'exit' TO Porch Check door2 IS open ELSE "The door is closed." END EXIT south. END LOCATION. OBJECT Door2 NAME Door AT Hallway IS NOT Takeable. IS NOT Open. IS openable. DESCRIPTION "" VERB Open DOES "You open the hallway door, letting in some welcome light and fresh air" MAKE Front_Door open. MAKE Door2 open. END VERB. VERB Close DOES "You close the door. With the light from the outside world gone, the hallway is now dark and mysterious." MAKE Door2 NOT open. MAKE Front_Door NOT open. END VERB. END OBJECT Door2. OBJECT Butt1 NAME Green Button IN Control IS NOT Takeable. DESCRIPTION "" VERB Push DOES ONLY "You push the green button. You hear a small click. Nothing else happens. Then you hear a voice call $p ""Hey! The bomb has stopped ticking!"" $p$PYou have won the game!$p" SCORE. QUIT. END VERB Push. END OBJECT Butt1. OBJECT Butt2 NAME Red Button IN Control IS NOT Takeable. DESCRIPTION VERB Push DOES ONLY "You push the red button. You hear a small click. There is a dazzling flash of light which is almost instantly followed by an overwhelming blast of noise and fire.$p The bomb has exploded. $p$PSorry, you have lost the game!$p" SCORE. QUIT. END VERB Push. END OBJECT Butt2. OBJECT Control NAME Remote Control AT Hallway CONTAINER LIMITS COUNT 2 THEN "You can put anything in there!" DESCRIPTION "There is a home-made electronic remote control here." VERB Examine, look_at DOES ONLY "The remote control has two large buttons. One button is made of green plastic, the other is red. Above the green one is a plastic tag labelled 'Disarm'. Above the red one is another tag labelled 'Detonate'." END VERB. VERB Push DOES ONLY "You push the green button. You hear a small click. Nothing else happens. Then you hear a distant voice call from the street$p ""Hey! The bomb has stopped ticking!"" $p$PYou have won the game!$p" SCORE. QUIT. END VERB Push. END OBJECT Control. SYNTAX look_at='look' 'at' (obj1). SYNTAX examine=examine (obj1). SYNONYMS x=examine. VERB Examine,look_at DOES "There is nothing significant to say about the $1" END VERB. VERB Read DOES IF OBJECT NOT IN Inventory AND OBJECT IS Takeable THEN LOCATE OBJECT IN Inventory. "(You pick up the $1.)$p" END IF. END VERB Read. SYNONYMS press=push. VERB Push DOES "Nothing happens." END VERB Push. VERB Open CHECK OBJECT IS Openable ELSE "You can't open that." AND OBJECT IS NOT Open ELSE "The $o is already open" END VERB. VERB Close CHECK OBJECT IS Openable ELSE "You can't close that." AND OBJECT IS Open ELSE "The $o is already closed" END VERB. LOCATION Nowhere END LOCATION. $INCLUDE 'library2.ala' SYNTAX 'save'='save'. VERB 'save' DOES SAVE. END VERB. SYNTAX 'restore'='restore'. VERB 'restore' DOES RESTORE. LOOK. END VERB. START AT Street. "$p Alan Tutorial$p Example Game$p You are an police explosives expert." VISITS 99.