If you want to be able to change text color halfway through without splitting into multiple commands, here's just that at a price of 150 tokens / 265 compressed chars.
So doing
printc("hello ^8world^7!", 4, 4)
will output
Could have been a bit smaller if there were functions to convert string to/from charcode.
Neat! Realized I wanted something like this for a thing I'm working on, getting it integrated was nice and quick.
A couple notes:
-
There seems to be a variable name error in the current version -- you use "T" throughout for the source text parameter, except at one point where you use "TEXT" in a string-measuring "#TEXT" bit.
- Expanding the stringc() library with a modified length() call that disregards color control characters could be handy for basic applications that depending on e.g. sizing something on screen to the width of only teh displayed characters of a string. The standard #x call for a string x will report a wider string than printc(x) produces.
I'm trying to figure out how to update this for double-wide characters but I haven't really figured it out yet. Anybody got any ideas?
[Please log in to post a comment]