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
Latent
Apprentice


Joined: 19 Aug 2002
Posts: 120
Location: USA

PostPosted: Wed Dec 24, 2003 8:54 pm   

Alternating colors?
 
I know people have made alternating colors scripts in the past, where (Let's call ^R and ^G color codes and ^n is the code for normal text) the color codes are alternately inserted in between text you type in. Alias "test" will be the command. So if I type in test One two three, it inputs "say ^RO^Gn^Re ^Gt^Rw^Go ^Rt^Gh^Rr^Ge^Re^n" into the mud. I searched past posts for a way to accomplish this or something similar, and I read help files, but I couldn't think of a way to make an alias that would insert a character between every letter of a string, can someone point me in the right direction? Maybe list a few functions that I could use? Thanks for the help
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Wed Dec 24, 2003 9:18 pm   
 
This is one of the funnest scripts to use. Nice and colorful:

#alias test {#var string {%-1};#LOOP %len(@string) {#IF (@count=2) {#var count 1} {#var count 2};#var newstring {%concat(@newstring,%case(@count,^R,^G),%copy(@string,%i,1))}};say @newstring}
Reply with quote
Latent
Apprentice


Joined: 19 Aug 2002
Posts: 120
Location: USA

PostPosted: Wed Dec 24, 2003 11:20 pm   
 
Thanks, the only problem is that it doesn't empty out the variable after it's used, so every time you use the alias it just sticks the new text onto the end of the old text, and I can't for the life of me figure out how to delete a variable or reset it without doing that manually, still looking though
Reply with quote
Latent
Apprentice


Joined: 19 Aug 2002
Posts: 120
Location: USA

PostPosted: Wed Dec 24, 2003 11:35 pm   
 
Ahh, got it, #UNVAR, but is there a better way to do it than deleting the variable after every time I use the alias?
Reply with quote
Glinka
Wanderer


Joined: 20 Dec 2000
Posts: 53
Location: USA

PostPosted: Thu Dec 25, 2003 2:18 am   
 

could you do something like this...?

string=" "
or {#var string {%-1}{}

or
#var string {" "}

must be someway to set a variable to an
empty string.

G.
Reply with quote
Danlo
Magician


Joined: 28 Nov 2003
Posts: 313
Location: Australia

PostPosted: Thu Dec 25, 2003 12:13 pm   
 
Try: #var newstring {%null}
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