I'm tryin to append a line to my screen output, with specific colour for a portion of it. Unfortunately, my simple brain can't seem to get it to work.
A silly example to show the sort of thing I'm trying to do:
If I inventory my backpack, I might get a few lines like:
32 copper coins
83 silver coins
So, say I want to add a line to the output after the silver coins lines such as:
32 copper coins
83 silver coins
need gold coins -- get some
Adding the extra line is easy enough. The problem I'm having is I would like to colour one or more words in that extra line, but not the entire line. So, output 'gold coins' in yellow, leaving the rest in the default colour. I don't want to use gwc.output.replace because I'm not replacing anything. I'm using gwc.output.append, but I can't seem to get colour inserted in there without the actual code I'm trying printing out as well.
I realize this is probably a simple thing, but I hope someone can help me out anyway.
Appending a line with some of the text coloured.
Moderator: Eowul
Forum rules
- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.
- Use common sense and be respectful towards each other at all times, even when disagreeing.
- Do not reveal sensitive game information. Guild secrets, player seconds are examples of things not allowed.
-
- Beginner
- Posts: 15
- Joined: 06 May 2019 03:42
Re: Appending a line with some of the text coloured.
Hey,
you actually want to replace something.
To have words coloured, you surround them with a span tag.
Like:
Yes, you could go, and just insert something before and after to achieve this, but the easiest way to achieve the same is, to replace them with
So, replacing is the easiest way to go, even though you just replace them with themselves and a bit before and after.
you actually want to replace something.
To have words coloured, you surround them with a span tag.
Like:
Code: Select all
<span style="color: YOUR COLOUR">HERE GOES WHATEVER IS TO BE COLOURED</span>
Code: Select all
<span style="color: YOUR COLOUR">THE WORD(S) YOU REPLACE IN ORDER TO BE COLOURED</span>
http://tworzymyatmosfere.pl/przescieradla-jedwabne-z-gumka/