AFDB logo
mn :: comp :: bzflag :: weather

Set the Weather in BZFlag

BZFlag 2.0 introduces nifty weather options. Wouldn't it be nice if they matched the weather outside? Well, they can. This hackish solution was put together on Mandrake Linux 10.1, but it ought to be usable on any Unix. For best effect, edit your startup script to set the proper _latitude and _longitude too, so that the sun and moon act right.

First, some dependencies. You can build these via CPAN, or use my Mandrake RPMs. If you use my RPMs, you'll want to import my GPG key. Use rpm --import http://www.monkeynoodle.org/comp/bzflag/jack_coates.asc.

Next, some scripts. Download and extract these: bzflag-weather-tests.tar.gz Then implement it in cron like so:
12 * * * * /usr/local/bin/test-weather.pl password &>/dev/null
These scripts are very simple to create, as long as you stick to one test at a time. See the Acme::Test::Weather page for tests you can use, and see the BZFlag Server Variables Wiki page for variables you can play with. Note the use of reset in these sample scripts. If you're a better coder than me, check out this article for some tips on using Test modules; it ought to be possible to do a single script for setting any weather condition, if you've got some time on your hands.

I've found that the test modules are really only good for testing positive conditions; in other words, while you'd think that is_raining() would be enough to test both "raining" and "not raining" conditions, in actual fact the test will only be able to detect "raining". If "not raining", it fails entirely. I think this is intended behavior... the Test system is supposed to be used during module compilation, and it makes sense to have it barf if anything unexpected happens.

Last modified: Oct 24, 2008 2:28 pm.
Contact me.

Powered by Zope