Marking in colour one word
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.
Marking in colour one word
Hi
Do any of you knows how to mark in colour based on t pattern one word only and not a whole line?
Do any of you knows how to mark in colour based on t pattern one word only and not a whole line?
Re: Marking in colour one word
You can change the colour of a text phrase by using a <span> element with a color style attribute
* Click on settings
* Click on Triggers Tab
* Click on Add new trigger
* Click the Regexp button for Trigger Type
* Enter Pattern: You find a (.*)[\.|!]
* Click Javascript for the Script Type
* Enter the below code
* Click Save
* Close settings popup
* Go herbing
In the above code, args[0] is the full text of the line that matches the regexp pattern. args[1] is captured text from (.*) that was found between "You find a " and either a "!' or a "."
* Click on settings
* Click on Triggers Tab
* Click on Add new trigger
* Click the Regexp button for Trigger Type
* Enter Pattern: You find a (.*)[\.|!]
* Click Javascript for the Script Type
* Enter the below code
Code: Select all
gwc.output.replace(args[0], 'Found: <span style="color: rgb(0,255,0)">' + args[1] + '</span>', true);
gwc.output.color('#888888');
* Close settings popup
* Go herbing
In the above code, args[0] is the full text of the line that matches the regexp pattern. args[1] is captured text from (.*) that was found between "You find a " and either a "!' or a "."
Re: Marking in colour one word
Many, Many thank Britanica Your example is very useful. But puting my question I was thinking about somethin else. I wanted to mark one word only.
Lets imagine I love to collect diamonds. . After w day of killing I have 100 of gems. But to quick see how many of diamonds I have I would like to mark them in colour. The same apply to quick check if a mob wield or wear looked equipment. Do you know how to do it?
Lets imagine I love to collect diamonds. . After w day of killing I have 100 of gems. But to quick see how many of diamonds I have I would like to mark them in colour. The same apply to quick check if a mob wield or wear looked equipment. Do you know how to do it?
Re: Marking in colour one word
To change the colour of individual words you can use the following
Trigger Pattern: (.*)
This will result in the output looking like
The deadly slight male elf has the look of wisdom in his eyes, a wisdom which is only learned through age. Faint wrinkles line his face. Nonetheless, he still appears agile enough.
He is wearing a decorated purple robe and a plain silver tunic.
He has pointed ears.
He is wielding an exceptional shiny shortsword in his right hand.
He is nodding solemnly.
He is extremely tall and very skinny for an elf.
He looks like the image of perfection.
He seems to be feeling very well.
If this is not what you had in mind, can you provide a sample of the output you are trying to achieve?
Trigger Pattern: (.*)
Code: Select all
var hilites = ['diamond', 'wielding', 'wearing'];
hilites.forEach( function(word) {
gwc.output.replace(word, '<span style="color: rgb(255,255,0)">' + word + '</span>', true);
});
The deadly slight male elf has the look of wisdom in his eyes, a wisdom which is only learned through age. Faint wrinkles line his face. Nonetheless, he still appears agile enough.
He is wearing a decorated purple robe and a plain silver tunic.
He has pointed ears.
He is wielding an exceptional shiny shortsword in his right hand.
He is nodding solemnly.
He is extremely tall and very skinny for an elf.
He looks like the image of perfection.
He seems to be feeling very well.
If this is not what you had in mind, can you provide a sample of the output you are trying to achieve?
Re: Marking in colour one word
I love your explanations, with scripts
I understand how to work the app and triggers now ! (somewhat)
Just one question, that makes me wonder...
Another example had a trigger like :
Trigger: ^There (are|is) (.*) obvious (exits|exit): (.*)[\.]
Would it not be safer, to use the trigger :(diamond|wielding|wearing)
I just forgot to tick javascript after the regex triggger (.*), which gives an eternal loop in the app, as it spams in resonse to what That trigger seems dangerous to me.
I don´t know how it works, but i would image it would slow the entire thing down too, with checking everything.
I understand how to work the app and triggers now ! (somewhat)
Just one question, that makes me wonder...
Another example had a trigger like :
Trigger: ^There (are|is) (.*) obvious (exits|exit): (.*)[\.]
Would it not be safer, to use the trigger :(diamond|wielding|wearing)
I just forgot to tick javascript after the regex triggger (.*), which gives an eternal loop in the app, as it spams in resonse to what That trigger seems dangerous to me.
I don´t know how it works, but i would image it would slow the entire thing down too, with checking everything.
Re: Marking in colour one word
You are correct on both counts. Specifically looking for individual words is safer and fasterAlisa wrote:
Would it not be safer, to use the trigger :(diamond|wielding|wearing)
...
I don´t know how it works, but i would image it would slow the entire thing down too, with checking everything.
I did update my trigger to use a similar version a few hours after posting as the client seamed to be hanging a little. I also had a larger list of words to hilite and each line is checked for each word meaning multiple passes on each line received.
It also means you can get rid of the array of names and changes the body of the trigger to:
Code: Select all
gwc.output.replace(args[1], '<span style="color: rgb(255,255,0)">' + args[1] + '</span>', true);
Last edited by britanica on 30 Oct 2015 10:02, edited 2 times in total.
Re: Marking in colour one word
------------
Re: Marking in colour one word
Cool
Love understanding stuff!
Thanks.
Love understanding stuff!
Thanks.
Re: Marking in colour one word
Britanica
Your tips were super up today. Last Cotillion's modification with "Automatically disable triggers found to be looping" has broke down this trig. The trig looked like:
Unfortunately the last modification/improvement introduced yesterday disable this trig after some time(10-20 min), even if I dont exa anyone. I'm not sure if this any looping system works as planned but we will need to find another solution to mark one word with color.
Your tips were super up today. Last Cotillion's modification with "Automatically disable triggers found to be looping" has broke down this trig. The trig looked like:
Code: Select all
Type: regexp
Pattern: (.*)
code:
var hilites = ['wielding', 'wearing'];
hilites.forEach( function(word) {
gwc.output.replace(word, '<span style="color: rgb(127,255,0)">' + word + '</span>', true);
});
Re: Marking in colour one word
the (.*) trigger hits every line, so i guess it gets detected as a loop.(triggering on every output from mud)
If you do the pattern as
(wielding|wearing)
and the command as
gwc.output.replace(args[1], '<span style="color: rgb(255,255,0)">' + args[1] + '</span>', true);
It should be good
If you do the pattern as
(wielding|wearing)
and the command as
gwc.output.replace(args[1], '<span style="color: rgb(255,255,0)">' + args[1] + '</span>', true);
It should be good
http://tworzymyatmosfere.pl/przescieradla-jedwabne-z-gumka/