|
-
Oct 28th, 2002, 01:29 PM
#1
Thread Starter
Lively Member
Parsing Ascii Colour Codes (they look like this --> [1;31m)
Does anyone know of a way to parse incoming text for ascii colour codes ([1;31m for example which is red) so that all text that follows the code is a certain colour? I.E, the MUD server at the other end which sends me the text with the codes in it sends:
|[1;36m "[1;37mDream the dream and let it come true...[1;36m" [1;37m|
which should, when parsed, show the following:
| "Dream the dream and let it come true..." |
Any ideas? The source is downloadable from http://members.lycos.co.uk/vinarianl.../esmud_src.zip and the compiled version from http://members.lycos.co.uk/vinarianlegends/esmud.zip. If you can help, it'd be appreciated.
Oh, and while I remember, there's an annoying problem with that code where it adds a CrLf at the end of every line, but I don't want it to, because then you get loads of blank lines. If oyu run the prog, you'll see what I mena, but anyway, is there a way to search the incoming text line by line and remove the crlf fromthe end of each line? The server sends its text in UNIX format if that's any help... I got around that by using RTF boxes instead of normal text boxes, but it doubles the CrLf's rather than completely ignoring them. I'm confusing myself to... 
Ben.
P.S. The source is based heavily on a tutorial from www.vbip.com, so no moaning about "Oh, you didn't write all of this", because I know I didn't, OK? I didn't know much about WinSocks until last night. *pokes*
-
Oct 28th, 2002, 03:03 PM
#2
Fanatic Member
You should do a function that passes over the recieved text and detect the colors in their special signs ([1;37m).
I hope it helps,
Arie.
-
Oct 29th, 2002, 06:59 PM
#3
Thread Starter
Lively Member
I've tried that, but I can't get it to read from the escappe sequence (the square and [) to the 'm'. It either reads too much or too little...
-
Oct 30th, 2002, 02:29 PM
#4
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|