Back to the main page

Mailing List Logs for ShadowRN

Message no. 1
From: shadowrn@*********.com (shadowrn@*********.com)
Subject: D6 script
Date: Fri Jan 4 11:35:09 2002
I took the D6 script, and changed it to generate D6's as well, so I
thought I'd drop that in, too..

thanks to Gurth for thoughts, original python code etc on the D8 script..

<-- cut and paste below here
#!/usr/bin/perl -w
# script to generate dice rolls for shadowrun
# inspired by Gurth's Python script
# john@*****.net
# version 1

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(6)) + 1;
$reroll = 1;
while ($roll % 6 == 0 && $roll != 0 && $reroll !=0) {
$reroll = int(rand(6)) + 1;
$roll = $roll + $reroll
}
push (@*****, $roll);
}

# sorting's not perfect, but hey, its free!
foreach (sort @*****) {
print "$_ ";
}
print "\n";
<--- stop cutting here

enjoy/ignore! :-)
--
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-

Further Reading

If you enjoyed reading about D6 script, you may also be interested in:

Disclaimer

These messages were posted a long time ago on a mailing list far, far away. The copyright to their contents probably lies with the original authors of the individual messages, but since they were published in an electronic forum that anyone could subscribe to, and the logs were available to subscribers and most likely non-subscribers as well, it's felt that re-publishing them here is a kind of public service.