Warning, /frameworks/syntax-highlighting/autotests/folding/highlight_tads3.t.fold is written in an unsupported language. File is not indexed.

0001 // TADS3 Example File
0002 // Source: https://www.tads.org/t3doc/doc/t3QuickStart.htm
0003 
0004 #charset "us-ascii"
0005 #include <adv3.h>
0006 #include <en_us.h>
0007 
0008 versionInfo: GameID
0009     IFID = '558c20af-6559-477a-9f98-b7b4274cd304'
0010     name = 'The Best Burglar'
0011     byline = 'by Eric Eve'
0012     htmlByline = 'by <a href="mailto:eric.eve@hmc.ox.ac.uk">
0013                   Eric Eve</a>'
0014     version = '3'
0015     authorEmail = 'Eric Eve <eric.eve@hmc.ox.ac.uk>'
0016     desc = 'You are the world\'s best burglar faced with the greatest challenge
0017         of your felonious career.'
0018     htmlDesc = 'You are the world\'s best burglar faced with the greatest
0019         challenge of your felonious career.'
0020 ;
0021 
0022 gameMain: GameMainDef
0023     <beginfold id='1'>/*</beginfold id='1'> the initial player character is 'me' <endfold id='1'>*/</endfold id='1'>
0024     initialPlayerChar = me
0025 
0026     showIntro()
0027     <beginfold id='2'>{</beginfold id='2'>
0028         "<b>The Best Burglar</b>\nWell, you've got this far. Now it's just a
0029         quick nip inside the house and out again carrying the Orb of Ultimate
0030         Satisfaction, an object that no burglar has ever managed to steal
0031         before. If you can pull it off you're sure to win the Burglar of the
0032         Year Award, putting you at the pinnacle of your profession.\b";
0033     <endfold id='2'>}</endfold id='2'>
0034 
0035     showGoodbye()
0036     <beginfold id='2'>{</beginfold id='2'>
0037         "Thanks for playing! ";
0038     <endfold id='2'>}</endfold id='2'>
0039 ;
0040 
0041 startRoom: OutdoorRoom 'Driveway'
0042     "The large red-brick Tudor house stands immediately to the north of this end
0043     of the driveway, while the drive back to the road where you left your
0044     getaway vehicle runs off though a belt of trees to the southwest."
0045 
0046     roomFirstDesc = "Here you are in the drive of Number 305 Erehwon Avenue,
0047         with the great house you've come to burgle standing just before you to
0048         the north. The drive back to the road where you left your getaway
0049         vehicle runs off though a belt of trees to the southwest."
0050 
0051     north = frontDoor
0052     in asExit(north)
0053     southwest = drive
0054 ;
0055 
0056 + me: Actor
0057     pcDesc = "You're Alexis Lightfinger, burglar extraordinaire, the most
0058         professional thief in the known universe; but you're on a job now, so
0059         you don't have time for the narcissistic indulgence of admiring your own
0060         appearance. You're far too professional not to have come fully prepared,
0061         so there's no practical need to look yourself over again. "
0062 ;
0063 
0064 ++ Container 'large white swag bag*bags' 'swag bag'
0065     "It's a large white bag with <q>SWAG</q> printed on it in very large
0066     letters. Everyone knows that no real burglar would ever carry such a thing,
0067     so by carrying it you know no one will take you for a real burglar. Cunning,
0068     eh? "
0069 ;
0070 
0071 + frontDoor: LockableWithKey, Door 'solid oak front door*doors' 'front door'
0072     "The lintel above the front door is carved with the date 1589, presumably
0073     the date the house was built. The door itself is made of solid oak. "
0074     keyList = [brassKey]
0075 
0076     makeOpen(stat)
0077     <beginfold id='2'>{</beginfold id='2'>
0078         inherited(stat);
0079         if(stat)
0080             achievement.awardPointsOnce();
0081     <endfold id='2'>}</endfold id='2'>
0082 
0083     achievement: Achievement <beginfold id='2'>{</beginfold id='2'> +10 "opening the front door" <endfold id='2'>}</endfold id='2'>
0084 
0085 ;
0086 
0087 + flowerPot: ComplexContainer 'terracotta small flower flowerpot/pot*pots'
0088     'flower pot'
0089     "It's a perfectly ordinary small terracota pot, though it looks like no
0090     one's got round to putting a plant in it yet. "
0091     subContainer: ComplexComponent, Container <beginfold id='2'>{</beginfold id='2'> bulkCapacity = 3<endfold id='2'>}</endfold id='2'>
0092     subUnderside: ComplexComponent, Underside <beginfold id='2'>{</beginfold id='2'> <endfold id='2'>}</endfold id='2'>
0093 
0094     initSpecialDesc = "A small flower pot rests on the ground not far from the
0095         front door. "
0096 
0097     bulk = 3
0098     bulkCapacity = 3
0099 ;
0100 
0101 ++ brassKey: Hidden, Key 'small brass key*keys' 'small brass key'
0102     "It's an ordinary enough small brass key. "
0103     subLocation = &subUnderside
0104 ;
0105 
0106 + Enterable -> frontDoor 'large red red-brick tudor house/mansion/front
0107     *houses*buildings' 'house'
0108     "It's a large red-brick Tudor house with mullioned windows, climbing
0109     creepers and the date 1589 carved over the door. "
0110 ;
0111 
0112 ++ Component '(door) carved lintel' 'lintel'
0113     "Its most noteworthy feature is the date 1589 carved into it. "
0114 ;
0115 
0116 + Decoration 'mullioned windows' 'windows'
0117     "They're architecturally attractive, no doubt, but not especially helpful to
0118     burglars. "
0119 
0120     notImportantMsg = 'It\'s a matter of professional pride with you never to
0121         mess with windows. '
0122     isPlural = true
0123 ;
0124 
0125 + Decoration 'green climbing ivy/creepers/creeper' 'creepers'
0126     "The front of the house is festooned with green creepers -- ivy, perhaps,
0127     but botany was never your strong point since in the main plants aren't
0128     worth burgling. "
0129 
0130     notImportantMsg = 'The creepers can\'t help you burgle the house -- they\'re
0131         certainly not strong enough to climb and they\'re certainly not worth
0132         stealing -- so you may as well leave them alone. '
0133     isPlural = true
0134 ;
0135 
0136 + drive: PathPassage 'drive/path/avenue' 'drive'
0137     "The drive leading back to the road runs off through a belt of trees to the
0138     southwest. "
0139 
0140     dobjFor(TravelVia)
0141     <beginfold id='2'>{</beginfold id='2'>
0142         action()
0143         <beginfold id='2'>{</beginfold id='2'>
0144             "You retrace your steps back to the road, where your trusty unmarked
0145             burglarmobile is still parked, ready for your quick getaway. ";
0146 
0147             if(orb.isIn(me))
0148             <beginfold id='2'>{</beginfold id='2'>
0149                 "Congratulations! You have got away with the Orb of Ultimate
0150                 Satisfaction, a feat never before performed. As you slip the orb
0151                 onto the back seat of your car and climb into the driver's seat
0152                 you tell yourself that you're now absolutely certain to win
0153                 the Burglar of the Year Award!\b";
0154 
0155                 achievement.awardPointsOnce();
0156 
0157                 finishGameMsg(ftVictory, [finishOptionUndo,
0158                     finishOptionFullScore]);
0159             <endfold id='2'>}</endfold id='2'>
0160             else
0161             <beginfold id='2'>{</beginfold id='2'>
0162                 "It's a shame you didn't manage to steal the orb, though.
0163                 Without it you'll never win the Burglar of the Year Award
0164                 now.\b";
0165 
0166                 finishGameMsg(ftFailure, [finishOptionUndo]);
0167             <endfold id='2'>}</endfold id='2'>
0168         <endfold id='2'>}</endfold id='2'>
0169     <endfold id='2'>}</endfold id='2'>
0170 
0171     okayRubMsg = 'What -- all of it? That may take a while! '
0172     achievement: Achievement <beginfold id='2'>{</beginfold id='2'> +10 "getting away with the orb" <endfold id='2'>}</endfold id='2'>
0173 ;
0174 
0175 + Decoration 'belt/trees' 'trees'
0176     "The trees are in full leaf, which is good, because they hide what you're
0177     doing from the road. "
0178 
0179     notImportantMsg = 'The trees are doing a good job of hiding you from the
0180         road, so you may as well leave them alone. It\'s not as if they\'re
0181         something you could steal, after all. '
0182 ;
0183 
0184 hallway: Room 'Hallway'
0185     "This hall is or grand proportions but pretty bare. The front door lies to
0186     the south and other exits lead east, north and west. "
0187 
0188     south = hallDoor
0189     out asExit(south)
0190     west = study
0191     north: FakeConnector <beginfold id='2'>{</beginfold id='2'> "You're pretty sure that only leads to the kitchen,
0192         and you haven't come here to cook a meal. " <endfold id='2'>}</endfold id='2'>
0193 
0194     east: DeadEndConnector <beginfold id='2'>{</beginfold id='2'> 'the living room' "You <<one of>>walk through the
0195         doorway and find yourself in<<or>>return to<<stopping>> the living room
0196         where you take <<one of>> a <<or>>another<<stopping>> quick look around,
0197         but <<one of>><<or>> once again<<stopping>> failing to find anything of
0198         interest you quickly return to the hall. "<endfold id='2'>}</endfold id='2'>
0199 ;
0200 
0201 + hallDoor: Lockable, Door -> frontDoor 'front door*doors' 'front door'
0202 ;
0203 
0204 + table:Surface 'small wooden mahogany side table/legs*tables' 'small table'
0205     "It's a small mahogany table standing on four thin legs. "
0206     initSpecialDesc = "A small table rests by the east wall. "
0207     bulk = 5
0208 
0209     dobjFor(Take)
0210     <beginfold id='2'>{</beginfold id='2'>
0211         check()
0212         <beginfold id='2'>{</beginfold id='2'>
0213             if(contents.length > 0)
0214                 failCheck('It\'s probably not a very good idea to try picking
0215                     up the table while <<contents[1].nameIs>> still on it. ');
0216         <endfold id='2'>}</endfold id='2'>
0217     <endfold id='2'>}</endfold id='2'>
0218 ;
0219 
0220 ++ vase: Container 'cheap china floral vase/pattern' 'vase'
0221     "It's only a cheap thing, made of china but painted in a tasteless floral
0222     pattern using far too many primary colours. "
0223 
0224     bulk = 3
0225     bulkCapacity = 3
0226 ;
0227 
0228 +++ silverKey: Hidden, Key 'small silver key*keys' 'small silver key'
0229 ;
0230 
0231 study: Room 'Study'
0232     "This study is much as you would expect: somewhat spartan. A desk stands in
0233     the middle of the room with a chair placed just behind it. A <<if
0234       picture.moved>>safe is built into <<else>> rather bland painting hangs on
0235     <<end>> the west wall. The way out is to the east. "
0236     east = hallway
0237     out asExit(east)
0238 ;
0239 
0240 + desk: Heavy, Platform 'plain wooden desk' 'desk'
0241     "It's a plain wooden desk with a single drawer. "
0242     dobjFor(Open) remapTo(Open, drawer)
0243     dobjFor(Close) remapTo(Close, drawer)
0244     dobjFor(LookIn) remapTo(LookIn, drawer)
0245     dobjFor(UnlockWith) remapTo(UnlockWith, drawer, IndirectObject)
0246     dobjFor(LockWith) remapTo(LockWith, drawer, IndirectObject)
0247     dobjFor(Lock) remapTo(Lock, drawer)
0248     dobjFor(Unlock) remapTo(Unlock, drawer)
0249 ;
0250 
0251 ++ drawer: KeyedContainer, Component '(desk) drawer*drawers' 'drawer'
0252     "It's an ordinary desk drawer with a small silver lock. "
0253     keyList = [silverKey]
0254 ;
0255 
0256 +++ notebook: Readable 'small bright red notebook/book/cover/pages'
0257     'small red notebook'
0258     "It's a small notebook with a bright red cover. "
0259 
0260     readDesc = "You open the notebook and flick through its pages. The only
0261         thing you find of any interest is a page with <q>SAFE DATE</q> scrawled
0262         across it. After satisfying yourself that the notebook contains nothing
0263         else of any potential relevance you snap it shut again. <.reveal
0264         safe-date>"
0265 
0266     dobjFor(Open) asDobjFor(Read)
0267     dobjFor(LookIn) asDobjFor(Read)
0268 
0269     dobjFor(Read)
0270     <beginfold id='2'>{</beginfold id='2'>
0271         action()
0272         <beginfold id='2'>{</beginfold id='2'>
0273             inherited;
0274             achievement.awardPointsOnce();
0275         <endfold id='2'>}</endfold id='2'>
0276     <endfold id='2'>}</endfold id='2'>
0277 
0278     cannotCloseMsg = 'It\'s already closed. '
0279     achievement: Achievement <beginfold id='2'>{</beginfold id='2'> +5 "reading the notebook" <endfold id='2'>}</endfold id='2'>
0280 ;
0281 
0282 + CustomImmovable, Chair 'red office swivel chair' 'chair'
0283     "It's a typical office swivel chair, covered in red fabric. "
0284 
0285     cannotTakeMsg = 'You see no reason to burden yourself with such a useless
0286         object; that would be quite unprofessional. '
0287 
0288 ;
0289 
0290 + picture: RoomPartItem, Thing 'rather bland picture/painting/landscape'
0291     'picture'
0292     "It's a landscape, pleasantly executed enough, but of no great distinction
0293     and definitely not worth the bother of stealing. "
0294 
0295     initNominalRoomPartLocation = defaultWestWall
0296     initSpecialDesc = "A rather bland painting hangs on the west wall. "
0297     isListed = (moved)
0298 
0299     bulk = 8
0300 
0301     dobjFor(LookBehind)
0302     <beginfold id='2'>{</beginfold id='2'>
0303         action()
0304         <beginfold id='2'>{</beginfold id='2'>
0305             if(moved)
0306                 inherited;
0307             else
0308             <beginfold id='2'>{</beginfold id='2'>
0309                 safe.discover();
0310                 "Behind the picture is a safe built into the wall. ";
0311             <endfold id='2'>}</endfold id='2'>
0312         <endfold id='2'>}</endfold id='2'>
0313     <endfold id='2'>}</endfold id='2'>
0314 
0315     moveInto(newDest)
0316     <beginfold id='2'>{</beginfold id='2'>
0317         if(!safe.discovered)
0318         <beginfold id='2'>{</beginfold id='2'>
0319             "Removing the painting from the wall reveals a safe behind. ";
0320             safe.discover();
0321         <endfold id='2'>}</endfold id='2'>
0322         inherited(newDest);
0323     <endfold id='2'>}</endfold id='2'>
0324 ;
0325 
0326 + safe: RoomPartItem, Hidden, CustomFixture, ComplexContainer
0327     'sturdy steel safe' 'safe'
0328     "It's a sturdy steel safe with a single dial on its door. "
0329 
0330     subContainer: ComplexComponent, IndirectLockable, OpenableContainer
0331     <beginfold id='2'>{</beginfold id='2'>
0332         bulkCapacity = 5
0333         makeOpen(stat)
0334         <beginfold id='2'>{</beginfold id='2'>
0335             inherited(stat);
0336             if(stat)
0337                 achievement.awardPointsOnce();
0338         <endfold id='2'>}</endfold id='2'>
0339 
0340         achievement: Achievement <beginfold id='2'>{</beginfold id='2'> +10 "opening the safe" <endfold id='2'>}</endfold id='2'>
0341     <endfold id='2'>}</endfold id='2'>
0342 
0343     specialDesc = "A safe is built into the west wall. "
0344     specialNominalRoomPartLocation = defaultWestWall
0345     cannotTakeMsg = 'It's firmly built into the wall; you can't budge it. '
0346 
0347     discover()
0348     <beginfold id='2'>{</beginfold id='2'>
0349         if(!discovered)
0350         <beginfold id='2'>{</beginfold id='2'>
0351             foreach(local cur in allContents)
0352                 cur.discover();
0353 
0354             achievement.awardPointsOnce();
0355         <endfold id='2'>}</endfold id='2'>
0356         inherited();
0357     <endfold id='2'>}</endfold id='2'>
0358 
0359     achievement: Achievement <beginfold id='2'>{</beginfold id='2'> +5 "finding the safe" <endfold id='2'>}</endfold id='2'>
0360 ;
0361 
0362 ++ safeDoor:  Hidden, ContainerDoor '(safe) door' 'safe door'
0363     "It has a circular dial attached to its centre. "
0364 ;
0365 
0366 +++ safeDial: Hidden, Component,  NumberedDial 'circular dial*dials' 'dial'
0367     "The dial can be turned to any number between <<minSetting>> and
0368     <<maxSetting>>. It's currently at <<curSetting>>. "
0369 
0370     minSetting = 0
0371     maxSetting = 99
0372     curSetting = '35'
0373 
0374     num1 = 0
0375     num2 = 0
0376     correctCombination = 1589
0377 
0378     makeSetting(val)
0379     <beginfold id='2'>{</beginfold id='2'>
0380         inherited(val);
0381         num2 = num1;
0382         num1 = toInteger(val);
0383         if(100 * num2 + num1 == correctCombination)
0384         <beginfold id='2'>{</beginfold id='2'>
0385             "You hear a slight <i>click</i> come from the safe door. ";
0386             safe.makeLocked(nil);
0387         <endfold id='2'>}</endfold id='2'>
0388         else if(!safe.isOpen)
0389             safe.makeLocked(true);
0390     <endfold id='2'>}</endfold id='2'>
0391 ;
0392 
0393 ++ orb: Thing 'ultimate battered dull metal orb/sphere/ball/satisfaction'
0394     'Orb of Ultimate Satisfaction'
0395     "It doesn't look much be honest, just a battered sphere made of some dull
0396     metal, but you've been told it's the most valuable and desirable object
0397     in the known universe! "
0398 
0399     aName = (theName)
0400 
0401     subLocation = &subContainer
0402 
0403     okayRubMsg = 'As {you/he} rub{s} {the dobj/him} a shimmering djiin suddenly
0404         appears in the air before you!\b
0405         <q>Hello, you have reached the automated holographic answering service
0406         of Jeannie the Genie,</q> she announces. <q>I\'m sorry I\'m not
0407         available to respond to your rub in person right now, but my hours of
0408         activity have been heavily curtailed by the European Working Time
0409         Directive. Before making a wish, please make sure that you have
0410         conducted a full risk assessment in line with the latest Health and
0411         Safety Guidelines. Also, please note that before any wish can be granted
0412         you must sign a Form P45/PDQ/LOL indemnifying this wish-granting agency
0413         against any consequential loss or damage arising from the fulfilment of
0414         your desires. Thank you for rubbing. Have a nice day!</q>\b
0415         Her message complete, the holographic djiin fades away into
0416         non-existence. '
0417 
0418     moveInto(dest)
0419     <beginfold id='2'>{</beginfold id='2'>
0420         inherited(dest);
0421         if(dest.isOrIsIn(me))
0422             achievement.awardPointsOnce();
0423     <endfold id='2'>}</endfold id='2'>
0424 
0425     achievement: Achievement <beginfold id='2'>{</beginfold id='2'> +10 "taking the orb" <endfold id='2'>}</endfold id='2'>
0426 ;
0427 
0428 //------------------------------------------------------------------------------
0429 
0430 <beginfold id='1'>/*</beginfold id='1'> DEFINE A NEW VERB <endfold id='1'>*/</endfold id='1'>
0431 
0432 DefineTAction(Rub)
0433 ;
0434 
0435 VerbRule(Rub)
0436     'rub' dobjList
0437     : RubAction
0438     verbPhrase = 'rub/rubbing (what)'
0439 ;
0440 
0441 <beginfold id='1'>/*</beginfold id='1'> When creating a new verb, you'll want to modify the Thing class so as to provide
0442    default handling for the command. The defaults specified here will be used except
0443    on objects for which you define explicit handling of the command. <endfold id='1'>*/</endfold id='1'>
0444 
0445 modify Thing
0446     dobjFor(Rub)
0447     <beginfold id='2'>{</beginfold id='2'>
0448         preCond = [touchObj]
0449         action() <beginfold id='2'>{</beginfold id='2'> mainReport(okayRubMsg); <endfold id='2'>}</endfold id='2'>
0450     <endfold id='2'>}</endfold id='2'>
0451 
0452     okayRubMsg = '{You/he} rub{s} {the dobj/him} but not much happens as a
0453         result. '
0454 
0455     shouldNotBreakMsg = 'Only amateurs go round breaking things unnecessarily. '
0456 ;
0457 
0458 //------------------------------------------------------------------------------
0459 
0460 <beginfold id='1'>/*</beginfold id='1'> HINTS <endfold id='1'>*/</endfold id='1'>
0461 
0462 TopHintMenu;
0463 
0464 + Goal -> (frontDoor.achievement)
0465     'How do I get into the house?'
0466     [
0467         'Well, the windows don\'t seem a good way in. ',
0468         'So perhaps you\'d better try the front door. ',
0469         'Could someone have left a key around somewhere? ',
0470         'Is there anything lying around where someone could have hidden a key? ',
0471         'What about that flowerpot? ',
0472         'Try looking under the flowerpot. '
0473     ]
0474 
0475     goalState = OpenGoal
0476 ;
0477 
0478 <beginfold id='1'>/*</beginfold id='1'> The closeWhenSeen property of the following Goal object is an example of how to
0479    make your hint menu respond dynamically to the player's current situation. <endfold id='1'>*/</endfold id='1'>
0480 
0481 + Goal 'Where can I find the orb? '
0482     [
0483         'Something like that is bound to be kept safe. ',
0484         'So it\'s probably inside the house. '
0485     ]
0486 
0487     goalState = OpenGoal
0488     closeWhenSeen = hallway
0489 ;
0490 
0491 + Goal 'Where can I find the orb?'
0492     [
0493         'It\'s sure to be kept somewhere safe. ',
0494         'You\'d better hunt around. ',
0495         'Somewhere in the study seems the most likely place. ',
0496         deskHint,
0497         'But it should be safely locked in a safe ',
0498         'Where might someone hide a safe in this study? ',
0499         'What could be behind that picture on the wall? ',
0500         'Try looking behind the picture (or simply taking the picture). '
0501     ]
0502 
0503     openWhenSeen = hallway
0504     closeWhenSeen = orb
0505 ;
0506 
0507 ++ deskHint: Hint 'Have you tried looking in the desk drawer? '
0508     [deskGoal]
0509 ;
0510 
0511 + deskGoal: Goal 'How do I get the desk drawer open?'
0512     [
0513         'Have you examined the drawer? ',
0514         'What might you need to unlock it? ',
0515         'Where might you find such a thing? ',
0516         'What have you seen that a small key might be hidden in? ',
0517         'How carefully have you searched the hall? ',
0518         'What is (or was) on the hall table? ',
0519         'What might that vase be for? ',
0520         'Try looking in the vase. '
0521     ]
0522     closeWhenSeen = notebook
0523 ;
0524 
0525 + Goal 'How do I get the safe open?'
0526     [
0527         'How carefully have you examined the safe? ',
0528         'Where might someone leave a clue to the combination? ',
0529         deskHint,
0530         'Make sure you read the notebook. ',
0531         'Once you\'ve found the combination you need to use the dial. ',
0532         'If the combination is a number larger than 99 you\'ll need to enter it
0533         in stages. ',
0534         'For example, if the combination were 1234 you\'d first need to turn the
0535         dial to 12 and then turn it to 34. '
0536     ]
0537 
0538     openWhenSeen = safe
0539     closeWhenAchieved = (safe.subContainer.achievement)
0540 ;
0541 
0542 + Goal 'What does the clue in the notebook mean?'
0543     [
0544         'Well, <q>SAFE</q> might refer to something you want to open. ',
0545         'Have you seen a date round here? ',
0546         'When was this house built? ',
0547         'Where might you find the year in which this house was built? ',
0548         'How carefully have you looked at the front of the house? ',
0549         'Did you examine the door? '
0550     ]
0551 
0552     openWhenRevealed = 'safe-date'
0553     closeWhenAchieved = (safe.subContainer.achievement)
0554 ;
0555 
0556 
0557 + Goal 'What do I do with the orb now I\'ve got it?'
0558     [
0559         'Well, you could try rubbing it. ',
0560         'But the main thing to do now is to escape with it. '
0561     ]
0562     openWhenSeen = orb
0563 ;