Splitting color state across multiple lines

Posted by Samson on Tue 06 Feb 2007 04:41 AM — 4 posts, 16,587 views.

USA #0
http://www.mudbytes.net/index.php?a=pastebin&s=view&pid=221

I have that function as part of AFKMud 2.0. It has a slight bug, which probably wasn't readily noticed. But when the room descriptions are split up based on how large the mini-map segment is. But when this splitting is done, the color codes don't carry over to the next line the way they should.

So I was hoping someone better with strings than I am could help with this. Valid color tags in AFKMud are &, {, and }. Ideally the last color tag change in a line should carry over as the first color tag on the next line's text.

Sample output of a room description with the mini-map:
+-----------+ A thunderous roar echoes through the sky..... and suddenly 
|           | you are transported into this tiny room! An odd blue mist 
|           | begins to slowly fill the room, clouding your vision and giving 
|           | you a very strange sensation...... After a few minutes, the 
|           | mist clears away and suddenly you notice your body has been 
|     @     | altered! You are no longer in a physical form! From somewhere 
|           | high overhead a deep booming voice shouts: "Welcome stranger! 
|           | Examine the paintings before you and choose your new race 
|           | by saying its name out loud. For example, if you wish to become 
|           | a High Elf, you would type: say high-elf to do so. Refer to 
+-----------+ the website for further information on races and classes 
located at http://www.alsherok.net&c. You may also get a brief overview of 
which classes are allowed by examining the scrolls here."


This description begins life as cyan, tag &c, but that only goes out to the end of the first line at which point everything reverts back to default.
USA #1
Hmm. To be clear on what the problem is:

Is the problem that when you go to a newline and start drawing the map, when you're done drawing the map, you need to switch back to whatever color was last set in the description?
USA #2
Yes. When the room description has color tags in it, they don't carry over into the next line of the description text.
USA #3
Davion found a solution and posted it on mudbytes, but I'd still be interested to see if there's another alternative.