Hi I was wondering - like the post title says - if you can change the color text mid sentence to highlight keywords.
For example:
if (Parser.Said("navigation"))lDetails.Text=("Command Example:[['navigate b1 to r2'[Moves bot1 to Room1");
The text is set to white, is it possible to change "navigate b1 to r2'[Moves bot1 to Room1" to say green?
Kind regards
C
Not with built-in texts like those appearing on labels or when you call Display(). You would have to program your own font rendering, basically. Split the text accordingly, measure it, draw colored text on a DrawingSurface, display it using a GUI or GUI Button. Not fun :)
You could create a graphic then create an object in the room then set it visible when you want it displayed, but the text would be static so couldn't use any variables to create it.
Great.
Thanks for the reply, food for thought.
You can try and use a GUI with labels, since you can change the colour of the labels.
So you would have:
lbCommand.TextColor = 15; // white
lbMoves.TextColor = 2; // Green
Then you just pass the text to the label on the GUI...
lbCommand.Text = "navigate b1 to r2";
lbMoves= "Moves bot1 to Room1";
This is a simple way to do it. But does require that "navigate b1 to r2" isn't "move b1 to r2"... Though if that's a possibility, you can also adjust the x,y of the label in script if needed... but seems to me that the green will always be on the next line, and thus will always start right bellow the command.
Like:
navigate b1 to b2
Moves bot1 to Room1
I'm just simplifying Khris's idea, though I'm skipping the "DrawingSurface" (mostly cause I'm a chicken and haven't bothered to learn how to use that yet. (laugh) ).
Anyway, just a practical solution on how to do it.
If that solution is enough, you can position the 2nd labels behind the 1st using GetTextWidth().