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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Xolademoness
Wanderer


Joined: 18 Jun 2004
Posts: 73
Location: United Kingdom

PostPosted: Wed Sep 05, 2007 6:41 am   

how can I make a trigger #PLAY a random sound out of a list?
 

_________________
mhm..
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Wed Sep 05, 2007 12:41 pm   
 
Use #case or %case. You code could look something like this:

#case %random {#play one.wav} {#play two.wav}

or

#play %case(%random,one.wav,two.wav)
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Wed Sep 05, 2007 4:53 pm   
 
Couldn't it also be done by putting all the sounds in a variable, then using %item? For example:

Code:
#VAR soundlist {one.wav|two.wav|three.wav|four.wav|five.wav}
#TRIGGER {Your trigger here.} {#play %item(@soundlist, %random(1,%numitems(@soundlist)))}


I suggest this way so you don't have to continue to edit the trigger each time you get a new sound. All you have to do is:

Code:
#ADDITEM soundlist {six.wav}


and the trigger would now include the sixth sound file for consideration. Just a thought. Correct me if I'm wrong.

Charneus
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Wed Sep 05, 2007 9:18 pm   
 
That's a better way to run an item from an varying list, you're right. I should've mentioned that :)
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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