home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.whtech.com
/
ftp.whtech.com.tar
/
ftp.whtech.com
/
articles
/
limanews
/
DICEROLL.TXT
< prev
next >
Wrap
Text File
|
2006-10-19
|
3KB
|
64 lines
ORIGINALLY PUBLISHED IN LIMA NEWSLETTER JUNE 1991
Dice Roller Program
By: Andy Frueh, Lima UG
There are a lot of public domain programs out there to aid in the play of
role playing games, usually Dungeons and Dragons. However, there are a lot of
other similar, but not identical, games. The D&D aids are hard to use with
these other games. For this reason, I created the Dice Roller. Originally, it
started as a simple dice roller written by one of my friends on his Adam
computer. It was limited in that numbers could not be printed, the smallest
number was always one, a random number "seed" always had to be entered (any
random number works. There was no RANDOMIZE on the Adam, and if the maximum
was 2, then values OUTSIDE of the 1-2 range could be created. Dice Roller can
take care of all that.
Dice Roller can simulate pratically any type of dice roll, or any kind of
random numbers. As written, it accepts any one to three digit number, from 0
to 999. If you need more digits, or need to exclude certain values, the places
to do that are lines 20 and 30. I won't go into details of the change, since
that is within most users limits. However, if you REALLY want the values
changed and can't do it, I'll be glad to help if you drop me a line describing
what you need. When the program is run, you first set a minimum value. There
is a default of 1. Next comes the maximum, set at 6. If you need to roll "two
dice", then you could set the max to 12. If the max is smaller then the
minimum or vice versa, you must enter both values again. When everything is
done, a number between and including the max and min is generated. You then
get a menu of three options. With these, you can roll again with the same max
and min, change those values, or end the program. Each time you use the same
conditions to roll, a "Roll #" counter increases by one. When the max and min
values are reset, EVEN IF TO THEIR PREVIOUS VALUES, then the Roll counter is
reset. If you need these numbers printed to a printer (PIO default, or you can
enter a disk filename), then add the extra lines at the end.
.NF
.NA
10 RANDOMIZE :: DISPLAY AT(1,8)ERASE ALL:"Dice roller" ::
DISPLAY AT(4,8):"Assum es that there is one maximum and
minimum value and that all numbers fall between these two
values."
20 RO=0 :: DISPLAY AT(13,1):"Minimum value? 1" :: ACCEPT
AT(13,17)SIZE(-3)VALID ATE(DIGIT):MI :: DISPLAY
AT(15,1):"Maximum value? 6" :: ACCEPT AT(15,17):SIZE(-3
)VALIDATE(DIGIT):MX
30 IF MI>MX OR MX<MI THEN 20 :: IF MX=MI THEN 20 ::
X=INT(RND*(MX-MI+1))+M :: IF X<MI OR X>MX THEN 30 :: DISPLAY
AT(19,23):"Roll #"
40 RO=RO+1 :: DISPLAY AT(17,13):X :: DISPLAY AT(20,1):"1)
Repeat roll 2) New conditions 3) End";
50 DISPLAY AT(24,5):"1";:: DISPLAY AT(21,24):RO;:: ACCEPT
AT(24,5)SIZE(-1)VALIDA TE("123"):R$ :: IF R$="1" THEN 30 ::
IF R$="2" THEN 20 ELSE CALL CLEAR :: END
Add these lines if you want printer and screen output.
5 DISPLAY AT(13,1)ERASE ALL:"Printer name? PIO":: ACCEPT
AT(13,16)SIZE(-15):D$: : OPEN #1:D$
25 PRINT #1;TAB(6);"Min: ";MI;" Max:
";MX;CHR$(27);CHR$(41);CHR$(27);CHR$(60 )
35 PRINT #1:"| Roll ";RO;" | ";X;"
|";CHR$(27);CHR$(41);CHR$(27);CHR$(60)
.PL 1