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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
asm
Wanderer


Joined: 19 Jul 2004
Posts: 68

PostPosted: Tue Apr 05, 2005 1:28 am   

Simple tell and channel capturing
 
Although there are various capture scripts already out there, I thought I'd make one for my own use and for a bit of pratice using regular expressions. These are two simple scripts designed to capture tells and to capture chat channel messages.

This first script copies tells verbatim, colors it yellow, and adds it to the tell window. It does not gag the line from the main window, but this would be easy enough to add.
Code:

#CLASS {tell capture}
#REGEX {((.+ tells you: .+)|(.+ asks you: .+)|(.+ exclaims to you: .+))} {#WIN tells %ansi( bold, yellow)%1}
#CLASS 0


Matches: Single- or multi-word names, single- or multi-word messages.
Does not match: Zero length names and messages.

Sample input:
Doctor Breen tells you: Welcome. Welcome to City 17.
G-Man asks you: Time, Dr. Freeman? Is it really that time again?
Doctor Breen exclaims to you: Tell me, Dr. Freeman, if you can. You have destroyed so much. What is it, exactly, that you have created? Can you name even one thing? I thought not!

This copies chat channels verbatim to the talker window, coloring them green. Again, this does not gag it from the main window.
Code:

#CLASS {channel capture}
#REGEX {((\(.+\) .+ wisps: .+)|(\(.+\) .+ wisps that .+))} {#WIN talker %ansi( bold, green)%1}
#CLASS 0


Matches: Single- or multi-word channel names inside parentheses, single- or multi-word names with a message of variable length.
Does not match: Zero length channel names, usernames, and messages.

Sample input:
(Two) Breen wisps: Under other circumstances I like to think we might have been able to work together in an atmosphere of mutual trust and respect.
(Two) G-Man wisps that he straightens his tie.


Notes:

- If you do not wish for the messages to appear in the main window, simply add "#GAG" to the expressions.

- Suggestions for optimizations and constructive criticism is always appreciated.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts 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