View unanswered posts | View active topics It is currently 21 Jul 2019 01:02

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.



Reply to topic  [ 24 posts ]  Go to page 1, 2, 3  Next
Text Coloring 
Author Message
Adventurer

Joined: 04 Mar 2010 08:07
Posts: 93
Ability to change the color of a word rather than the whole line.


20 Aug 2013 22:40
Profile
Wizard
User avatar

Joined: 03 Mar 2010 21:55
Posts: 106
Location: Middle Earth
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


20 Aug 2013 22:49
Profile
It looks like it is in a prime condition/little worn down/etc.


20 Aug 2013 22:54
Adventurer

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


20 Aug 2013 22:55
Profile
Wizard
User avatar

Joined: 03 Mar 2010 21:55
Posts: 106
Location: Middle Earth
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


20 Aug 2013 23:12
Profile
Adventurer

Joined: 04 Mar 2010 08:07
Posts: 93
Hah, I agree, it looks horrible.

Yeah, thats it exactly.


21 Aug 2013 00:49
Profile
Adventurer

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


21 Aug 2013 00:55
Profile
Wizard
User avatar

Joined: 03 Mar 2010 21:55
Posts: 106
Location: Middle Earth
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


21 Aug 2013 07:03
Profile
Adventurer

Joined: 04 Mar 2010 08:07
Posts: 93
Code:
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,


21 Aug 2013 19:20
Profile
Great Adventurer

Joined: 04 Jun 2010 23:37
Posts: 168
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! :)


21 Aug 2013 22:58
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 24 posts ]  Go to page 1, 2, 3  Next

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.