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
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Mon Mar 11, 2002 8:33 am   

Random lines
 
Ok I have three variable stringlists

phrasea
phraseb
phrasec

Each stringlist has about 20 or so lines
kinda like the random phrase thing in this forum somwhere....



%concat( %item( @phraseA, %random( 1, %numitems( @phraseA))), " ", %item( @phraseB, %random( 1, %numitems( @phraseB))), " ", %item( @phraseC, %random( 1, %numitems( @phraseC))))


Is there any way to make it say every possible combination without duplicating any
Reply with quote
Haloway13
Beginner


Joined: 10 Mar 2002
Posts: 12
Location: USA

PostPosted: Mon Mar 11, 2002 9:34 am   
 
This is what I would do:

Generate a list of all phrases into a list.
Generate a randowm number from 1 to n.
Retrieve nth item from the list.
Display it.
Delete nth Item from list.

Tim

Tim
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Mon Mar 11, 2002 3:17 pm   
 
To spam them all you can use:



#LOOP 1,%numitems(@phraseA) {
#VAR V_SpamA_i %i
#LOOP 1,%numitems(@phraseB) {
#VAR V_SpamB_i %i
#LOOP 1,%numitems(@phraseC) {
say %item(@phraseA,@V_SpamA_i) %item(@phraseB,@V_SpamB_i) %item(@phraseC,%i)
}
}
}


If you want to have them come out one at a time that takes more thinking and coffee.

TonDiening
Beta Upgrading to 6.26
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