 |
TesterOfLimitz Novice
Joined: 02 Jun 2007 Posts: 37
|
Posted: Mon Jul 30, 2007 6:11 am
Pulling a Line of a specific color from a trigger |
I was wondering if there was any way of taking a specific color of text out of a trigger pattern....I cant think of a decent way to explain this any better so ill give an example
The mud sends this:
| Quote: |
| The Amazing Knight, Fredbob, Defender of Justice |
Basically, "The Amazing Knight," and "Defender of Justice" are the persons prefix and suffix, which is liable to change at any time, and is normally displayed in grey. "Fredbob" however, is the players actual name, and is displayed a different color, in this case....a greenish blue
Is there anyway to create a trigger that takes the Players name (the greenish blue text) and stores it into a variable?
As always, I appreciate the help
--Tester |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Jul 30, 2007 6:18 am |
Yep. If you look at the trigger's options, you'll see a checkbox that says "Line colour" - check that box and then click on the coloured box next to it. Choose your foreground and your background, et voila.
You could also use an ANSI trigger. Copy your (coloured) text onto the clipboard and then check the ANSI Trigger option. Paste the text in, and CMUD will create the colour codes in the pattern for you. It'll look something like "%e[34msomething". Different numbers are different colours (and other things, here's a full list). |
|
|
|
 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
|
|
|
 |
nexela Wizard

Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Mon Jul 30, 2007 11:42 pm |
This will work if there is alway a prefix and suffix
#FUNC strip {%word(%1,2,",")}
Also Fangs example is good but I don't know if line color option works if there is more then 1 color on a line, ansi trigger would be the way to go for that!
go cmud and its 18 million ways to do something! :p |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Mon Jul 30, 2007 11:53 pm |
nexela is right, I'd totally forgotten about that. Line colour won't work in this case because the whole line isn't the same colour. Use ANSI trigger instead.
|
|
|
|
 |
TesterOfLimitz Novice
Joined: 02 Jun 2007 Posts: 37
|
Posted: Tue Jul 31, 2007 12:10 am |
Ahh...Thanks, I read up on the ANSI triggers and such, and flipped around the Zmud forums (there wasnt much about them here) But I was totally lost when it came to the actual codes for the different colors.....I didnt try pasting in the line AFTER I clicked it to be an ansi trigger, just before. Anyways, works like a charm, Thanks alot mate.
This is what i ended up with:
| Code: |
Pattern: *%e[36m(%w)%e[37m*~((*)~)
Script: #gag;#say %1%repeat(" ",40-%len(%1))~(%2~)
|
It fires on lines like this perfectly:
| Quote: |
The Amazing Knight, FREDBOB (That one room)
FREDBOB (That other room)
FREDBOB, Defender of Cheese (Yet another room)
The Amazing Knight, FREDBOB, Defender of Chee(Sometimes names get cut off to show this random room) |
In all cases, our valiant knight Fredbob is a greenish color, the rest is grey. The trigger picks up on all 4 examples, and converts them into:
| Quote: |
| Fredbob (Hes in this room) |
So, no more dealing with those spammy titles.
-Sidenote-
(Normally I try and avoid the use of * in my triggers, but I couldnt think of a decent way not to in this case.) |
|
|
|
 |
|
|
|