home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / vrac / homonlib.zip / DICE.BAS < prev    next >
BASIC Source File  |  1995-04-13  |  746b  |  24 lines

  1. DEFINT A-Z
  2.  
  3. DECLARE FUNCTION Dice (rolls, sides, add)
  4.  
  5. FUNCTION Dice (rolls, sides, add)
  6. '****************************************************************************
  7. 'Returns the results of the specified dice roll(s).
  8. '
  9. 'If you are a role-playing gamer, you will notice that the syntax of this
  10. ' function is similar to "standard gaming notation" of dice.  For example,
  11. ' "3d6" can be easily translated to Dice(3,6,0), or "2d4+1" as Dice(2,4,1).
  12. '
  13. '****************************************************************************
  14.  
  15. RANDOMIZE TIMER
  16. total = 0                               'I think you can figure this one out!
  17. FOR x = 1 TO rolls
  18.      total = total + INT(RND * sides) + 1 + add
  19. NEXT x
  20. Dice = total
  21.  
  22. END FUNCTION
  23.  
  24.