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 150-334)

150  !   Part IV.   Printing
151  ! ---------------------------------------------------------------------------
152   
153  Constant LanguageAnimateGender   = male;
154  Constant LanguageInanimateGender = neuter;
155   
156  Constant LanguageContractionForms = 2;     ! English has two:
157                                             ! 0 = starting with a consonant
158                                             ! 1 = starting with a vowel
159   
160  [ LanguageContraction text;
161    if (text->0 == 'a' or 'e' or 'i' or 'o' or 'u'
162                   or 'A' or 'E' or 'I' or 'O' or 'U') return 1;
163    return 0;
164  ];
165   
166  Array LanguageArticles -->
167   
168   !   Contraction form 0:     Contraction form 1:
169   !   Cdef   Def    Indef     Cdef   Def    Indef
170   
171       "The " "the " "a "      "The " "the " "an "          ! Articles 0
172       "The " "the " "some "   "The " "the " "some ";       ! Articles 1
173   
174                     !             a           i
175                     !             s     p     s     p
176                     !             m f n m f n m f n m f n                 
177   
178  Array LanguageGNAsToArticles --> 0 0 0 1 1 1 0 0 0 1 1 1;
179   
180  [ LanguageDirection d;
181     switch(d)
182     {   n_to: print "north";
183         s_to: print "south";
184         e_to: print "east";
185         w_to: print "west";
186         ne_to: print "northeast";
187         nw_to: print "northwest";
188         se_to: print "southeast";
189         sw_to: print "southwest";
190         u_to: print "up";
191         d_to: print "down";
192         in_to: print "in";
193         out_to: print "out";
194         default: return RunTimeError(9,d);
195     }
196  ];
197   
198  [ LanguageNumber n f;
199    if (n==0)    { print "zero"; rfalse; }
200    if (n<0)     { print "minus "; n=-n; }
201    if (n>=1000) { print (LanguageNumber) n/1000, " thousand"; n=n%1000; f=1; }
202    if (n>=100)  { if (f==1) print ", ";
203                   print (LanguageNumber) n/100, " hundred"; n=n%100; f=1; }
204    if (n==0) rfalse;
205    #ifndef DIALECT_US;
206    if (f==1) print " and ";
207    #ifnot;
208    if (f==1) print " ";
209    #endif;
210    switch(n)
211    {   1:  print "one";
212        2:  print "two";
213        3:  print "three";
214        4:  print "four";
215        5:  print "five";
216        6:  print "six";
217        7:  print "seven";
218        8:  print "eight";
219        9:  print "nine";
220        10: print "ten";
221        11: print "eleven";
222        12: print "twelve";
223        13: print "thirteen";
224        14: print "fourteen";
225        15: print "fifteen";
226        16: print "sixteen";
227        17: print "seventeen";
228        18: print "eighteen";
229        19: print "nineteen";
230        20 to 99:
231            switch(n/10)
232            {  2: print "twenty";
233               3: print "thirty";
234               4: print "forty";
235               5: print "fifty";
236               6: print "sixty";
237               7: print "seventy";
238               8: print "eighty";
239               9: print "ninety";
240            }
241            if (n%10 ~= 0) print "-", (LanguageNumber) n%10;
242    }
243  ];
244   
245  [ LanguageTimeOfDay hours mins i;
246     i=hours%12;
247     if (i==0) i=12;
248     if (i<10) print " ";
249     print i, ":", mins/10, mins%10;
250     if ((hours/12) > 0) print " pm"; else print " am";
251  ];
252   
253  [ LanguageVerb i;
254     if (i==#n$l)        { print "look";              rtrue; }
255     if (i==#n$z)        { print "wait";              rtrue; }
256     if (i==#n$x)        { print "examine";           rtrue; }
257     if (i==#n$i or 'inv' or 'inventory')
258                         { print "inventory";         rtrue; }
259     rfalse;
260  ];
261   
262  Constant NKEY__TX     = "N = next subject";
263  Constant PKEY__TX     = "P = previous";
264  Constant QKEY1__TX    = "  Q = resume game";
265  Constant QKEY2__TX    = "Q = previous menu";
266  Constant RKEY__TX     = "RETURN = read subject";
267   
268  Constant NKEY1__KY    = 'N';
269  Constant NKEY2__KY    = 'n';
270  Constant PKEY1__KY    = 'P';
271  Constant PKEY2__KY    = 'p';
272  Constant QKEY1__KY    = 'Q';
273  Constant QKEY2__KY    = 'q';
274   
275  Constant SCORE__TX    = "Score: ";
276  Constant MOVES__TX    = "Moves: ";
277  Constant TIME__TX     = "Time: ";
278  Constant CANTGO__TX   = "You can't go that way.";
279  Constant FORMER__TX   = "your former self";
280  Constant YOURSELF__TX = "yourself";
281  Constant DARKNESS__TX = "Darkness";
282   
283  Constant THOSET__TX   = "those things";
284  Constant THAT__TX     = "that";
285  Constant OR__TX       = " or ";
286  Constant NOTHING__TX  = "nothing";
287  Constant IS__TX       = " is";
288  Constant ARE__TX      = " are";
289  Constant IS2__TX      = "is ";
290  Constant ARE2__TX     = "are ";
291  Constant AND__TX      = " and ";
292  Constant WHOM__TX     = "whom ";
293  Constant WHICH__TX    = "which ";
294   
295  [ ThatorThose obj;   ! Used in the accusative
296    if (obj == player) { print "you"; return; }
297    if (obj has pluralname) { print "those"; return; }
298    if (obj has animate)
299    {   if (obj has female) { print "her"; return; }
300        else if (obj hasnt neuter) { print "him"; return; }
301    }
302    print "that";
303  ];
304  [ ItorThem obj;
305    if (obj == player) { print "yourself"; return; }
306    if (obj has pluralname) { print "them"; return; }
307    if (obj has animate)
308    {   if (obj has female) { print "her"; return; }
309        else if (obj hasnt neuter) { print "him"; return; }
310    }
311    print "it";
312  ];
313  [ IsorAre obj;
314    if (obj has pluralname || obj == player) print "are"; else print "is";
315  ];
316  [ CThatorThose obj;   ! Used in the nominative
317    if (obj == player) { print "You"; return; }
318    if (obj has pluralname) { print "Those"; return; }
319    if (obj has animate)
320    {   if (obj has female) { print "She"; return; }
321        else if (obj hasnt neuter) { print "He"; return; }
322    }
323    print "That";
324  ];
325  [ CTheyreorThats obj;
326    if (obj == player) { print "You're"; return; }
327    if (obj has pluralname) { print "They're"; return; }
328    if (obj has animate)
329    {   if (obj has female) { print "She's"; return; }
330        else if (obj hasnt neuter) { print "He's"; return; }
331    }
332    print "That's";
333  ];
334   


Last updated 27 February 2004. This web site has not been fully supported since April 2008. Information may be out of date. This page was originally managed by Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight.