Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Tarquin
Newbie


Joined: 15 Jan 2004
Posts: 3

PostPosted: Thu Jan 15, 2004 7:27 am   

Help with adding to variables
 
Probably seems strange but what i want to do is create a set number of random numbers, which i can do like this
#loo XXX {#E %random(1,49)}
where x is the set number of times.
The #e is just there so that i can see the numbers as they come up, doesn't really have to be there, I can always just show the Variables when it is done.
Now i want to, each time a new number is generated add one to a variable. where the variables are n1,n2,n3.....n49. So if i run it 50 times I will have say n1=7 n2=12......and so on.
I am sure this can be easily done, but am very new to any kind of programing and I just can't come up with a solution.
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Thu Jan 15, 2004 2:43 pm   
 
#LOOP XXX {#VAR n%i {%random(1,49)}}
Reply with quote
Tarquin
Newbie


Joined: 15 Jan 2004
Posts: 3

PostPosted: Thu Jan 15, 2004 6:38 pm   
 
Well that helps a little bit, but i only want the variables to be n1-n49 where each variable is = to the number. n1 if for 1 n2 is for 2...n49 is for 49. then for each time a one of the numbers comes up 1-49 i want to add one to that variable. What i want is to get random numbers and then have a list of how many times each of those numbers came up.

The way that worked. the variables were set to whatever time thru the loop it was and then that had a random number between 1-49.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Thu Jan 15, 2004 7:28 pm   
 
#LOOP 100 {#ADD n%random( 1, 49) 1}
Reply with quote
Tarquin
Newbie


Joined: 15 Jan 2004
Posts: 3

PostPosted: Fri Jan 16, 2004 5:54 am   
 
That's the Ticket. Thanks alot.Very Happy
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net