|
Avotas Newbie
Joined: 29 Oct 2009 Posts: 6
|
Posted: Thu Oct 29, 2009 10:57 pm
Assigning Color Highlights to Key Words |
Hi, I am currently in the process of switching clients, sense your works so well with Windows 7, and wanted to know how I can assign color highlights to key words (in this case player names). Is there a setting or script around anyplace?
-Avotas |
|
|
|
Tarken Aurelius Apprentice
Joined: 23 Oct 2008 Posts: 120 Location: Cincinnati, Ohio
|
Posted: Thu Oct 29, 2009 11:11 pm |
Well if you have have a certain list of names that you want to light you would use something like this:
Code: |
#VAR namelist {array_of_names_here}
#TRIGGER {@namelist} {#cw blue} |
Or maybe you want to lite names on chat channels. In this example:
Quote: |
Tarken <bs>: This is an example. |
To lite "Tarken" red on the 'bs' channel:
Code: |
#TRIGGER {^(%w)~ ~<bs~>} {#SUB {%ansi(red)%1%ansi(reset) <bs>}} |
Quote: |
Tarken <bs>: This is an example. |
Basically, the easiest way is to substitute the string as a colored version of the local variable( %1, %2, etc), in this case a string (word) starting a line before "<bs>". Try reading the following help sections to help you out:
#HI, #TRIGGER, %ansi, #color, pattern matching |
|
_________________ Tarken Aurelius, quality triggers since 2004! Trigger consulting since 2008! Content Developer at BatMUD (www.bat.org) |
|
|
|
Avotas Newbie
Joined: 29 Oct 2009 Posts: 6
|
Posted: Thu Oct 29, 2009 11:30 pm |
Thx I will look into it.
|
|
|
|
Avotas Newbie
Joined: 29 Oct 2009 Posts: 6
|
Posted: Fri Oct 30, 2009 1:51 am |
Humm, never mind that didn't work =D
|
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri Oct 30, 2009 3:33 am |
Telling us "that didn't work" isn't helpful in getting a solution. You didn't mention which of the above didn't work (both do work, if you enter them in correctly).
For the first, you would do something like:
#VAR namelist {Joe|Sally|Mike|Jeff|Melissa|Sarah}
Then you'd do:
#TRIGGER {{@namelist}} {#CW blue}
That's really the easiest way to do it, in my opinion.
If something isn't working, please give us details to what is or isn't. It's the only way we can really help you. :)
Charneus
P.S. The first one Tark listed probably didn't work because he didn't double the {} to indicate it was a list of items, not just one name... |
|
|
|
Tarken Aurelius Apprentice
Joined: 23 Oct 2008 Posts: 120 Location: Cincinnati, Ohio
|
Posted: Fri Oct 30, 2009 3:48 am |
Ah yes...forgot that lists use double brackets...just getting back into this after 6 months off of CMUD :P
|
|
_________________ Tarken Aurelius, quality triggers since 2004! Trigger consulting since 2008! Content Developer at BatMUD (www.bat.org) |
|
|
|
Avotas Newbie
Joined: 29 Oct 2009 Posts: 6
|
Posted: Fri Oct 30, 2009 4:49 am |
Sorry, allow me to explain that last post. Originally I was posting what I did to get it working, with Tarken's help. After I posted I realized it didn't work, and I couldn't find out a way to remove the post so I edited it. I wanted to go back and edit it once more, but got sidetracked and forgot.
Great! One more thing, I color-coated all my friends, but I'm also color coating particle matches. So if I friends name was "York" and "York" was green I would get York says "Hey, Did you know I live in NewYork?"
Do you have any way to get NewYork (one word) to be excluded?
Quote: |
#var bluenamelist {Avotas|Sprink|Istanbul|Jake|Jace}
#trigger {{@bluenamelist}} {#cw blue}
#var Rednamelist {Malach|Duel|Jynx|Crissa}
#trigger {{@rednamelist}} {#cw red}
#var orangenamelist {Armv|Bookkeeper|Anne|Amber}
#trigger {{@orangenamelist}} {#cw orange}
#var greennamelist {Shaytalis|Speaks|Nightryder|Alina}
#trigger {{@greennamelist}} {#cw green}
#var violetnamelist {Fendras|Kontaro|Draco|Nina|Kia}
#trigger {{@violetnamelist}} {#cw violet} |
|
|
|
|
Avotas Newbie
Joined: 29 Oct 2009 Posts: 6
|
Posted: Fri Oct 30, 2009 5:31 am |
Oh, ya rock. Even if I don't get this resolved 100% it's impressed me enough to buy the software =)
-Avotas |
|
|
|
Tarken Aurelius Apprentice
Joined: 23 Oct 2008 Posts: 120 Location: Cincinnati, Ohio
|
Posted: Fri Oct 30, 2009 12:30 pm |
Hmm something like that would be a bit more tricky. You'd have to either throw a space before and/or after "York" to match to, use a line force ^, or maybe have to match some punctuation after it to do something like that. The only surefire way would be to compare that string list to every word that pops up and match it to %w, but that would be EXTREMELY inefficient and probably laggy. Or perhaps, if it is an isolated incident like you said with "NewYork", you could simply have "NewYork" be set to %ansi(reset) and give the trigger a higher priority...just some ideas.
|
|
_________________ Tarken Aurelius, quality triggers since 2004! Trigger consulting since 2008! Content Developer at BatMUD (www.bat.org) |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri Oct 30, 2009 3:24 pm |
Well, to match only that specific word and not just part of another word (York in Yorkshire would be colored, too), just change the trigger to:
#TRIGGER {%q{@bluenamelist}%q} {#CW blue}
That will match it only if it is the word itself and not part of another.
As for things like New York, that is going to be nearly impossible to look for. Clients cannot tell what is a name and what is a place. It just matches the trigger and performs actions accordingly.
Charneus |
|
|
|
Avotas Newbie
Joined: 29 Oct 2009 Posts: 6
|
Posted: Fri Oct 30, 2009 6:17 pm |
Great, I look forward to amending the code and trying that out!
This kind of highlighting has become popular for worlds that don't support Ansi color, as a way to address “Wall of Text” problems in active rooms. I think this may be something some people are looking for. Do you have some kind of Tutorial / Neat Tricks with Cmud thread?
-Avotas |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Fri Oct 30, 2009 7:49 pm |
Not really, to be honest. But you can search through everything here and find things others thought were neat. :) you can also check out the package library (one of the icons across the top of your session, unless you changed them) to find if there are any scripts for your MUD, as well as scripts for other MUDs. Read through the help documentation to learn of commands so you can form new ideas.
Whenever you get stuck, there is generally someone here who can help you. Some of the more well-known ones are Vijilante, Fang Xianfu, and Tech. There are plenty others willing to help debug something as well, such as Tarken and myself. Rahab and shalimar are a couple other names to look for. :)
Welcome to CMUD.
Charneus |
|
|
|
|
|