Target_Print formatting


(MrLego) #1

This is not really a mod question, more of a coding question.

Does anyone know of a fool proof way to format text using a target_print entity?

I have been wrestling with this for a bit now and I cannot seem to get any consistancy out of it.

If I use color codes on a message they work correctly on the first line but once the line wraps the color goes back to the default white.

I tried to control the text with a
as a line feed and then reinserting the color format back in, but this is where the unpredictable results come in.

"^3 Silly fool, don't you know that 
^3steam is hot?"

Results in the following:

Silly fool, don’t you know that
steam
is hot?

It seems like the game reads the length of the message string first and determines where to wrap the text on a new line and then when it processes the string it inserts the embeded newline character, wraps the line there and then wraps it again where it originally wanted to.

I suppose I could leave it all white but on a outdoor winter map it is hard to see.

Any ideas?


(Loffy) #2

How about
“^3Silly fool, don’t you know*^3that 3steam is hot!?”
*=break

Or:
“^3Silly fool!*^3Don’t you know that steam is hot!?”

Or have two (2) target_prints.
The first one: “^3Silly fool!”
The second one: “^3Don’t you know that steam is hot!?”

Script a wait of 1000 before the second one. The second will push the first aside but they will both be visible (beside each other, on screen) for a few seconds (I think).


(Chruker) #3

What if you just insert the 2nd color code before the word that starts the 2nd line?


(MrLego) #4

Loffy - I dont think that * works as a line feed in a target_print - it’s a pre-ET function but I’l give it a try.

Chruker - The inconsistant part is where the game automatically wants to wrap the text - the more embedded color formats there are, the longer the initial string becomes and then the linewrap moves to a different word. Even if I use a
, the game still wraps lines at some predetermined point and then processes the
and starts another new line - it takes a little guesswork to figure out where to put
in the string.

I have a work-around of sorts - I just prefaced every word with ^3 and removed the
completely - at least all of the text is now yellow.

Thanks for the replies.


(Lanz) #5

Just so you know, it wants to put a newline (
) after 36 chars (including codes) but only breaks where it first finds a space so it should be easy to just make a new color code there. I guess adding color codes after each word is a bit easier but should also produce shorter lines.