|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sat Sep 06, 2008 4:26 pm
Pattern not matching |
Alright... so I used Regex Coach and I finally able to know how to tell if it was a match or not. That being said, Regex Coach can also see the pattern does not work, but it will not tell me what's wrong. I was wondering if one of you could see? And if oldguy might have some tips on how to tell what the problem is with Regex Coach
Would help to have the stuff wouldn't it?
Code: |
#REGEX gagprompt2 { \[\w+\] \[\w+\] \d:\d+(?:am|pm) \[\w+\] \[[\w-]+\]>} {#GAGLOG}
|
Code: |
[Conclave Common Room] [ESWUD-SE] 5:00am [Night Time] [Common]>
|
(had to use code for spacing) |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sat Sep 06, 2008 5:57 pm |
Just a guess, but could it be the "-" in your ESWUD-SE spot? You don't have anything matching it for "-"...
Charneus |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sat Sep 06, 2008 5:58 pm |
Code: |
#REGEX gagprompt2 { \[[\w ]+\] \[[\w-]+\] \d:\d+(?:am|pm) \[[\w ]+\] \[[\w-]+\]>} {#GAGLOG} |
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums
Last edited by Vijilante on Sun Sep 07, 2008 7:52 pm; edited 1 time in total |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sat Sep 06, 2008 6:40 pm |
charneus wrote: |
Just a guess, but could it be the "-" in your ESWUD-SE spot? You don't have anything matching it for "-"...
Charneus |
I did, it didn't do anything. I'm wondering why it's not in this one though. |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sun Sep 07, 2008 3:31 pm |
Yours was working, Vigilante. Then I tried to put in some back references, and it still worked. Then I tried to color them in addlog and it failed. I took out the back references, still didn't work. I came back here and copied and pasted your original trigger back into it... and it still doesn't work...
Code: |
[Above the Altar] [SD] 11:30pm [Night Time] [Elvish]>
|
Code: |
#REGEX gagprompt2 { [[\w ]+] [[\w-]+] \d:\d+(?:am|pm) [[\w ]+] [[\w-]+]>} {#GAGLOG;#WRITELOG %1 %2 %3} {GENERAL TRIGGERS}
|
I don't know how I broke it, but I did. The only obvious difference is that I put in writelog with the back reference numbers (though no back references at the moment) |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Sun Sep 07, 2008 5:50 pm |
That's because you're not capturing anything. You need to put the () around the items you want to capture. :P
Charneus |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sun Sep 07, 2008 6:33 pm |
No, that's not the problem right now. I know how to back reference, hence why I said there were no back references. It's simply not getting rid of the line like it should, and did before. Now, however, even though I went back and set it to the way Vigilante gave me, before I put in back references, it still won't gag the line from the log.
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Sun Sep 07, 2008 7:54 pm |
Hrm, something changed in the forum. It ate all the escaping for the brackets. I editted my original post to put it in code tags and they reappeared. I would have thought you to be experienced enough by now to spot it.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Sun Sep 07, 2008 8:00 pm |
I noticed it, but when I put it in it worked without the escape brackets for awhile... which was strange to me.
|
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Mon Sep 08, 2008 2:04 am |
It works now and I even managed to color it. Thanks.
I'm trying to figure out how to put in some blank lines with writelog though
#WRITELOG %cr
#WRITELOG " "
and
#WRITELOG
didn't work. And I'm sorry for not contributing more, I just don't really feel competent enough to give advice. I've also been busy during the summer so I really haven't had time to play with the scripts. I do hope to get back to the DamScript, so there may be more questions about that! |
|
|
|
charneus Wizard
Joined: 19 Jun 2005 Posts: 1876 Location: California
|
Posted: Mon Sep 08, 2008 4:42 am |
Try #WRITELOG %null? Just a suggestion. :P
Charneus |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Mon Sep 08, 2008 5:31 pm |
That didn't work either
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Sep 08, 2008 5:45 pm |
Just doing
#WRITELOG
or
#WRITELOG ""
or
#WRITELOG {}
should have worked. You do not need to use %cr. Each #WRITELOG line already ends in a newline. And if you really wanted to add another newline, you'd need to use %crlf since Windows using CRLF for it's newline and not just CR. But I don't see anything in the code that would prevent #WRITELOG from working without any arguments at all. The only check it makes in the code is to be sure that the log file is open and that logging is enabled. |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Mon Sep 08, 2008 9:29 pm |
I didn't try {}, but none of the others worked, promise. Here's what I've had in full context
Code: |
#REGEX gagprompt2 { \[([\w ]+)\] \[([\w-]+)\] (\d:\d+(?:am|pm)) \[[\w ]+\] \[[\w-]+\]>} {#GAGLOG;#WRITELOG %null;#WRITELOG [%ansi(high,white)%1%ansi(reset)] [%ansi(green)%2%ansi(reset)] %ansi(high,white)%3%ansi(reset);#WRITELOG %null}
#REGEX gagprompt2 { \[([\w ]+)\] \[([\w-]+)\] (\d:\d+(?:am|pm)) \[[\w ]+\] \[[\w-]+\]>} {#GAGLOG;#WRITELOG " ";#WRITELOG [%ansi(high,white)%1%ansi(reset)] [%ansi(green)%2%ansi(reset)] %ansi(high,white)%3%ansi(reset);#WRITELOG " "}
#REGEX gagprompt2 { \[([\w ]+)\] \[([\w-]+)\] (\d:\d+(?:am|pm)) \[[\w ]+\] \[[\w-]+\]>} {#GAGLOG;#WRITELOG;#WRITELOG [%ansi(high,white)%1%ansi(reset)] [%ansi(green)%2%ansi(reset)] %ansi(high,white)%3%ansi(reset);#WRITELOG}
#REGEX gagprompt2 { \[([\w ]+)\] \[([\w-]+)\] (\d:\d+(?:am|pm)) \[[\w ]+\] \[[\w-]+\]>} {#GAGLOG;#WRITELOG %cr;#WRITELOG [%ansi(high,white)%1%ansi(reset)] [%ansi(green)%2%ansi(reset)] %ansi(high,white)%3%ansi(reset);#WRITELOG %cr}
|
edit:
Code: |
#REGEX gagprompt2 { \[([\w ]+)\] \[([\w-]+)\] (\d:\d+(?:am|pm)) \[[\w ]+\] \[[\w-]+\]>} {#GAGLOG;#WRITELOG { };#WRITELOG [%ansi(high,white)%1%ansi(reset)] [%ansi(green)%2%ansi(reset)] %ansi(high,white)%3%ansi(reset);#WRITELOG { }}
|
Doesn't work either. Logging is on, because... well, it's logging. And all of the other #writelog stuff is working.
edit: neither did%crlf, in fact it broke the trigger as in it doesn't gag the line anymore. |
|
|
|
Progonoi Magician
Joined: 28 Jan 2007 Posts: 430
|
Posted: Mon Sep 08, 2008 9:54 pm |
In Zugg's examples its
and not
Also,
and not
Knowing your posts from the past, without trying to be disrespectful, maybe you missed those little, miniature details. |
|
_________________ The Proud new owner of CMud.
--------------------------------
Intel Core i5-650 3,2GHz
4 DD3 RAM
GTX 460 768MB
Win 7 Home Premium 64x
-------------------------------- |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Sep 08, 2008 10:58 pm |
There is nothing wrong with the #WRITELOG command. I just did this test in v2.36:
Code: |
#LOG testlog.txt
#WRITELOG "This is line 1"
#WRITELOG ""
#WRITELOG "The previous line was blank"
#LOG |
and then exited CMUD and opened the testlog.txt file in NotePad and there was a blank line between the "line 1" and "previous line was blank" lines, just as expected. So I have no idea why it's not working in your case. |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Tue Sep 09, 2008 2:38 am |
Progonoi wrote: |
In Zugg's examples its
and not
Also,
and not
Knowing your posts from the past, without trying to be disrespectful, maybe you missed those little, miniature details. |
Neither of those worked either. I do normally miss minor details, it's why programming isn't my major. However, in this instance, a space value would typically be better than a NULL I believe, which is what the "" and {} would create. (though it's possible that in this case a " " and { } also produce a NULL since it works the same). Either way, the only difference with Zugg's is that it's not all on the same line. So I guess I'l ltry that, though it shouldn't matter, right?
Edit: Zugg, that didn't work either. In fact the trigger is broken again now (aka the way it worked before wont work anymore). I have no clue what I'm doing wrong!
edit2:
#writelog ""
#writelog SOMETHING IS HERE
#writelog ""
in the command line showed SOMETHING IS HERE, but no line breaks. I swear this is a case of "it's happening to me" but I can't show you |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Sep 09, 2008 6:53 pm |
How are you viewing your log file? Are you just opening it in Notepad? I can't see any way for this to fail. The code for #WRITELOG is literally:
WriteLn( LogFile, ArgStr)
where "ArgStr" is the full %-1 for the command, and LogFile is a Delphi TextFile object that is opened by the #LOG command. WriteLn is a Delphi low-level I/O routine that says "write this text line to the file followed by a newline". So either you are not looking at the log file correctly to see the newlines, or there is something really weird with the file system on your computer.
Have you tried the simple #WRITELOG example from a blank session like I did? I don't know how your session could be messed up to stop this from working though. |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Tue Sep 09, 2008 8:53 pm |
Yeah, I took your example exactly and put it in through the command line of a sessions. The writelog with some text after it showed, but neither the preceding or antecedent writelogs ever went through. I'm just opening it up in the built in editor first to make sure I have the blank line. Then I'll likely move it to html or word, but it needs to actually have the line break first...
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Sep 09, 2008 9:31 pm |
DON'T open it in the built-in editor! Use Notepad or something like that. The built-in editor might be stripping the blank lines.
|
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Tue Sep 09, 2008 11:07 pm |
Oh... well that could be a problem. ...Well, it opened in notepad just fine. Problem is, it's a color log, so opening it in notepad isn't a good thing.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Sep 09, 2008 11:33 pm |
Well, I opened a file with blank lines in the CMUD Editor and the blank lines displayed correctly. So maybe there are some other control codes in the file that are preventing the blank lines from showing. You'd need to send me your log file as an email attachment to sales@zuggsoft.com for me to test it here.
|
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Tue Sep 09, 2008 11:39 pm |
Just the strict log file? Not that buglog thing, correct?
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Sep 10, 2008 1:29 am |
Yep, just the log file that you were loading into the editor that you said didn't have any blank lines.
Edited: Got the file. Loaded into the editor in ANSI mode and you are correct that all blank lines seem to be striped. I have added that the to bug list. The file correctly has the blank lines, but they just don't get displayed by the CMUD editor. |
|
|
|
chamenas Wizard
Joined: 26 Mar 2008 Posts: 1547
|
Posted: Wed Sep 10, 2008 11:38 am |
Thanks, so when fixed I can open in the editor and convert (to html or whatever) and it should be fine?
Also, did you notice that it didn't start working until several lines in? I don't know what that's about...
edit:
Hmm, when I thought about it. Could it be that the scrollback wasn't affected by the #gaglog/#writelog, so it only worked after I began logging? I think you said something along those lines. |
|
|
|
|
|