! Part IV. Printing ! ------------------------------------------------------------------------------ Constant LanguageAnimateGender = male; Constant LanguageInanimateGender = neuter; Constant LanguageContractionForms = 2; ! English has two: ! 0 = starting with a consonant ! 1 = starting with a vowel [ LanguageContraction text; if (text->0 == 'a' or 'e' or 'i' or 'o' or 'u' or 'A' or 'E' or 'I' or 'O' or 'U') return 1; return 0; ]; Array LanguageArticles --> ! Contraction form 0: Contraction form 1: ! Cdef Def Indef Cdef Def Indef "The " "the " "a " "The " "the " "an " ! Articles 0 "The " "the " "some " "The " "the " "some "; ! Articles 1 ! a i ! s p s p ! m f n m f n m f n m f n Array LanguageGNAsToArticles --> 0 0 0 1 1 1 0 0 0 1 1 1; [ LanguageDirection d; switch (d) { n_to: print "north"; s_to: print "south"; e_to: print "east"; w_to: print "west"; ne_to: print "northeast"; nw_to: print "northwest"; se_to: print "southeast"; sw_to: print "southwest"; u_to: print "up"; d_to: print "down"; in_to: print "in"; out_to: print "out"; default: return RunTimeError(9,d); } ]; [ LanguageNumber n f; if (n == 0) { print "zero"; rfalse; } if (n < 0) { print "minus "; n = -n; } if (n >= 1000) { print (LanguageNumber) n/1000, " thousand"; n = n%1000; f = 1; } if (n >= 100) { if (f == 1) print ", "; print (LanguageNumber) n/100, " hundred"; n = n%100; f = 1; } if (n == 0) rfalse; #Ifdef DIALECT_US; if (f == 1) print " "; #Ifnot; if (f == 1) print " and "; #Endif; switch (n) { 1: print "one"; 2: print "two"; 3: print "three"; 4: print "four"; 5: print "five"; 6: print "six"; 7: print "seven"; 8: print "eight"; 9: print "nine"; 10: print "ten"; 11: print "eleven"; 12: print "twelve"; 13: print "thirteen"; 14: print "fourteen"; 15: print "fifteen"; 16: print "sixteen"; 17: print "seventeen"; 18: print "eighteen"; 19: print "nineteen"; 20 to 99: switch (n/10) { 2: print "twenty"; 3: print "thirty"; 4: print "forty"; 5: print "fifty"; 6: print "sixty"; 7: print "seventy"; 8: print "eighty"; 9: print "ninety"; } if (n%10 ~= 0) print "-", (LanguageNumber) n%10; } ]; [ LanguageTimeOfDay hours mins i; i = hours%12; if (i == 0) i = 12; if (i < 10) print " "; print i, ":", mins/10, mins%10; if ((hours/12) > 0) print " pm"; else print " am"; ]; [ LanguageVerb i; switch (i) { 'i//','inv','inventory': print "take inventory"; 'l//': print "look"; 'x//': print "examine"; 'z//': print "wait"; default: rfalse; } rtrue; ]; ! ---------------------------------------------------------------------------- ! LanguageVerbIsDebugging is called by SearchScope. It should return true ! if word w is a debugging verb which needs all objects to be in scope. ! ---------------------------------------------------------------------------- #Ifdef DEBUG; [ LanguageVerbIsDebugging w; if (w == 'purloin' or 'tree' or 'abstract' or 'gonear' or 'scope' or 'showobj') rtrue; rfalse; ]; #Endif; ! ---------------------------------------------------------------------------- ! LanguageVerbLikesAdverb is called by PrintCommand when printing an UPTO_PE ! error or an inference message. Words which are intransitive verbs, i.e., ! which require a direction name as an adverb ('walk west'), not a noun ! ('I only understood you as far as wanting to touch /the/ ground'), should ! cause the routine to return true. ! ---------------------------------------------------------------------------- [ LanguageVerbLikesAdverb w; if (w == 'look' or 'go' or 'push' or 'walk') rtrue; rfalse; ]; ! ---------------------------------------------------------------------------- ! LanguageVerbMayBeName is called by NounDomain when dealing with the ! player's reply to a "Which do you mean, the short stick or the long ! stick?" prompt from the parser. If the reply is another verb (for example, ! LOOK) then then previous ambiguous command is discarded /unless/ ! it is one of these words which could be both a verb /and/ an ! adjective in a 'name' property. ! ---------------------------------------------------------------------------- [ LanguageVerbMayBeName w; if (w == 'long' or 'short' or 'normal' or 'brief' or 'full' or 'verbose') rtrue; rfalse; ]; Constant NKEY__TX = "N = next subject"; Constant PKEY__TX = "P = previous"; Constant QKEY1__TX = " Q = resume game"; Constant QKEY2__TX = "Q = previous menu"; Constant RKEY__TX = "RETURN = read subject"; Constant NKEY1__KY = 'N'; Constant NKEY2__KY = 'n'; Constant PKEY1__KY = 'P'; Constant PKEY2__KY = 'p'; Constant QKEY1__KY = 'Q'; Constant QKEY2__KY = 'q'; Constant SCORE__TX = "Score: "; Constant MOVES__TX = "Moves: "; Constant TIME__TX = "Time: "; Constant CANTGO__TX = "You can't go that way."; Constant FORMER__TX = "your former self"; Constant YOURSELF__TX = "yourself"; Constant YOU__TX = "You"; Constant DARKNESS__TX = "Darkness"; Constant THOSET__TX = "those things"; Constant THAT__TX = "that"; Constant OR__TX = " or "; Constant NOTHING__TX = "nothing"; Constant IS__TX = " is"; Constant ARE__TX = " are"; Constant IS2__TX = "is "; Constant ARE2__TX = "are "; Constant AND__TX = " and "; Constant WHOM__TX = "whom "; Constant WHICH__TX = "which "; Constant COMMA__TX = ", "; [ ThatorThose obj; ! Used in the accusative if (obj == player) { print "you"; return; } if (obj has pluralname) { print "those"; return; } if (obj has animate) { if (obj has female) { print "her"; return; } else if (obj hasnt neuter) { print "him"; return; } } print "that"; ]; [ ItorThem obj; if (obj == player) { print "yourself"; return; } if (obj has pluralname) { print "them"; return; } if (obj has animate) { if (obj has female) { print "her"; return; } else if (obj hasnt neuter) { print "him"; return; } } print "it"; ]; [ IsorAre obj; if (obj has pluralname || obj == player) print "are"; else print "is"; ]; [ CThatorThose obj; ! Used in the nominative if (obj == player) { print "You"; return; } if (obj has pluralname) { print "Those"; return; } if (obj has animate) { if (obj has female) { print "She"; return; } else if (obj hasnt neuter) { print "He"; return; } } print "That"; ]; [ CTheyreorThats obj; if (obj == player) { print "You're"; return; } if (obj has pluralname) { print "They're"; return; } if (obj has animate) { if (obj has female) { print "She's"; return; } else if (obj hasnt neuter) { print "He's"; return; } } print "That's"; ];