From: | shadowrn@*********.com (shadowrn@*********.com) |
---|---|
Subject: | D8 script |
Date: | Fri Jan 4 11:30:04 2002 |
Gurth's D8 python script inspired me to write my own in Perl (available
for windows, linux, palm, psion and Mac!), and here it is; enjoy, or not
:-)
<--- cut and paste from here on
#!/usr/bin/perl -w
# script to generate dice rolls for shadowrun using the d8 paradigm instead of
# the d6 one..
# inspired by Gurth's python prog
# john@*****.net
# version 1.1
# currently rolls 1-8, follow the comments to make it roll 0-7..
#
use strict;
@**** == 1 || die "Usage: $0 number of dice to roll\n";
# Declare the variables
my ($dice, $count, $roll, $reroll);
my (@*****);
#Initialise the variables
$dice = $ARGV[0];
$count = 0;
# generate a dice roll until the number of dice specified has been met,
# and append it to the @***** array
while ($count < $dice) {
$count++;
$roll = int(rand(8)) + 1;
# comment out the above line, and uncomment out the line below to
# roll 0-7..
#
# $roll = int(rand(8));
#
$reroll = 1;
while ($roll % 7 == 0 && $roll != 0 && $reroll !=0) {
$reroll = int(rand(8)) + 1;
# comment out the above line, and uncomment out the line below to
# roll 0-7..
#
# $reroll = int(rand(8));
$roll = $roll + $reroll
}
push (@*****, $roll);
}
# The sorting's not perfect, but hey..
foreach (sort @*****) {
print "$_ ";
}
print "\n";
<--------finish cutting here
--
john@*****.net
"For you're sake, you'd better be psychic, or armed" - goats
SRGC SR1+ SR3++ !SR2 h b++ B--- UB IE+ RN+ !W ma+++ gm M-- P-