string manipulation (changing say text)

Posted by Thebloodsiren on Thu 06 Feb 2003 11:13 AM — 5 posts, 18,204 views.

#0
I want to (1) be able to change the case of some characters of text, ie manipulate strings. And (2) be able to apply color codes to the first or random letters in text.

Eg if i type:
say My name is Insano

I have made an alias to send the text i want manipulated to a sub. just dont know what the vbasic way to manipulate strings.

(1) I want to be able to change the text to say
"mY namE is InSaNo", where there is a random percentage chance (50% maybe) of alternating the case of one character.

(2) "$4M$2y $4n$2ame $4i$2s $4I$2nsano"
where $4 is put before all the first text and represents the color code. then $2 is the color of the rest of the message.


I got no ideas,
Thanks
Australia Forum Administrator #1
To pull out parts of a string use mid. To get a random number use rnd.

Do you want to colour stuff on your window only? See the ColourNote plugin.
#2
Excuse my ignorance but how does this mid and rnd functions work using vbasic. My experience in programming goes to 6 months studying C. A quick example will be ever so helpful.
Thanks :)

And no, I wanted to send the actual changing colour codes to the mud, so I have a "individual" style of says.
#3
Oh, and what command will invert the case of a character. ie make an "a" to an "A".

USA #4
Get a character from the middle - mid(string, start, length)
Get a character from the left side - left(string, length)
Get a character from the right side - right(string, length)
Change to uppercase - ucase(string)
Change to lowercase - lcase(string)

You may also find it useful to download the help files at http://download.microsoft.com/download/winscript56/Install/5.6/W982KMeXP/EN-US/scrdoc56en.exe. ;)