home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.tar / ftp.whtech.com / articles / archives / limanews.exe / DICEROLL.TXT < prev    next >
Text File  |  2006-10-19  |  3KB  |  64 lines

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