I would really like a method of compiling a string that includes color codes, to be output at one time (rather than changing the color previous to each echo command).
I do a lot of MUD UI tweaking, and i have several situations where I would like to be able to use functions to return partial string coloring rather than having to directly print to the screen. I think that this would most easily be achieved by allowing client-side mxp coloring tags (like I used to do with zmud), but if you have a better idea for implementation please let me know!
Feature Request: Client-side MXP coloring
Re: Feature Request: Client-side MXP coloring
To be a bit more specific, here's an idea of one of the things I'd like to do:
Midkemia uses a breakdown of gold. 100 copper to a silver, 100 silver to a gold. I like to take in a copper number and output a colorized [gold.][silver.]copper string. This is fine if I just want to print it to the screen by itself, but I would really love to be able to actually have the function return a colorized string so the calling function can manipulate and print it seperately, or so that I could use the string as a replace() value. Right now I haven't found any way to do that.
Midkemia uses a breakdown of gold. 100 copper to a silver, 100 silver to a gold. I like to take in a copper number and output a colorized [gold.][silver.]copper string. This is fine if I just want to print it to the screen by itself, but I would really love to be able to actually have the function return a colorized string so the calling function can manipulate and print it seperately, or so that I could use the string as a replace() value. Right now I haven't found any way to do that.
Re: Feature Request: Client-side MXP coloring
The easiest way to do this - as I understand your problem - is to use named generic buffers. This is one of the features that aren't widely known, but which are very practical. The difference between buffers and a miniconsole is that buffers have no screen element, but apart from that they are identical i.e. you can use them to work with strings that carry format information such as color, bold, link etc.. When your processing is done, you simply copy the relevant line to the screen of your choice (miniconsole or main screen).
Re: Feature Request: Client-side MXP coloring
Ahh... createBuffer(). Wonderful, I've been needing it myself as well.
Re: Feature Request: Client-side MXP coloring
Cool, this might work, but I'm having a bit of trouble getting it actually print to screen.
Think you could give me a quick example to create, print to and display a named buffer?
Also, perhaps, to append that buffer into a string if possible?
Think you could give me a quick example to create, print to and display a named buffer?
Also, perhaps, to append that buffer into a string if possible?
Re: Feature Request: Client-side MXP coloring
There's a bug in the current pre-1 test release. It's fixed in pre-2 which will be available later. Here's some example code:
for debug you can use this additional code that gets you the buffer as a popup window:
Code: Select all
createBuffer("buf")
--clearWindow("buf")
resetFormat("buf")
setFgColor("buf", 0,255,0)
echo("buf", "testbuf#1#green")
setFgColor("buf", 255,0,0)
echo("buf", "testbuf#1#red")
setBold("buf", true)
setUnderline("buf", true)
setFgColor("buf", 0,0,255)
echo("buf", "testbuf#1#blue,bold,underline\n")
moveCursor("buf",0,0)
selectCurrentLine("buf")
copy("buf")
appendBuffer()
Code: Select all
moveWindow("buf",0,400)
resizeWindow("buf",600,400)
showWindow("buf")
Re: Feature Request: Client-side MXP coloring
Ah, the bug would explain why I couldn't get any output (confirmed by running your code verbatim with a failure on appendBuffer()).
Any idea when the pre2 comes out?
Any idea when the pre2 comes out?
Re: Feature Request: Client-side MXP coloring
Tomorrow or soon after.