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 Goto page 1, 2  Next
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue Jun 24, 2008 3:59 am   

Gagging from Log?
 
Is there a way to set certain text to be gagged only from logs?

things with lines with ooc: in them, my prompt, etc... I know I can formulate the regex and pattern matches if there's such a feature and I was told how to use it. (Though a multi-line pattern quick reference would be nice)
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Troublemag
Wanderer


Joined: 14 Jul 2004
Posts: 83

PostPosted: Tue Jun 24, 2008 6:37 pm   
 
http://forums.zuggsoft.com/modules/mx_kb/kb.php?mode=doc&k=2809

If you have things #GAGged and you have the option to Log after triggers are executed checked, they should not appear in your log file.

Help files are your friend. Grok them.
_________________
CMUDPro 3.22
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Tue Jun 24, 2008 8:19 pm   
 
But I don't want it gagged in the game, I just want them gagged from the logfile. My prompt, for instance, as wonderful as it is, is not something I need in my logs.

Edit:
nevermind
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Zhiroc
Adept


Joined: 04 Feb 2005
Posts: 246

PostPosted: Wed Jun 25, 2008 6:07 am   
 
Actually, I've long wanted the other way around: gagging from the screen, but not from the log. And no, it's important that I log *after* triggers, because I want the log to reflect stuff I modify.

One use: diverting output to chat windows, but still getting in the log. And no, I don't want different logs for each chat window.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Jun 25, 2008 9:33 am   
 
There's a part of me that wants to say you can't have your cake an eat it - either you want to trigger after you've modified text on the screen, or you don't - but equally, I can think of some great uses for a command that lets you write out text to the log file. It'd be a nice feature to have.
_________________
Rorso's syntax colouriser.

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


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Jun 25, 2008 1:19 pm   
 
Well, I hate falling back on the simpleMU thing, but it did have an option to gag from log, so it's certainly doable. And uses there are plenty. I may not want drink spam in my log, but I may not mind seeing it (some people have some cool decanters) in the game. The prompt is another biggy, I need my prompt to play, I don't need people to see my prompt in the log. I often need to see the ooc chatter, or just like talking in it, but it doesn't need to be in my log either, etc...
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23377
Location: Colorado, USA

PostPosted: Wed Jun 25, 2008 4:46 pm   
 
It's actually an interesting suggestion. I'll add a #GAGLOG command to the wish-list for a future version. It might actually be pretty easy to implement given the way that CMUD handles the log file. But I'm not going to get into complex substitute commands or anything like that. Just a command to prevent a particular line from being written to the log file is all that I'll probably do.
Reply with quote
Dharkael
Enchanter


Joined: 05 Mar 2003
Posts: 593
Location: Canada

PostPosted: Wed Jun 25, 2008 5:21 pm   
 
How about adding a #WRITELOG while your adding #GAGLOG?
_________________
-Dharkael-
"No matter how subtle the wizard, a knife between the shoulder blades will seriously cramp his style."
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23377
Location: Colorado, USA

PostPosted: Wed Jun 25, 2008 5:34 pm   
 
Good idea :)

Edited: Love easy stuff like this. Both #gaglog and #writelog are in v2.29. Took about 5 minutes.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Jun 25, 2008 9:57 pm   
 
hahaha, awesome. But it would be neat to look into more complex log stuff in the future. However, this is awesome enough. Now I just need to figure out how to match my two-line prompt to be gagged. Very Happy
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Wed Jun 25, 2008 10:01 pm   
 
put $^ between the lines
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23377
Location: Colorado, USA

PostPosted: Wed Jun 25, 2008 10:01 pm   
 
Also, it's probably obvious, but in order to use the new #GAGLOG command, you need to make sure you have the preference enabled to Log *after* Triggers (since your #GAGLOG runs in the trigger).

And with #WRITELOG you should be able to do any complex stuff that you want now, especially given the power of the %subregex function for modifying text.
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Jun 25, 2008 10:02 pm   
 
Toxic wrote:
put $^ between the lines


Ah, hmmm, I thought I would need a carriage return character, like \r or something.

So... when is 2.29 coming out??
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Wed Jun 25, 2008 10:03 pm   
 
um, its out. and I guess it depends on if your writing it in zscript or regex
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Jun 25, 2008 10:11 pm   
 
regex
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Jun 25, 2008 11:00 pm   
 
Personally, I'd prefer to use a multistate trigger than a two-line pattern. It looks like:

#trig {line 1} {#gaglog} "" {regex}
#cond {line 2} {#gaglog} {regex|within|param=1}

Also, anyone know whether #gaglog leaves a blank line in the log file or not? I haven't had time to test that yet.
_________________
Rorso's syntax colouriser.

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


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Wed Jun 25, 2008 11:48 pm   
 
No, it doesn't. It would be nice if it did, but it wouldn't be nice in all instances. For instance, in my two line prompt I would only want 1 blank line. Maybe if it took an argument so you could tell it whether or not you wanted a blank line left behind.

Also, Fiang, I'm not confident enough with multi-state triggers. I'm sure there's ample reading on them?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu Jun 26, 2008 12:50 am   
 
Yes, there is.

The #gaglog command doesn't leave blank lines, so you can gag whatever you want. If you want a blank line, you can use #writelog to print a space or something. Using Toxic's idea with a multiline pattern won't work anyway because only the most recent line is removed from the log, same as with #gag. You can't just use #gaglog;#gaglog to mimic the same behaviour as #gag, either.
_________________
Rorso's syntax colouriser.

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


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Thu Jun 26, 2008 2:03 am   
 
I'm not sure how write log works. Can I put an argument after it and have it write to the log?
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu Jun 26, 2008 9:41 am   
 
Yes, that's the whole point. You do #writelog Hello! and Hello! appears in the log file.
_________________
Rorso's syntax colouriser.

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


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Thu Jun 26, 2008 1:03 pm   
 
Yeah, that's what I thought at first, then I thought it was using Zhiroc's idea. Which is, you take a pattern that is gagged, and have #writelog and it writes it to the log, even though it's gagged.
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Thu Jun 26, 2008 2:04 pm   
 
You can do that with #WRITELOG %trigger
Reply with quote
chamenas
Wizard


Joined: 26 Mar 2008
Posts: 1547

PostPosted: Thu Jun 26, 2008 3:07 pm   
 
Hmm, writelog didn't add the %cr I asked it to

Code:

<trigger name="Gag Prompt1" priority="3060" regex="true" id="306">
  <pattern>^\<\d+/\d+hp \d+/\d+m \d+/\d+mv \d+(tnl|cp) \d+(pq|qp) \d+/\d+w \d+g/\d+s $</pattern>
  <value>#GAGLOG;#WRITELOG %cr</value>
</trigger>


Also, the condition was never attacked, they were both sent at the same time...
Code:

#REGEX "Gag Prompt1" {^\<\d+/\d+hp \d+/\d+m \d+/\d+mv \d+(tnl|cp) \d+(pq|qp) \d+/\d+w \d+g/\d+s $} {#GAGLOG;#WRITELOG %cr} {General Triggers}
#COND "Gag Prompt2" {^ \[^\]]+\] \[[^\]]+\] \d+:\d+(am|pm) \[[^\]]+\] \[[^\]]+\]\>$} {#GAGLOG} {General Trigger}


This is my prompt:

<618/618hp 1714/1714m 406/406mv 15818tnl 665pq 118/425w 406g/82s
[Wall Road] [NSW] 4:00pm [Day Time] [Common]>


This is some of the log...

Quote:

Crown Street
This part of crown street is filled with tourists and some amateur
pickpockets. A few cityguards and soldiers march to and fro. The street is
busy with activity, aside from that, nothing very interesting.
[Exits: east west ]
[Crown Street] [EW] 2:00pm [Day Time] [Common]>
Crown Street
Crown street is busy with people. To the west stands the castle fortress
and the Althainian Royal Palace. This part of the street has a lot of
patrons going about their business not paying much attention to anything
else.
[Exits: east west ]
[Crown Street] [EW] 2:00pm [Day Time] [Common]>
Wall Road
Just south of you is an intersection with a crowded street. The eastern
wall of Althainia is beside you, and to the north you can see the northeast
corner of the city wall. To the west is the famed crown street.
[Exits: north south west ]
[Wall Road] [NSW] 2:00pm [Day Time] [Common]>
Wall Road
Here, wall road meets up with a busy street heading off towards the west,
and the far wall of the city. You can smell spices, perfume, freshly cured
hide, and other strange scents, all mingle together in one heady aroma.
Wall road continues to the north and south.
[Exits: north south west ]
[Wall Road] [NSW] 2:00pm [Day Time] [Common]>
You say softly 'Test.'
[Wall Road] [NSW] 2:00pm [Day Time] [Common]>
_________________
Listen to my Guitar - If you like it, listen to more
Reply with quote
Toxic
Adept


Joined: 27 May 2008
Posts: 299

PostPosted: Thu Jun 26, 2008 3:13 pm   
 
Code:


#REGEX "Gag Prompt1" {^\<\d+/\d+hp \d+/\d+m \d+/\d+mv \d+(tnl|cp) \d+(pq|qp) \d+/\d+w \d+g/\d+s $} {#GAGLOG;#WRITELOG %cr} {General Triggers}
#COND "Gag Prompt2" {^ \[^\]]+\] \[[^\]]+\] \d+:\d+(am|pm) \[[^\]]+\] \[[^\]]+\]\>$} {#GAGLOG} {General Trigger}


Your class identifier for you #COND is mispelled, it should be General Triggers, since that is what the #REGEX class Identifier is. Also you shouldn't have to provide a class identifier at all for your #COND.

Should look like this

Code:


#REGEX "Gag Prompt1" {^\<\d+/\d+hp \d+/\d+m \d+/\d+mv \d+(tnl|cp) \d+(pq|qp) \d+/\d+w \d+g/\d+s $} {#GAGLOG;#WRITELOG %cr} {General Triggers}
#COND "Gag Prompt2" {^ \[^\]]+\] \[[^\]]+\] \d+:\d+(am|pm) \[[^\]]+\] \[[^\]]+\]\>$} {#GAGLOG} {regex|within|param=1}
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Thu Jun 26, 2008 3:27 pm   
 
Giving a separate ID for a trigger state is pointless, as well. You might find that #writelog " " or something works better, too - I'm not sure how or if #writelog handles %cr. It's something to try, anyway.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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