Annotation of 43BSD/games/ddl/doc/tiny.ddl, revision 1.1.1.1

1.1       root        1: NOUN startrm;
                      2: NOUN brightroom;
                      3: 
                      4: NOUN .ME(startrm);
                      5: 
                      6: VAR Obj;               { A global }
                      7: SEEN = 1;              { A property (bit) number }
                      8: 
                      9: Looker = 
                     10:        ($num @Verb)
                     11:        (($ldesc ($loc .ME))   )        { CALL Ldesc of room }
                     12:         ($setg Obj ($cont ($loc .ME))) { start with first obj in room }
                     13:         (WHILE @Obj :
                     14:                (($ldesc @Obj) :        { If it has a description, }
                     15:                        (($ldesc @Obj)) {  then say it. }
                     16:                )
                     17:                ($setg Obj ($link @Obj))        { Continue with sibling }
                     18:         )
                     19:        ;
                     20: 
                     21: 
                     22: Slook =  (($sdesc ($loc .ME)))         { CALL Ldesc of room }
                     23:         ($setg Obj ($cont ($loc .ME))) { start with first obj in room }
                     24:         (WHILE @Obj :
                     25:                (($ldesc @Obj) :        { If it has a description, }
                     26:                        (($ldesc @Obj)) {  then say it. }
                     27:                )
                     28:                ($setg Obj ($link @Obj))        { Continue with sibling }
                     29:         )
                     30:        ;
                     31: 
                     32: Rdesc =                        { Room description }
                     33:        ($say "\n")
                     34:        (($prop ($loc .ME) SEEN) :              { Have I been here? }
                     35:                        (Slook)                 { Yes, be brief. }
                     36:        :{else}         (Looker)                { Otherwise, do the spiel, }
                     37:                        ($setp ($loc .ME) SEEN 1)       { but only once. }
                     38:        )
                     39:        ($say "\n> ")   { Prompt player }
                     40:        ;
                     41: 
                     42: VERB look;
                     43: look(ACTION) = Looker;
                     44: 
                     45: VERB inventory;
                     46: inven = inventory;
                     47: 
                     48: inven(ACTION) = (($not ($cont .ME)):   { Null "contents" field }
                     49:                        ($say "You are empty-handed.\n")
                     50:                :{else}
                     51:                        ($say "You are carrying:\n")
                     52:                        ($setg Obj ($cont .ME))
                     53:                        (WHILE @Obj :
                     54:                                (($sdesc @Obj))
                     55:                                ($say "\n")
                     56:                                ($setg Obj ($link @Obj))
                     57:                        )
                     58:                )
                     59:                ;
                     60: 
                     61: VERB take;
                     62: VERB drop;
                     63: get=take;
                     64: 
                     65: take(PREACT) = (($ne ($loc .ME) ($loc ($dobj))):       { Dobj in same room? }
                     66:                ($say "I don't see ")           { No, report the fact }
                     67:                (($sdesc ($dobj)))
                     68:                ($say " here.\n")
                     69:                ($exit 1));                     { and end the turn. }
                     70: 
                     71: drop(PREACT) = (($ne ($loc ($dobj)) .ME) :     { Must be carrying the dobj }
                     72:                ($say "You aren't carrying it!\n")
                     73:                ($exit 1));
                     74: 
                     75: take (ACTION) = ($move ($dobj) .ME)
                     76:                ($say "Taken.\n")
                     77:                ;
                     78: 
                     79: drop(ACTION) = ($move ($dobj) ($loc .ME))
                     80:                ($say "Dropped.\n")
                     81:                ;
                     82: 
                     83: DWIMD = (($and ($eq ($verb) take)
                     84:               ($ne ($loc ($dobj)) ($loc .ME))):
                     85:                        ($rtrn 0))
                     86:        (($and ($eq ($verb) drop)
                     87:               ($ne ($loc ($dobj)) .ME)):
                     88:                        ($rtrn 0))
                     89:        ($rtrn 1);
                     90: 
                     91: startrm (LDESC) =
                     92:                ($say 
                     93: "You are in a small but comfortable room.  You hardly want
                     94: to leave, but there is a door leading east, if you insist.\n")
                     95:                ;
                     96: startrm (SDESC) =
                     97:                ($say "Comfortable room.\n");
                     98: 
                     99: 
                    100: brightroom(LDESC) =
                    101:                ($say
                    102: "You are in a brightly lit room.  The walls sparkle with
                    103: scintillating lights.  There is a darker room to the west.\n");
                    104: 
                    105: brightroom(SDESC) = ($say "Bright room.\n");
                    106: 
                    107: 
                    108: ADJECTIVE red, blue;
                    109: NOUN red pillow(startrm);
                    110: NOUN blue pillow(startrm);
                    111: red pillow(LDESC) = ($say "There is a red pillow here.\n");
                    112: red pillow(SDESC) = ($say "A red pillow");
                    113: blue pillow(LDESC) = ($say "There is a blue pillow here.\n");
                    114: blue pillow(SDESC) = ($say "A blue pillow");
                    115: 
                    116: 
                    117: NOUN platinum(brightroom); bar=platinum;
                    118: platinum(LDESC) = ($say "There is a bar of platinum here!\n");
                    119: platinum(SDESC) = ($say "Platinum bar");
                    120: platinum(ACTION) = 
                    121:                (($eq ($verb) drop) :
                    122:                        (($eq ($loc .ME) ($loc [red pillow])):
                    123:                                ($say 
                    124: "The bar falls onto the red pillow, breaking it!  The symbolism
                    125: impresses itself upon you, and you go back to work instead of
                    126: playing these silly games!\n")
                    127:                                ($spec 3 0 0 0 0)
                    128:                        )
                    129:                );
                    130: 
                    131: VERB north, south, east, west;
                    132: n=north; s=south; e=east; w=west;
                    133: 
                    134: cg = ($say "You can't go that way.\n");
                    135: n(ACTION) = cg;
                    136: s(ACTION) = cg;
                    137: e(ACTION) = cg;
                    138: w(ACTION) = cg;
                    139: 
                    140: startrm(ACTION) =  (($eq ($verb) east) : 
                    141:                                ($move .ME brightroom)
                    142:                                ($exit 1)               { bypass default }
                    143:                        );
                    144: brightroom(ACTION) = (($eq ($verb) west) : ($move .ME startrm)($exit 1));
                    145: 
                    146: START = ($sdem Rdesc);
                    147: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.