


rrrrnnnndddd((((1111))))                                                     rrrrnnnndddd((((1111))))



rrrrnnnndddd ---- RRRRaaaannnnddddoooommmm ssssttttuuuuffffffff ggggeeeennnneeeerrrraaaattttoooorrrr ((((MMMMJJJJRRRR))))




SSSSYYYYNNNNTTTTAAAAXXXX

     rrrrnnnndddd file1 file2, etc...



OOOOPPPPTTTTIIIIOOOONNNNSSSS

   Each file must be a 'table' file.


DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN

   _R_n_d reads a file and writes generated  data  to  the  standard
   output.   If  more  than  one file is specified, the files are
   used as descriptions in sequence and merged output is  written
   to  the  standard  output.  Two types of files are recognized;
   table files, and subtable files.  A  table  file  can  contain
   several types of information:

     o+ Text-formats and text: these are simply text that will be
             included in the output. There are,  however,  a  few
             simple  rules.   Any text string ending in a ':' (no
             space afterwards) will NOT have a  newline  appended
             after it. This is to allow a user to have the output
             from a subtable placed after a text  string.   Other
             text  that does not have a ':' as the last character
             before a newline is printed as is.

     o+ Tabs and Formfeeds: to insert tabs and formfeeds, a "\t" (tab)
             or  a "\l" (formfeed ^L) is placed as the ONLY thing
             on that line. There must be no other  blank  spaces,
             etc.  This  is  inelegant, but allows the program to
             run reasonably fast. If a tab is coded, the  program
             does  NOT automatically generate a newline after it.
             This is to allow a user to separate stats with  tabs
             reasonably easily.

     o+ Stat commands: a stat command goes at the beginning of an
             otherwise empty line, in the format
             "stat <char string WITHOUT spaces> <# of dice> <type of dice>"
             Rnd will then roll the appropriate number of N-sided
             dice, and print the stat on the standard output.


     o+ Subtable commands: a subtable command goes at the beginning of
             an otherwise empty line, in the format

UTX/32 User's
Reference Manual               -1-                       Commands







rrrrnnnndddd((((1111))))                                                     rrrrnnnndddd((((1111))))



             "subtable <filename> <# of dice> <type of dice>"
             Rnd will then roll the appropriate number of N-sided
             dice, and open the subtable file. A subtable file is
             constructed as follows:
             <#upper limit> <text string>
             <#upper limit> <text string>
             Subtable files may not contain any  extraneous  text
             (unlike  table files) and all the entries must be in
             order, with the highest numerical entry as the  last
             line  in the file, and the lowest numerical entry as
             the first.  Each line must contain  a  number  value
             and a text string, or the results may be unusual.

     o+ Table commands: a table can contain a list of tables as well as
             stats,  format  commands,  text, and subtables. Each
             table is randomized recursively,  until  your  stack
             overflows,  or  it  returns,  whichever comes first.
             Stacking tables deeply  is  usually  not  necessary,
             since  several  tables  can be called on the command
             line, and that is much safer.  When a table  command
             is  invoked,  it  must be followed by two numbers so
             that the semi-braindead parser recognizes  it  as  a
             command.
             table <filename> <bogus #><bogus #>
             Each table can contain its own list of subtables and
             stats,  as well as text and format commands. This is
             lots of fun, since it allows the  discerning  DM  to
             make a variety of layered tables and gives excellent
             control over how much is generated. For  example  if
             you   determine   that   an  encounter  consists  of
             monsters, booty, and terrain, you could have a table
             that  invoked  the  monster  table, then the terrain
             one, then the booty. In this way,  you  would  still
             have  a  perfectly usable set of tables for any time
             you wanted just a  monster,  or  just  terrain.  The
             possibilities   as   far   as  maintaining  standard
             libraries are considerable, obviously.  The  primary
             limitation is your machine's stack and disk space.



EEEEXXXXAAAAMMMMPPPPLLLLEEEESSSS

     $ rrrrnnnndddd ppppiiiirrrraaaatttteeeessss

   rrrrnnnndddd reads the table named ppppiiiirrrraaaatttteeeessss and executes all the  stats,
   subtables, and tables contained therein.






UTX/32 User's
Reference Manual               -2-                       Commands







rrrrnnnndddd((((1111))))                                                     rrrrnnnndddd((((1111))))



     ((((TTTThhhheeee ccccoooonnnntttteeeennnnttttssss ooooffff ffffiiiilllleeee """"ppppiiiirrrraaaatttteeeessss""""....))))

   --------------------------------------
   A sample pirate -----
   stat strength 3 6
   \t
   stat brains 3 6

   possesions:
   subtable possesions 1 100

   table anothertable 0 0

   ---------------------------------------
   \l

        This would  generate  a  pirate  with  3d6  strength  and
   brains,  and would make a 1d100 roll on the possessions table.
   The table "anothertable" is then opened and treated as  a  new
   list  of commands. Note that there are 2 numbers provided with
   the table command.  This is MANDATORY, and due  only  to  lazy
   programming.  Live  with  it.  Appropriate tabs and a formfeed
   are generated.


     ((((ccccoooonnnntttteeeennnnttttssss ooooffff ffffiiiilllleeee """"ppppoooosssssssseeeessssiiiioooonnnnssss""""))))

   10 Cutlass
   20 Fists
   30 Bucket of Grog
   40 Belaying Pin
   90 Just his clothes
   100 Fancy clothes


   In this example, when the subtable was  called,  a  1d100  was
   rolled (be sure to specify that right!) 0-10 yields a Cutlass,
   11-20 Fists, etc.



SSSSPPPPEEEECCCCIIIIAAAALLLL CCCCOOOONNNNSSSSIIIIDDDDEEEERRRRAAAATTTTIIIIOOOONNNNSSSS

     o+ This program is machine dependent to the degree that  your
       machine likes recursion.

     o+ A random seed is requested for portability's  sake.  Those
       of you on UNIX systems are urged to use something like:
       srand((unsigned)getpid());
       instead. Any random stirrer is appropriate.



UTX/32 User's
Reference Manual               -3-                       Commands







rrrrnnnndddd((((1111))))                                                     rrrrnnnndddd((((1111))))



     o+ This  program  has  run  on  Gould  Powernode  9080,   Sun
       workstations,  and  my IBM compatible clone (lattice 3.0).
       On the PCs, usually some provision will have to be made to
       increase  the  stack  size.  On  lattice  this  is done by
       declaring a  global  "int  _stack  =  6000;"  or  about  6
       kilobytes.   You  decide. No guarantees are made for other
       compilers/machines, but anything that is not braindead can
       handle it.

     o+ Capturing  the  output::  This  program  is  designed  for
       systems  with  I/O  redirection.  If  you don't have it, I
       suggest you frob the code slightly by changing all printfs
       to fprintf, etc. For you with I/O redirection, the initial
       text, etc, is returned on the standard error, so  it  will
       not  kluge  up your characters as they are generated. Pipe
       the  output  through  your  favorite  formatter,   editor,
       printer, or null device.



SSSSEEEEEEEE AAAALLLLSSSSOOOO

   no references

AAAAuuuutttthhhhoooorrrr:::: Marcus J Ranum, Gould Inc. All rights reserved. Don't use
this  to  make money, or sell. Otherwise it may be freely copied,
deleted, and hacked.  Give me credit for the  idea,  if  not  the
code.

























UTX/32 User's
Reference Manual               -4-                       Commands




