How can you add multiple instances of a random number together? (1 Viewer)

Uvuriel03

Registered User.
Local time
Today, 15:07
Joined
Mar 19, 2008
Messages
115
I have this line:

[HP] = Int(([HD] * Rnd) + 1)
It creates a random number between 1 and the number in text box [HD] and puts that number in text box [HP].

I created another box, [LvlChar], and would like it to add as many instances of code together as is the number in [LvlChar].

IE, if the number in [LvlChar] 4, it would generate 4 random numbers between 1 and the number in [HD] and add them all together, then put that number in [HP]. If there was a way to display which four numbers were generated and added, that would be even better.

But I don't know how to do this.

Thanks!
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 20:07
Joined
Sep 12, 2006
Messages
15,758
Code:
dim x as long
for x = 1 to [lvlchar]
  'run the generator
  [HP] = Int(([HD] * Rnd) + 1)
  'process the number
next
 

Uvuriel03

Registered User.
Local time
Today, 15:07
Joined
Mar 19, 2008
Messages
115
Gemma,

Thanks for the start. Does this actually add each random number together, though? What kind of boxes will I need to display the appropriate data?

Thanks
 

Users who are viewing this thread

Top Bottom