home *** CD-ROM | disk | FTP | other *** search
/ CD PowerPlay 6 / TheCompleteAdventureCollection1995 / CDPP6.ISO / utility / agtsrc / param.pa4 < prev    next >
Encoding:
Text File  |  1989-12-20  |  6.9 KB  |  210 lines

  1.  
  2.   {PARAM.PA2}
  3.  
  4.  
  5.   PROCEDURE CheckParams;
  6.  
  7.  
  8.   VAR
  9.     NumPara, Spot : Integer;
  10.     P, p1, p2, p3 : words;
  11.     {PARAMCOUNT AND PARAMSTR(I..PARAMCOUNT) ARE TURBO FNS}
  12.  
  13.     PROCEDURE Handle_File_Name;
  14.  
  15.     BEGIN                         {PROPER FORM TO CREATE FINAL VERSION}
  16.       p2 := '';
  17.       IF POS(':', p1) <> 0 THEN
  18.         BEGIN
  19.           Spot := POS(':', p1);
  20.           p2 := Copy(p1, 1, Spot); {up to ':'}
  21.           p1 := Copy(p1, Spot+1, 255); {after ':'}
  22.         END;
  23.       WHILE POS('\', p1) <> 0 DO
  24.         BEGIN
  25.           Spot := POS('\', p1);
  26.           p2 := p2+Copy(p1, 1, Spot); {up to '\'}
  27.           p1 := Copy(p1, Spot+1, 255); {after '\'}
  28.         END;
  29.       IF p2 <> '' THEN            {need to change directory}
  30.         BEGIN
  31.           Spot := Length(p2);
  32.           IF p2[Spot] = '\' THEN p2 := Copy(p2, 1, Spot-1); {strip off last '\'}
  33.           {$I-} ChDir(p2); {$I+}
  34.           IF IoResult <> 0 THEN
  35.             BEGIN
  36.               WriteLn('Cannot find directory: ', p2);
  37.               Halt;
  38.             END;
  39.         END;                      {change directory}
  40.       P := p1;
  41.       Adventure_Name := P;
  42.       data_file_name := P+'.DAT';
  43.       title_file_name := P+'.TTL';
  44.       descr_file_name := P+'.D$$';
  45.       Command_File_Name := P+'.CMD';
  46.       Instruction_File_Name := P+'.INS';
  47.       IF File_Exists(descr_file_name)
  48.       AND File_Exists(P+'.DA1')   {1ST DATA FILE}
  49.       AND File_Exists(P+'.DA2')   {ROOM DATA FILE}
  50.       THEN UsingFinalVersion := True
  51.       ELSE
  52.         IF NOT File_Exists(descr_file_name)
  53.         THEN
  54.           BEGIN
  55.             WriteLn(IO, ' ');
  56.             WriteLn(IO, 'Final version data file not present on default drive.');
  57.             WriteLn(IO, 'You need to compile your adventure, before playing it.');
  58.             WriteLn(IO, '(i.e., First "COMPILE CRUSADE")');
  59.             WriteLn(IO, 'RUN program terminated.');
  60.             Halt;
  61.           END;                    {IF}
  62.     END;                          {Handle_File_Name}
  63.  
  64.   BEGIN
  65.     {$V-}
  66.     UsingFinalVersion := False;
  67.     DoingUpperCase := True;
  68.     p1 := '';
  69.     p2 := '';
  70.     p3 := '';
  71.     NumPara := ParamCount;
  72.     IF NumPara >= 1 THEN
  73.       BEGIN
  74.         p1 := ParamStr(1);
  75.         P := ParamStr(1);
  76.         Capitalize(p1);
  77.         Capitalize(P);
  78.       END;
  79.     IF NumPara >= 2 THEN
  80.       BEGIN
  81.         p2 := ParamStr(2);
  82.         Capitalize(p2);
  83.       END;
  84.     IF NumPara >= 3 THEN
  85.       BEGIN
  86.         p3 := ParamStr(3);
  87.         Capitalize(p3);
  88.       END;
  89.     IF ((p2 = '/L') OR (p2 = 'L')) THEN
  90.       BEGIN
  91.         DoingUpperCase := False;
  92.         p2 := p3;
  93.         NumPara := NumPara-1;
  94.       END
  95.     ELSE IF ((p2 = '/B') OR (p2 = 'B')) THEN
  96.       BEGIN
  97.         DirectVideo := False;
  98.         p2 := p3;
  99.         NumPara := NumPara-1;
  100.       END;
  101.     IF (p3 = '/L') OR (p3 = 'L') THEN
  102.       BEGIN
  103.         DoingUpperCase := False;
  104.         NumPara := NumPara-1;
  105.       END
  106.     ELSE IF ((p3 = '/B') OR (p3 = 'B')) THEN
  107.       BEGIN
  108.         DirectVideo := False;
  109.         NumPara := NumPara-1;
  110.       END;
  111.     CASE NumPara OF
  112.       0 : BEGIN
  113.             WriteLn(IO, ' ');
  114.             WriteLn(IO, 'Command format: RUN filename');
  115.             WriteLn(IO, ' (where "filename" is 1..8 characters; do not',
  116.                     ' specify any file extension.)');
  117.             WriteLn(IO, ' ');
  118.             Halt;
  119.           END;
  120.       1 : BEGIN
  121.             IF (p1 = '?') OR (p1 = 'HELP')
  122.             THEN
  123.               BEGIN
  124.                 WriteLn(IO, ' ');
  125.                 WriteLn(IO, 'Command format: RUN filename');
  126.                 WriteLn(IO, ' (where "filename" is 1..8 characters; do not',
  127.                         ' specify any file extension.)');
  128.                 WriteLn(IO, ' ');
  129.                 Halt;
  130.               END
  131.             ELSE Handle_File_Name;
  132.           END;                    {CASE 1}
  133.     ELSE                          {FOR CASE}
  134.       BEGIN
  135.         WriteLn(IO, ' ');
  136.         WriteLn(IO, 'Command format: RUN filename');
  137.         WriteLn(IO, ' (where "filename" is 1..8 characters; do not',
  138.                 ' specify any file extension.)');
  139.         WriteLn(IO, ' ');
  140.         Halt;
  141.       END;                        {CASE ELSE}
  142.     END;                          {CASE STATEMENT}
  143.   END;                            {CHECKPARAMS}
  144.   {$V+}
  145.  
  146.  
  147.   { TELL (NOUN,OBJECT) }
  148.   {TELL MAN ABOUT SWORD, TALK TO PRINCESS}
  149.   {TALK WITH JEFF ABOUT SCHOOL WORK }
  150.  
  151.   PROCEDURE TELL(noun, object_word : words);
  152.   VAR m_num, o_num : Integer;
  153.  
  154.   BEGIN
  155.     m_num := Noun_Number(noun);
  156.     o_num := Noun_Number(object_word);
  157.     Normalize(noun);
  158.     Normalize(object_word);
  159.     IF (noun = 'all') OR (object_word = 'all') THEN
  160.       WriteLn(IO, 'You can only talk with one person at a time about one subject at a time!')
  161.     ELSE IF (NounNumber < First_creature) OR (NounNumber > MaxCreature)
  162.     THEN BEGIN
  163.       WriteLn(IO, 'Talking with the ', noun, ' is kind of silly, since the ');
  164.       WriteLn(IO, noun, ' can''t talk back!');
  165.     END
  166.     ELSE IF (M[NounNumber]^.gender = Thing) {Thing's can't talk}
  167.     THEN WriteLn(IO, 'The ', noun, ' just listens to you, but remains strangely silent.')
  168.     ELSE                          {VALID CREATURE}
  169.       BEGIN
  170.         IF object_word = ''
  171.         THEN WriteLn(IO, 'You spend a few minutes in pleasant conversation with the ', noun, '.')
  172.         ELSE BEGIN
  173.           WriteLn(IO, 'You spend a few minutes in pleasant conversation with the ', noun);
  174.           WriteLn(IO, 'chatting about the ', object_word, '.');
  175.         END;
  176.         WriteLn(IO, 'However, you don''t learn anything that you didn''t already know.');
  177.       END;
  178.   END;                            {TELL}
  179.  
  180.   { ASK (NOUN,OBJECT) }
  181.   {ASK MAN ABOUT SWORD, ASK JEFF ABOUT SCHOOL WORK}
  182.  
  183.   PROCEDURE ASK(noun, object_word : words);
  184.   VAR m_num, o_num : Integer;
  185.  
  186.   BEGIN
  187.     m_num := Noun_Number(noun);
  188.     o_num := Noun_Number(object_word);
  189.     Normalize(noun);
  190.     Normalize(object_word);
  191.     IF (noun = 'all') OR (object_word = 'all') THEN
  192.       WriteLn(IO, 'You can only talk with one person at a time about one subject at a time!')
  193.     ELSE IF (NounNumber < First_creature) OR (NounNumber > MaxCreature)
  194.     THEN BEGIN
  195.       WriteLn(IO, 'Asking the ', noun, ' questions is kind of silly, since the ');
  196.       WriteLn(IO, noun, ' can''t answer back!');
  197.     END
  198.     ELSE IF (M[NounNumber]^.gender = Thing) {Thing's can't talk}
  199.     THEN WriteLn(IO, 'The ', noun, ' just listens to you, but remains strangely silent.')
  200.     ELSE                          {VALID CREATURE}
  201.       IF object_word = ''
  202.       THEN WriteLn(IO, 'You must ask the ', noun, ' ABOUT something!')
  203.       ELSE BEGIN
  204.         WriteLn(IO, 'The ', noun, ' tells you all about the ', object_word, ', but the ', noun);
  205.         WriteLn(IO, 'isn''t exactly a fountain of knowledge and you don''t learn');
  206.         WriteLn(IO, 'anything that you didn''t already know.');
  207.       END;
  208.   END;                            {ASK}
  209.  
  210.