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
Angellus Von Thalsen
Newbie


Joined: 03 Dec 2002
Posts: 2

PostPosted: Tue Dec 03, 2002 1:53 am   

How to make Random values?
 
How can i make random values?
for example:
if i want alias chat chat (rnd)
and rnd is &R,&Y,&G and &B
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Dec 03, 2002 2:28 am   
 
Try to rephrase this in something that can be understood. For instance:
"I want to type 'colorchat Hi, I'm using fancy colors when I talk', and have zMUD send 'chat &RHi, &YI'm &Gusing &Bfancy &Ycolors &Mwhen &MI &Ctalk' to the MUD instead."

For best results, use actual words you would type, not made-up things like "blah blah this" and "bleh bleh that". Include all possible color codes. State (or illustrate) whether you want one random color per chat, or a new color every word, or every character. It's not really difficult, you can probably just copy the example I gave.

LightBulb
Senior Member
Reply with quote
Angellus Von Thalsen
Newbie


Joined: 03 Dec 2002
Posts: 2

PostPosted: Tue Dec 03, 2002 12:06 pm   
 
Its something like that
the mud color value is &
&R=Bold Red
&r=red
&G=Bold Green
&g=green
and etc...
I want to type chat 'Hi, how are u today?' and i want the mud to display '&RHi, &rhow &Gare &gu &Ctoday?'

how can i make it?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Tue Dec 03, 2002 3:14 pm   
 
Someone else might be able to do this better, but here's an attempt to get you started. Anything that's heavy on special characters and substitution is going to be difficult.
#VAR {R|Y|G|B|r|g|C|y|b|c}
#AL chat {#SENDP say;#LOOP 1,%numparam() {#SENDP {~&%item(@colors, %rnd(1, %numitems(@colors)))%word(%i, %-1) }};#CR;#NOOP}

LightBulb
Senior Member
Reply with quote
DemonLlama
Beginner


Joined: 03 Nov 2002
Posts: 27
Location: USA

PostPosted: Tue Dec 03, 2002 3:15 pm   
 
This might be a brutish method, so maybe one of the others has a better idea, but I was working on something like this for myself (on a smaller scale):

#var colorcodes {&R|&G|&B|&g|&r|&b}
#alias chat {
#VAR tempchat "%-1"
#VAR tempchat %concat(%item(@ColorCodes,%random(1,%numitems(@ColorCodes))),@TempChat)
#var TempChat %replace( @TempChat, " ", " "%item( @ColorCodes, %random( 1, %numitem(@ColorCodes))))
~chat @Tempchat
}

In explanation, first I tag a random color onto the front. Then, I replace every space (" ") with another space and a color code (eg - " "&G). There might be a more elegant way, but this seems to do what you want.

~DemonLlama~
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