description
This is the fortune cookie program. It prints fortunes in the command tools from which it was invoked. At the time of invocation, it prints a number of fortunes given by "Initial". Thereafter, after every command, it will print an additional fortune, with the given probability.
Parameters that are not given in the command are taken from the UserProfile (with names "Cookie.<keyword>"). If not found there, the indicated defaults are used.
The cookies are loaded from the list of files given in UserProfile entry "Cookie.Sources". The files are looked for in the directory which was current when Cookie was run. The cookies may be given relative weights. To do this, precede a filename token with a real number token; all the cookies in subsequent files get that same weight (unless overridden). For example, to weight each cookie by the inverse of the number of cookies in its file, you could say:
Cookie.Sources: 8.0E-4 Almond.Cookies 1.2E-3 Legal.Cookies 2.9E-3 Doit.LOTS 1.6E-2 Snippets
The default token list of Cookie.Sources is
Almond.Cookies Legal.Cookies Doit.LOTS Snippets Dans.Cookies
The files should contain rope literals separated by white space. For each data file, Cookie maintains an index file, whose name is the name of the data file, followed by ".Index".
Cookie is enabled by a Boolean User Profile entry named "Cookie.Enabled" (defaults to FALSE).
examples
Ask for a fortune after, on the average, every other command (and none initially)
% Cookie 0.5 0
% date
Friday, January 27, 1984 3:45 pm
% date
Friday, January 27, 1984 3:45 pm
Stop searching forever. Happiness is unattainable.
%
Ask to be bothered no more, after receiving one fortune:
% Cookie 0 Initial = 1
A truly wise man never plays leapfrog with a Unicorn.