roll.c

final_realms_fluffos_v1/lib/secure/simul_efun/roll.c · 577 B

From the archive final_realms_fluffos_v1.zip

Download the archive   « Back to the archive contents

/* it would be best to use the roll(int) thingie. 
 * less processor intesive, but the string looks better */
/* Made by Sojan, put in Simul_efun by Baldrick. */

/* this is a dice function - rolls a dice and gives a result ... 
 * can be a simul_efun
 * or put wherever it can be accessed 
 */


int roll(int times, int type)
{
  int i,retval;
  retval=0;
  if(!times||!type) return 0;
  for(i=0;i<times;i++)
  {
    retval+=(random(type)+1);
  }
  return retval;
} /* roll */

/* input to above function is of form roll(10, 20) if you wanted to roll 
   10 20 sided dice */

Site Stats

Snippets: 1791
Codebases: 571