#!/usr/bin/perl # $Id: partimer.pl,v 1.4 2005/02/01 03:33:00 mpb Exp $ # A very simple par-timer for practicing IPSC at home. # If you don't have a text-to-speech command, but have a '/usr/bin/say', # change the variable $cmd to ''. # Copyright (C) 2004-2005 Mads Peter Bach # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. my($cmd) = '/usr/bin/say'; my($beep) = "\007"; sub say { my($msg) = shift; print "$msg\n"; system($cmd ,$msg) if $cmd; } my($partime); if(!$ARGV[0]) { $partime = 8.5; } else { $partime = $ARGV[0]; } my($rotate) = 10; if($ARGV[1]) { $rotate = $ARGV[1]; } my($rand) = 4; if($ARGV[2]) { $rand = $ARGV[2]; } $| = 1; for($i = 1; $i >= 1; $i++) { if($cmd) { say("Par time is $partime seconds. Round $i."); sleep 1; say("Shooter, are you ready?"); sleep 1; say("Stand by!"); } else { print "$beep"; sleep 1; print "$beep"; } sleep(rand($rand)); print "$beep"; sleep $partime; print "$beep"; if($cmd) { sleep 1; say('If you are finished, unload and show clear.'); sleep 1; say('Gun clear, hammer down, holster.'); } sleep $rotate; }