Assorted Text Generation

version 4 by Emily Short

  • Home page
  • Beginning
  • Previous
  • Next



  • Section: Numbers

        say "[ordinal of N]"

    will produce output such as "first," "second," "tenth," "twenty-first," and so on. It should be reliable up through quite high numbers, and has been tested up to a thousand. "numerical ordinal of N" produces 1st, 2nd, 3rd, and so on.

         (N - a number) to the nearest (A - a number)

    allows us to write, e.g.
        
        say "[N to the nearest 5 in words]"

    in a way that is uniform with Inform's built in

        say "[the time of day to the nearest five minutes in words]"

    and may be useful for approximations.

        say "[N in round numbers]"
        say "[adjectival N in round numbers]"

    produces textual output in a way similar to that shown in the manual example Ballpark; the adjectival form is to print text like "no" or "a couple of", while the bare form would print "zero" or "a couple" for the same numbers. Thus

        When play begins:
            repeat with N running from 0 to 4
            begin;
                say "You see [adjectival N in round numbers] [if N is 1]person[otherwise]people[end if] here; that's right, [N in round numbers].";
            end repeat.
        
    would produce the output

        You see no people here; that's right, zero.
        You see one person here; that's right, one.
        You see a couple of people here; that's right, a couple.
        You see several people here; that's right, several.
        You see a few people here; that's right, a few.