|
shaun.murray Magician
Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Sun May 25, 2008 2:15 pm
color triggering? |
Is it possible? Can it be done? =] Reason being, the colored trigger, I'd like to put into a variable... Just food for thought. Here is the line....
( immoral ) Sutire is here, fighting a religious servant.
Basically, anything in red, put into a variable. Thanks in advance!! |
|
|
|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Sun May 25, 2008 2:53 pm |
Is the only way to tell it apart, based on the colour?
If not, it might be easier to just trigger on something like..
{~( immoral ~) (%w) is here}
however, assuming that you really do need to trigger off the colour, then the answer is yes, it is possible. You need to do a couple of things though.
1. You need to capture the raw output of the mud, to see what the ansi colour codes look like.
2. When you use them to make your trigger, you need to check the 'ansi' checkbox in the trig options.
You can get the raw output in a few different ways. One is by going into preferences and unchecking.. I think it is 'emulate control codes'. There are better ways though (that one is a bit ugly). Another is to log with ansi colour, and then open the file in a text editor.
The easiest is probably to use the debug window with the right options checked.
So, go find the raw output for that line and post it here, and someone should be able to help you. |
|
_________________ Athlon 64 3200+
Win XP Pro x64 |
|
|
|
shaun.murray Magician
Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Sun May 25, 2008 3:06 pm |
Okie dokie. I'll get the raw output, thats the way I need to go with this. Reason being, that trigger won't work (well, it will, just not quite what I want to do with it).
The reason being, is player names are red, where the blue is just the line text, and the grey (black?) is the morality shift. And players can put stuff before and after their names. For example:
( immoral ) The biggest man named: Sutire the great! is here, fighting a religious servant.
Where the command he entered in would be name The biggest man named: % the great! to change his name. Where, people in clans, might try an get tricksy and put something like this name <clannie name> <clannie name> % <clannie name> <clannie name> <clannie name> so... You would see something like this when entering a room with them standing in it:
( immoral ) Bob Phil John Jill Mark Misty is standing here.
As you can see... Using a normal trigger, and trying to enter the ACTUAL person who is in the room is just a matter of triggering off of the colored name. Not to mention, that this could make hunting for someone, or among many other things, very useful. =D |
|
|
|
shaun.murray Magician
Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Sun May 25, 2008 3:19 pm |
Here is what I got....
readable text:
Code: |
<ESC>[1;37m(<ESC>[0m<ESC>[0m<ESC>[37m immoral <ESC>[1;37m)<ESC>[0m <ESC>[1;37m<ESC>[0m<ESC>[1;36m<ESC>[37m<ESC>[0m<ESC>[1;36m<ESC>[37m<ESC>[0m<ESC>[1;31mSutire<ESC>[37m<ESC>[0m<ESC>[1;36m is here, fighting a priestly spirit.<ESC>[0m<LF><CR> |
raw text
Code: |
[1;37m([0m[0m[37m immoral [1;37m)[0m [1;37m[0m[1;36m[37m[0m[1;36m[37m[0m[1;31mSutire[37m[0m[1;36m is here, fighting a priestly spirit. |
Not sure what that means tho.... |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sun May 25, 2008 4:27 pm |
#TRIGGER {~( %w ~) * %e[1;31m(%w)} {#VAR namecap %1} should work for you.
Read up on ansi colors, though. By the way, since I can't remember what it is off the top of my head, you will need to go to the package editor and select the "ANSI trigger" option under the trigger.
Charneus |
|
|
|
shaun.murray Magician
Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Sun May 25, 2008 4:46 pm |
Code: |
<trigger priority="5560" ansi="true" id="556">
<pattern>~( moral ~) %e[1;31m(%w) is here,</pattern>
<value>#say %1 is here....</value>
</trigger> |
( moral ) Serenity is here, passed out.
Still not shooting off. I'll look into teh ANSI trigger a little more, and the ansi colors... So close, and I really like the possibilities of this.... =D Thanks! |
|
|
|
Arminas Wizard
Joined: 11 Jul 2002 Posts: 1265 Location: USA
|
Posted: Sun May 25, 2008 5:04 pm |
Try this one...
Code: |
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
<trigger priority="5560" ansi="true" regex="true" copy="yes">
<pattern>\( moral \) \e\[1;31m(\a+) is here,</pattern>
<value>#say %1 is here....</value>
</trigger>
</cmud> |
|
|
_________________ Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram |
|
|
|
shaun.murray Magician
Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Sun May 25, 2008 5:19 pm |
what is... and how'd you get copy="yes"?
still not working... i've looked at %ansi and #trigger but nothing really goes into much detail about color triggering... maybe regex will give me more (really should look into regex someday, right? gives you more flexibility or something?) tia again everyone! |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sun May 25, 2008 6:02 pm |
shaun.murray wrote: |
Code: |
<trigger priority="5560" ansi="true" id="556">
<pattern>~( moral ~) %e[1;31m(%w) is here,</pattern>
<value>#say %1 is here....</value>
</trigger> |
( moral ) Serenity is here, passed out.
Still not shooting off. I'll look into teh ANSI trigger a little more, and the ansi colors... So close, and I really like the possibilities of this.... =D Thanks! |
It's not matching because you have too many spaces between ~) and %e. Knock off a space and try again. However, know that it won't match anything before the word or anything after the word, so it won't match something like:
( moral ) Bob Jill Luke Mary Misty is here.
That's why I had my trigger set up like I did.
Charneus |
|
|
|
shaun.murray Magician
Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Sun May 25, 2008 6:23 pm |
Ok... Updated the trigger... However, doesn't seem to be firing. Looks ok to me... *tear*
From mud:
( immoral ) Stacey Dash hungry Zol is here, passed out.
( impartial ) Leeroy Jenkins is standing here.
( moral ) Nemesis is standing here.
Code: |
<trigger priority="5560" ansi="true" id="556">
<pattern>^~( %w ~) (*) %e[1;31m(%w)</pattern>
<value>#say %3 is here....</value>
</trigger> |
|
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sun May 25, 2008 7:12 pm |
Weird. It's not working for me, either - no matter what I do. Not sure what the problem is... By the way, regarding your "updated" trigger, you're calling for %3, which is invalid. You only have 2 definitions, and really, you only need 1 as you're not capturing anything before the red word.
Charneus |
|
|
|
shaun.murray Magician
Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Sun May 25, 2008 7:54 pm |
well... the first %w would be %1, the * would be %2 and the second %w would be %3. am i mistaken?
as far as the trigger not working... could it be the %e[1;31m? what exactly is going on with that? i can't seem to find any documentation, and i think thats the problem, as everything else is fine... *shrug* |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sun May 25, 2008 8:06 pm |
You are mistaken. The parentheses surrounding the first %w are escaped, so it's not capturing anything. All it does is match if a word is there. The (*) would be %1, but you don't need it since you're trying to capture just the red word, which is the (%w). Anything within parentheses (without being escaped) will be transferred to %1-%99. So, for instance:
%w (%w) (%w) %w %w %w (%w) (%w) is the pattern.
The line that triggers it is:
The lazy fox jumps over the sleeping dog.
The pattern puts the following parameters:
%1 = lazy
%2 = fox
%3 = sleeping
%4 = dog
That's a quick tutorial on that. :P By the way, change the trigger to be {^~( %w ~)*%e[1;31m(%w)} - that should match everything, although nothing seems to match right now.
The %e[1;31m comes from your output - you can see it right before the Sutire, which is what you're trying to capture. :P You could try using %e[37m, but I doubt that'll match the color.
Charneus |
|
|
|
shaun.murray Magician
Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Sun May 25, 2008 10:06 pm |
Huh.... Ok, I've always wondered that... Damn I feel newbish now! LoL! But... Here is something interesting...
Code: |
<trigger priority="5560" ansi="true" id="556">
<pattern>* %e[1;31m($thisisthename:%w)</pattern>
<value>#window shownleave ~[ $thisisthename ~]</value>
<arglist>$thisisthename</arglist>
</trigger> |
That works...
Code: |
<trigger priority="5560" ansi="true" id="556">
<pattern>^~( (%w) ~) * %e[1;31m($thisisthename:%w)</pattern>
<value>#window shownleave ~[ $thisisthename ~]</value>
<arglist>,$thisisthename</arglist>
</trigger> |
That doesn't work. So... Something wrong with ( (%w) ) My guess... Is that if you do a line trigger with color triggering, the ENTIRE line needs to have the coloring down? Looking into that now... Thanks again!!! |
|
|
|
shaun.murray Magician
Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Sun May 25, 2008 10:17 pm |
GOT IT!!!!! Just as I thought... It wasn't working with the normal ( (%w) ) because it didn't have the right color to trigger on. However... On a side note, what made this very easy to work with, that once the trigger was set to an ANSI trigger, when you copy the line you want to trigger off of, and paste it into the trigger part, it automatically puts in the coloring and everything. Then it was easy to just remove the parts that I didn't need, and put in the wildcards as I needed. =D FYI... hehe.... But thanks again! Here's what the final product looks like. I'm going to be using a LOT more color triggering, as it a very solid way not to get 'trigger f*cked' and to make some solid triggers that doesn't pick up nearly as much spam... hehe
Code: |
<trigger priority="5560" ansi="true" id="556">
<pattern>^%e[1;37m~(%e[0;37m (%w) %e[1m~)* %e[1;31m($thisisthename:%w)</pattern>
<value>#window shownleave MORALITY: ~[ %1 ~] NAME: ~[ $thisisthename ~]</value>
<arglist>,$thisisthename</arglist>
</trigger> |
From the MUD:
( immoral ) Stacey Dash hungry Zol is here, passed out.
( impartial ) Leeroy Jenkins is standing here.
( moral ) Runar is here, passed out.
In the window labled shownleave:
MORALITY: [ immoral ] NAME: [ Zol ]
MORALITY: [ impartial ] NAME: [ Leeroy ]
MORALITY: [ moral ] NAME: [ Runar ] |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun May 25, 2008 11:21 pm |
For future reference, you guys made a bit of a mountain out of the molehill of getting the ANSI codes into the trigger pattern. All you need to do is copy the text, create a new trigger in the editor, check ANSI trigger, and then paste the text into the pattern box (the order is important). CMUD will fill in the ANSI codes for you.
This is important because CMUD's ANSI triggers don't actually fire on the real ANSI codes the MUD is sending (the ones shown in the debugger and #debugfile). CMUD reforms the ANSI codes based on what was actually displayed, only changing the colour code when the colour really changes. This is to stop MUDs sending stuff like:
Quote: |
<ESC>[31mH<ESC>[0m<ESC>[31me<ESC>[0m<ESC>[31ml<ESC>[0m<ESC>[31ml<ESC>[0m<ESC>[31mo<ESC>[0m |
and confusing your triggers. The ANSI trigger would need to be
|
|
|
|
shaun.murray Magician
Joined: 23 Jul 2005 Posts: 334 Location: Chicago
|
Posted: Sun May 25, 2008 11:25 pm |
LoL, you like that mountain say'n fang... *wink* but yea, i noticed that if you pasted it into the trigger, after checking that box, it did all the hard work for you. i just had a hard time with figuring that you could trigger normally off of the line, and one part bein color'd, but the whole line needs to have the coloring down. *shrug* learning experience, lol!
|
|
|
|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Mon May 26, 2008 1:02 am |
Well that, is handy to know. Thank you, Fang.
|
|
_________________ Athlon 64 3200+
Win XP Pro x64 |
|
|
|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Mon May 26, 2008 4:54 pm |
It would be handy if everyone could read it here: edit Don't you think so?
|
|
|
|
Caled Sorcerer
Joined: 21 Oct 2000 Posts: 821 Location: Australia
|
Posted: Mon May 26, 2008 5:00 pm |
Knowing how it works, I can see that it is in fact there in the help file.
I have read that before though, and did not gather from the explanation, that the client actually adds/interprets them automatically. |
|
_________________ Athlon 64 3200+
Win XP Pro x64 |
|
|
|
Arde Enchanter
Joined: 09 Sep 2007 Posts: 605
|
Posted: Mon May 26, 2008 5:16 pm |
Knowing how it works, it is a small chance that you going read help at all. I have search the help for "ansi" keyword and within search results I find only 1 place where it has been talked about pasting a MUD text tinto the command line - Getting Started\Basic Usage Basic Are there any other places (just wondering)?
|
|
_________________ My personal bug|wish list:
-Wrong Priority when copy-paste setting
-1 prompt trigger for Mapper, Session and General Options, not 3 different!
-#SECTION can terminate threads
-Buttons can't start threads |
|
|
|
|
|