Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
TesterOfLimitz
Novice


Joined: 02 Jun 2007
Posts: 37

PostPosted: 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
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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).
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: Mon Jul 30, 2007 11:23 pm   
 
I have a function for something similar to this in the finished script forums, it might need some tweaking to work with it, let me see if I can find the link

http://forums.zuggsoft.com/forums/viewtopic.php?t=24184&start=0&postdays=0&postorder=asc&highlight=

Give me a minute and I will tweak it to work for you. However the examples from the link will show you how to use it.
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
nexela
Wizard


Joined: 15 Jan 2002
Posts: 1644
Location: USA

PostPosted: 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
_________________
Zmud Support Library
Zmud Knowledge Base
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: 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.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
TesterOfLimitz
Novice


Joined: 02 Jun 2007
Posts: 37

PostPosted: 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.)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net