|
Latent Apprentice
Joined: 19 Aug 2002 Posts: 120 Location: USA
|
Posted: 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
|
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: 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} |
|
|
|
Latent Apprentice
Joined: 19 Aug 2002 Posts: 120 Location: USA
|
Posted: 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
|
|
|
|
Latent Apprentice
Joined: 19 Aug 2002 Posts: 120 Location: USA
|
Posted: 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?
|
|
|
|
Glinka Wanderer
Joined: 20 Dec 2000 Posts: 53 Location: USA
|
Posted: 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. |
|
|
|
Danlo Magician
Joined: 28 Nov 2003 Posts: 313 Location: Australia
|
Posted: Thu Dec 25, 2003 12:13 pm |
Try: #var newstring {%null}
|
|
|
|
|
|