Scripts released!

More advanced and polished versions of the scripts described below are now available in a generally-useful distribution called pbemtools.

Riverworld PBEM Scripts

Most of the processing of player moves and GM Turns in the Riverworld PBEM is automatically handled by a set of perl and shell scripts. Since some folks have expressed interest in what's automated and how's it done, here's the rundown.

What you're not seeing

Most of these scripts use a header file called rw-lib.ph, which contains all the character names and email addresses, and a function which determines whether a given character should "hear" a given piece of speech or whatever. Because these email addresses are private, the file here is only a skeleton, not the real header. Sorry.

The basic layout

I keep my scripts and my turns in a directory out of my web tree, while moves are kept in the web tree.

Moves

Players send their moves to the move address, which passes them through the movefilter script. This script makes a customized copy of the move for each player, based on the languages they know, and mails them out. It mails an omnilingual copy to the GM. It relies on players using the format for moves, and putting their character's name in []'s in the subject of the message.

When I receive the omnilingual move, I pipe it to the movepipe script, which calls rwhtml to convert the move to html format and place it in directory for that turn's moves, and insert-move, which adds a link to the move to the master html file from which the home page is built.

The movefilter script adds a special mail header to the messages it sends. I direct procmail (a excellent mail filtering program) to run movepipe when I receive a properly formatted move.

Turns

The first step in writing Turns is collecting the player moves into a single file, in order and sorted by player group. The catmoves script is responsible for this job.

I write my Turns using a similar format to those used for player moves. Tags control which players see which part of the Turn. Then I run maketurn on my Turn sourcefile. I actually run it twice: in test mode (-t or -d), it produces file output, one for each player viewpoint; in standard mode (no switches), it emails the Turns to the players.

I also run distturn, which updates the master.html file to include references to the new turn, and calls updatebase (see below).

The turns you read on the web are actually generated on the fly from the turn source files using the spewturn CGI script. I also use the rwnews script to create a version formatted for Usenet (which I just post with inews.)

Producing the home page

The scripts above modify the master html file, an exhaustive listing of all the files in the directory tree. This used to be the home page, too, until one of the players had the clever idea that the home page should function like an outline which could be collapsed or expanded.

The result was expand.cgi, a cgi script which produces (with no arguments) a completely collapsed outline or (with 1 argument) an outline with one section expanded, and returns it to the browser.

The updatebase script runs expand.cgi with no arguments to produce a totally collapsed outline to use as the home page itself.

If you select one of the "All Turns to Date" choices on the home page (either for the story or the player views of the story), a concatenation of all the available turns is produced by allturns.cgi.


And that's how it's all done...so far.