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
Fuego Ledrey
Wanderer


Joined: 09 May 2007
Posts: 64
Location: Dustin Acres, California

PostPosted: Thu May 17, 2007 6:27 pm   

Random Illusions
 
Ok, what I need is some code that will randomly select one of two statements (Maybe more) and send it to the MUD.

<Examples>

conjure @tar illusion You bleed 9999 health.
conjure @tar illusion You are dead and can not do that.

I need one of those two lines sent to the MUD in an alias. Thanks for your help!
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu May 17, 2007 6:41 pm   
 
Easiest way is with a string list.

#additem IllusionList "whatever I want my illusion to be"

then to get them back out, you use %item(@IllusionList,%random(%numitems(@IllusionList))). So your code above would become

conjure @tar illusion %item(@IllusionList,%random(%numitems(@IllusionList)))
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Fuego Ledrey
Wanderer


Joined: 09 May 2007
Posts: 64
Location: Dustin Acres, California

PostPosted: Thu May 17, 2007 6:44 pm   
 
Much appreciated!

Is there maybe a cleaner way? Less code, no variable?
_________________
EDIT: Image moved to Avatar FINALLY.
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Thu May 17, 2007 8:36 pm   
 
This is the cleanest way to do it, unless you prefer to have many strings hard-coded into the aliases for conjuring the random illusions. I'd do it this way, though.
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