Inform - Support - Source

Back to List

Inventory
Complete

Backward
Forward

Plain
Coloured
Gaudy

This code
in plain text

Browsing English.h

! Part IV. Printing (lines 171-413)

171  !   Part IV.   Printing
172  ! ------------------------------------------------------------------------------
173   
174  Constant LanguageAnimateGender   = male;
175  Constant LanguageInanimateGender = neuter;
176   
177  Constant LanguageContractionForms = 2;     ! English has two:
178                                             ! 0 = starting with a consonant
179                                             ! 1 = starting with a vowel
180   
181  [ LanguageContraction text;
182      if (text->0 == 'a' or 'e' or 'i' or 'o' or 'u'
183                  or 'A' or 'E' or 'I' or 'O' or 'U') return 1;
184      return 0;
185  ];
186   
187  Array LanguageArticles -->
188   
189   !   Contraction form 0:     Contraction form 1:
190   !   Cdef   Def    Indef     Cdef   Def    Indef
191   
192       "The " "the " "a "      "The " "the " "an "          ! Articles 0
193       "The " "the " "some "   "The " "the " "some ";       ! Articles 1
194   
195                     !             a           i
196                     !             s     p     s     p
197                     !             m f n m f n m f n m f n
198   
199  Array LanguageGNAsToArticles --> 0 0 0 1 1 1 0 0 0 1 1 1;
200   
201  [ LanguageDirection d;
202      switch (d) {
203        n_to:    print "north";
204        s_to:    print "south";
205        e_to:    print "east";
206        w_to:    print "west";
207        ne_to:   print "northeast";
208        nw_to:   print "northwest";
209        se_to:   print "southeast";
210        sw_to:   print "southwest";
211        u_to:    print "up";
212        d_to:    print "down";
213        in_to:   print "in";
214        out_to:  print "out";
215        default: return RunTimeError(9,d);
216      }
217  ];
218   
219  [ LanguageNumber n f;
220      if (n == 0)    { print "zero"; rfalse; }
221      if (n < 0)     { print "minus "; n = -n; }
222      if (n >= 1000) { print (LanguageNumber) n/1000, " thousand"; n = n%1000; f = 1; }
223      if (n >= 100)  {
224          if (f == 1) print ", ";
225          print (LanguageNumber) n/100, " hundred"; n = n%100; f = 1;
226      }
227      if (n == 0) rfalse;
228      #Ifdef DIALECT_US;
229      if (f == 1) print " ";
230      #Ifnot;
231      if (f == 1) print " and ";
232      #Endif;
233      switch (n) {
234        1:    print "one";
235        2:    print "two";
236        3:    print "three";
237        4:    print "four";
238        5:    print "five";
239        6:    print "six";
240        7:    print "seven";
241        8:    print "eight";
242        9:    print "nine";
243        10:   print "ten";
244        11:   print "eleven";
245        12:   print "twelve";
246        13:   print "thirteen";
247        14:   print "fourteen";
248        15:   print "fifteen";
249        16:   print "sixteen";
250        17:   print "seventeen";
251        18:   print "eighteen";
252        19:   print "nineteen";
253        20 to 99: switch (n/10) {
254          2:  print "twenty";
255          3:  print "thirty";
256          4:  print "forty";
257          5:  print "fifty";
258          6:  print "sixty";
259          7:  print "seventy";
260          8:  print "eighty";
261          9:  print "ninety";
262          }
263          if (n%10 ~= 0) print "-", (LanguageNumber) n%10;
264      }
265  ];
266   
267  [ LanguageTimeOfDay hours mins i;
268      i = hours%12;
269      if (i == 0) i = 12;
270      if (i < 10) print " ";
271      print i, ":", mins/10, mins%10;
272      if ((hours/12) > 0) print " pm"; else print " am";
273  ];
274   
275  [ LanguageVerb i;
276      switch (i) {
277        'i//','inv','inventory':
278                 print "take inventory";
279        'l//':   print "look";
280        'x//':   print "examine";
281        'z//':   print "wait";
282        default: rfalse;
283      }
284      rtrue;
285  ];
286   
287  ! ----------------------------------------------------------------------------
288  !  LanguageVerbIsDebugging is called by SearchScope.  It should return true 
289  !  if word w is a debugging verb which needs all objects to be in scope.
290  ! ----------------------------------------------------------------------------
291   
292  #Ifdef DEBUG;
293  [ LanguageVerbIsDebugging w;
294      if (w == 'purloin' or 'tree' or 'abstract'
295                         or 'gonear' or 'scope' or 'showobj')
296          rtrue;
297      rfalse;
298  ];
299  #Endif;
300   
301  ! ----------------------------------------------------------------------------
302  !  LanguageVerbLikesAdverb is called by PrintCommand when printing an UPTO_PE
303  !  error or an inference message.  Words which are intransitive verbs, i.e.,
304  !  which require a direction name as an adverb ('walk west'), not a noun
305  !  ('I only understood you as far as wanting to touch /the/ ground'), should
306  !  cause the routine to return true.
307  ! ----------------------------------------------------------------------------
308   
309  [ LanguageVerbLikesAdverb w;
310      if (w == 'look' or 'go' or 'push' or 'walk')
311          rtrue;
312      rfalse;
313  ];
314   
315  ! ----------------------------------------------------------------------------
316  !  LanguageVerbMayBeName is called by NounDomain when dealing with the 
317  !  player's reply to a "Which do you mean, the short stick or the long
318  !  stick?" prompt from the parser. If the reply is another verb (for example,
319  !  LOOK) then then previous ambiguous command is discarded /unless/
320  !  it is one of these words which could be both a verb /and/ an
321  !  adjective in a 'name' property.
322  ! ----------------------------------------------------------------------------
323   
324  [ LanguageVerbMayBeName w;
325      if (w == 'long' or 'short' or 'normal'
326                      or 'brief' or 'full' or 'verbose')
327          rtrue;
328      rfalse;
329  ];
330   
331  Constant NKEY__TX       = "N = next subject";
332  Constant PKEY__TX       = "P = previous";
333  Constant QKEY1__TX      = "  Q = resume game";
334  Constant QKEY2__TX      = "Q = previous menu";
335  Constant RKEY__TX       = "RETURN = read subject";
336   
337  Constant NKEY1__KY      = 'N';
338  Constant NKEY2__KY      = 'n';
339  Constant PKEY1__KY      = 'P';
340  Constant PKEY2__KY      = 'p';
341  Constant QKEY1__KY      = 'Q';
342  Constant QKEY2__KY      = 'q';
343   
344  Constant SCORE__TX      = "Score: ";
345  Constant MOVES__TX      = "Moves: ";
346  Constant TIME__TX       = "Time: ";
347  Constant CANTGO__TX     = "You can't go that way.";
348  Constant FORMER__TX     = "your former self";
349  Constant YOURSELF__TX   = "yourself";
350  Constant YOU__TX        = "You";
351  Constant DARKNESS__TX   = "Darkness";
352   
353  Constant THOSET__TX     = "those things";
354  Constant THAT__TX       = "that";
355  Constant OR__TX         = " or ";
356  Constant NOTHING__TX    = "nothing";
357  Constant IS__TX         = " is";
358  Constant ARE__TX        = " are";
359  Constant IS2__TX        = "is ";
360  Constant ARE2__TX       = "are ";
361  Constant AND__TX        = " and ";
362  Constant WHOM__TX       = "whom ";
363  Constant WHICH__TX      = "which ";
364  Constant COMMA__TX      = ", ";
365   
366   
367  [ ThatorThose obj;      ! Used in the accusative
368      if (obj == player)            { print "you"; return; }
369      if (obj has pluralname)       { print "those"; return; }
370      if (obj has animate) {
371          if (obj has female)       { print "her"; return; }
372          else
373              if (obj hasnt neuter) { print "him"; return; }
374      }
375      print "that";
376  ];
377   
378  [ ItorThem obj;
379      if (obj == player)            { print "yourself"; return; }
380      if (obj has pluralname)       { print "them"; return; }
381      if (obj has animate) {
382          if (obj has female)       { print "her"; return; }
383          else
384              if (obj hasnt neuter) { print "him"; return; }
385      }
386      print "it";
387  ];
388   
389  [ IsorAre obj;
390      if (obj has pluralname || obj == player) print "are"; else print "is";
391  ];
392   
393  [ CThatorThose obj;     ! Used in the nominative
394      if (obj == player)            { print "You"; return; }
395      if (obj has pluralname)       { print "Those"; return; }
396      if (obj has animate) {
397          if (obj has female)       { print "She"; return; }
398          else
399              if (obj hasnt neuter) { print "He"; return; }
400      }
401      print "That";
402  ];
403   
404  [ CTheyreorThats obj;
405      if (obj == player)             { print "You're"; return; }
406      if (obj has pluralname)        { print "They're"; return; }
407      if (obj has animate) {
408          if (obj has female)        { print "She's"; return; }
409          else if (obj hasnt neuter) { print "He's"; return; }
410      }
411      print "That's";
412  ];
413   


Last updated 27 February 2004. The librarian in charge of this page is Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight. Please email any comments, suggestions or corrections to cedenqs@inform-fiction.org.