The Fortune Cookie Program (C) J. Finnis 1991-1994  NOTE: This is version 3.25 - the data files for this version are incompatible with data files for versions 3.7 and below because of the use of adaptive huffman compression. I hate writing docs, but here goes.... Having "grown up" on big UNIX machines, I missed a lot of the fun features of these machines when I started using my Amiga. One of these was the Fortune program, which prints out a random text from a (usually huge) file. I wrote my own version, with a few(!) extra features: o It can open a window on the workbench screen; o It can be "iconised" out of the way, and then called up again later; o The text file is compressed, and contains a special "jump table" so fortunes can be read very quickly, no matter how big the file; o The window can be used with any font; o The fortune can be printed out or even spoken with the narrator; o It can be run from the Workbench; o It works under Workbench 2.0. o Can change the background colour of the window to any WB colour. o A particular fortune can be invoked by number. o It has a built-in alarm clock and memory monitor o It uses Nico François' rather nice reqtools.library (if it can find it). A small fortune data file is provided, as well as a program for turning ordinary text files into a compressed fortune data file with a jump table. You can read about this later on.  Using the Fortune program  The program can be run from either the Workbench or the CLI. First, the Workbench. You can easily run the program just by double-clicking on its icon. It normally looks for a data file called "fortunes" in the same directory, but you can change this if you want to (see the bit about Tool Types later on). That's the easiest way to use it. Another way, which is useful if you have more than one data file and you want to get a fortune from a particular one, is to double-click on the icon for that data file. This icon looks like a smaller version of the fortune program's icon, but has the word "data" written in it. The "makefort" program automatically makes this icon for you when you make a fortune data file. If you use this method, the fortune program must be in the same directory.  The Fortune Window  A window should open, with a fortune printed inside it. Laugh, or ponder, and then either click on the close gadget to quit the program, or press one of the keys below. If you wait for a bit (usually about ten seconds, but you can change it), it will show another fortune, even (unlike earlier versions) if the fortune window is not the current window. You can pause to read a long fortune with the P icon. You will notice three gadgets, which are used to move through the file without using the keyboard. They are: <- Move to the fortune preceding this one in the file -> Move to the next fortune in the file P Pause >|< Iconify the window (turn it into a small bar) ?? Go to a random fortune You can also use the keys: The '?' key Only works with reqtools.library. Gives copyright information. The 'q' key This will quit the program, just like clicking on the close gadget. The 's' key This will speak the fortune, and then go on to show another one. The 'p' key This will print the fortune, and show another one. The 'l' key After you press this key, all subsequent fortunes will be more than seven lines long. Since there are less of these fortunes, it may take the program a few seconds to find one for you. Pressing 'l' again restores normality. The 'i' key Pressing this key 'iconises' the fortune window to be a small bar, which you can keep somewhere out of the way on your workbench, until you feel the urge for another fortune. You can then press 'i' again to get the full-sized window. The 'n' key This key will open a window which will ask you for the number of a fortune you particularily want to see. After showing this fortune, the program will go back to displaying random ones. Other keys Pressing any other key will tell the program to get another fortune from the file and show it.  Tool Types  Using the "Info" option from the Workbench's menu, you can change a few things about the fortune program. First, click on the icon for the program (not the data file), and select "Info" from the menu. You can then add, or modify, the tool types. When you have finished, select "save". The tool types are: A. FONT You can set the font the fortune is printed in by adding a tool type of the form FONT=fontname/size. For example, I use FONT=Times/15 in my personal set up, to make the fortunes come up in 15-point Times. If a fortune is going to be too big for the screen because you've chosen a big font, the program will go and look for another one. I have yet to find a font with which this doesn't work. B. DEFAULT This tool type controls which file the program reads its data from if you click on the program's icon to start it. It has the form DEFAULT=filename, for example, DEFAULT=sys:jokes/blue. If you don't say what directory the default file is in, the program will look in the current one. C. FLAGS There are three flags, which you can combine in different ways. They are: LONG - show only fortunes which are more than 7 lines long, ICON - start off the program in 'icon' mode, SPEAK - say the first fortune displayed. QUIT - show one fortune, then quit after the number of seconds specified in the DELAY parameter. CLOCK - show the current time in the bottom line of the fortune window, or in the title bar DATE - show the date TOTALMEM - show the total memory available for use ALLMEM - show the available memory,split into chip and fast These flags can be combined using the vertical bar "|". Examples of flags tool types are: FLAGS=SPEAK, FLAGS=LONG|ICON. D. DELAY This can be used to change the delay between fortunes. It has the form DELAY=time, where 'time' is the number of seconds delay you want. E. COLOUR This has the form COLOUR=number, and changes the background colour of the window to the given workbench colour.  Using the Program from the CLI  You can run the program from the CLI just by typing "fortune", provided the data file "fortunes" is in the current directory. A fortune will be printed into the shell window. The program has quite a few options, which I'll now list: ? - show a help page (useful, eh?) -h - show a help page (the same one) -? - show a help page (again) -f - change filename -l - show long fortunes only -w - open a window -n - show fortune number These options are only useful if you open a window too (i.e. use option -w as well) -d