Log In  

Cart #11747 | 2015-07-21 | Code ▽ | Embed ▽ | No License

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.

P#11746 2015-07-21 18:40 ( Edited 2017-10-10 20:34)

Nice, thanks!

P#11748 2015-07-21 19:10 ( Edited 2015-07-21 23:10)
:: matt

Nice! I'm using this in my game.

P#13833 2015-09-08 08:46 ( Edited 2015-09-08 12:46)

Works perfectly, thanks for this!

P#19194 2016-03-12 09:34 ( Edited 2016-03-12 14:34)

Neat! Realized I wanted something like this for a thing I'm working on, getting it integrated was nice and quick.

A couple notes:

  1. 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.

  2. 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.
P#19321 2016-03-20 12:14 ( Edited 2016-03-20 16:14)

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?

P#45070 2017-10-10 16:34 ( Edited 2017-10-10 20:34)

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2020-04-09 08:21 | 0.017s | 2097k | Q:31