Text Coloring

Report bugs and suggest new features for the web client here.

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.
Gub
Adventurer
Posts: 93
Joined: 04 Mar 2010 08:07

Text Coloring

Post by Gub » 20 Aug 2013 22:40

Ability to change the color of a word rather than the whole line.

User avatar
Eowul
Wizard
Posts: 106
Joined: 03 Mar 2010 21:55
Location: Middle Earth

Re: Wishlist

Post by Eowul » 20 Aug 2013 22:49

Gub wrote:Ability to change the color of a word rather than the whole line.
Can you give me a "use case" so I can figure out how to best add this?
Caretaker of Arda

Laurel

Re: Text Coloring

Post by Laurel » 20 Aug 2013 22:54

It looks like it is in a prime condition/little worn down/etc.

Gub
Adventurer
Posts: 93
Joined: 04 Mar 2010 08:07

Re: Text Coloring

Post by Gub » 20 Aug 2013 22:55

Sure. If I want to highlight the word "peculiar" or "unusual" rather than highlighting the entire line. I'd like it to look something like this:

You get an unusual black robe
rather than:
You get an unusual black robe.

User avatar
Eowul
Wizard
Posts: 106
Joined: 03 Mar 2010 21:55
Location: Middle Earth

Re: Text Coloring

Post by Eowul » 20 Aug 2013 23:12

Gub wrote:Sure. If I want to highlight the word "peculiar" or "unusual" rather than highlighting the entire line. I'd like it to look something like this:

You get an unusual black robe
rather than:
You get an unusual black robe.
Awefull choice in colors .. Anyway, you would then be thinking of something like gwc.output.colorText("unusual", foreground, background) ?
Caretaker of Arda

Gub
Adventurer
Posts: 93
Joined: 04 Mar 2010 08:07

Re: Text Coloring

Post by Gub » 21 Aug 2013 00:49

Hah, I agree, it looks horrible.

Yeah, thats it exactly.

Gub
Adventurer
Posts: 93
Joined: 04 Mar 2010 08:07

Re: Text Coloring

Post by Gub » 21 Aug 2013 00:55

Can you expose some more of the internal API so we can write our own libraries that could be included into the system? Rather than requesting the method call you just suggested, I feel like users should be able to write them and then have them included (after review) into a standard library. Or can we already do this? Thoughts?

User avatar
Eowul
Wizard
Posts: 106
Joined: 03 Mar 2010 21:55
Location: Middle Earth

Re: Text Coloring

Post by Eowul » 21 Aug 2013 07:03

Gub wrote:Can you expose some more of the internal API so we can write our own libraries that could be included into the system? Rather than requesting the method call you just suggested, I feel like users should be able to write them and then have them included (after review) into a standard library. Or can we already do this? Thoughts?
Internal API's should remain exactly that, internal API's, otherwise any change we might do might break users triggers and aliases. That's why I added the script API, as something that remains consistent throughout releases. Ofcourse you are welcome to suggest functionality to add to it, if it's usefull for more people then I am more then happy to include it. Besides, with javascript you should already be able to do a lot of thing.
Caretaker of Arda

Gub
Adventurer
Posts: 93
Joined: 04 Mar 2010 08:07

Re: Text Coloring

Post by Gub » 21 Aug 2013 19:20

Code: Select all

var src_str=$("#mudoutput .line").last().html();
var term = "unusual";
term = term.replace(/(\s+)/,"(<[^>]+>)*$1(<[^>]+>)*");
var pattern = new RegExp("("+term+")", "i");
src_str = src_str.replace(pattern, "<mark>$1</mark>");
src_str = src_str.replace(/(<mark>[^<>]*)((<[^>]+>)+)([^<>]*<\/mark>)/,"$1</mark>$2<mark>$4");
$("#mudoutput .line").last().html(src_str);
Ok ignore what I said last time, this is what I meant: The code above shows a way to implement what I was speaking about. I think there are better ways of implementing this, but it gets the job done. The critical part here is the '$("#mudoutput .line").last()' which allows you to grab the last output line from the game. I don't see that in the documentation, and to me, this is fairly critical. If people want to use it, they can. If you would like to include it in your script_api, you can. Right now there is no easy way to find things like "#mudoutput .line" and to then share the trigger I've created. That is all I meant. Do what you will with all this, its your baby, and its a very nice one! Again, kudos on your creation,

Rincon
Great Adventurer
Posts: 196
Joined: 04 Jun 2010 23:37

Re: Text Coloring

Post by Rincon » 21 Aug 2013 22:58

Wow. After playing genesis all these years I still don't have the finest clue what do all these dots and other funny symbols mean! :)

Post Reply
http://tworzymyatmosfere.pl/przescieradla-jedwabne-z-gumka/