A way to change the color of one word out of a string? [SOLVED]

Started by Stranga, Sat 31/07/2021 04:00:29

Previous topic - Next topic

Stranga

Hello everyone,

I was wondering if there is a way to change the color of 1 or 2 words out of a string rather than just the whole string? I had a look at possibly using the Text Phraser but was wondering if there were a way to do it in code first. Any help would be greatly appreciated :) Also going through the manual now to see if I've missed anything related to this.

For example: (The underlined word is in a different color from the main string)
[imgzoom]https://www.newgrounds.com/dump/draw/d9042468b11d57636f74c504539b967f[/imgzoom]

Cassiebsg

There might be a module (or plugin) for that.

But check Overlay.CreateTextual in the manual, think that's what you want. :)
There are those who believe that life here began out there...

Stranga

Thanks or your help Cassie! Checking out Over.ay.CreateTexual now. Also, forgot to mention I'm using a custom dialogue script (Not sure if that makes a difference or not).

Khris

It depends on the context. If we're talking about drawing strings, you can probably use DrawStringWrapped to draw the white text in full, then use GetTextWidth and GetTextHeight for "There was a " to get the coordinates of where to draw the colored "key" string.

But inside a label text or Display command, AGS doesn't support multiple colors.

Stranga

Ah I see, thanks Khris. I thought it may have supported multiple colors but the DrawStringWrapped seems like an interesting approach.

SMF spam blocked by CleanTalk