|
chris-74269 Magician
Joined: 23 Nov 2004 Posts: 364
|
Posted: Mon Dec 08, 2008 5:04 pm
[2.37] Regex causing crash |
I'm trying to use a feature of my mud that does not have any carriage/line feeds on it, so it ends up merging with the lines below it, such as
#K234FFFa~23You just hit a mob hard!
Basically the information I want to extract is in the #K, ect part. My regex I've been using that can match it is:
Code: |
\#K\%(?:@MIPid)\d+FFF(?hpstring:([A-M]\~\d+\~*){1,10})(.*) |
What I've been trying to do is have the ansi escape sequence set the end of the line and use psub to put in a carriage return so the lines can be seperated and gagged, so something like
Code: |
\#K\%(?:@MIPid)\d+FFF(?hpstring:([A-M]\~\d+\~*){1,10})(\033\)?(.*) |
Now whenever I do this pattern, cmud crashes with the error: Access Violation at 0x6950F5EE (tried to write to 0x01BA0f60), program terminated.
Any ideas? |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Mon Dec 08, 2008 7:10 pm |
I think I would need to see a full log of the mud sending this sequence in a fashion that can cause a crash to better understand what is wrong.
The address you mentioned is in the range of the normal location of the pcre.dll. The 7.6 version that was used with CMud2.37 had options set for maximum speed, with a cost of stability in rare cases. It is possible that you have encountered one such case, but I don't see anything in the regexes you have posted that makes me sure of that. Please post a log from the debugger window (with all messages turned on) that shows the server repeatedly sending the problem line; you have the triggers turned of during recording of this log. Then post the XML for the trigger that causes it.
The 7.8 version of the regex engine which is used with the current beta eliminates the stability issue, but suffers a very small overall speed decrease. The net decrease in speed is measured in nanoseconds per regex match. The newest beta should not have a crash with your current problem trigger, but I will double check it. I may be able to suggest a different way to write the regex, once I am certain of the problem, such that it will function correctly in the current public version of CMud. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
chris-74269 Magician
Joined: 23 Nov 2004 Posts: 364
|
Posted: Mon Dec 08, 2008 8:35 pm |
This is freezing me even with the class disabled, soon as i add the (\033\)?
Example output:
Quote: |
0.0000 | #K%28001027FFFC~658~K~Elf~L~100<ESC>[35;1mYou hit Elf.<ESC>[0m<CR><LF> |
The Xml wich doesn't freeze me:
Code: |
<trigger priority="2608310" regex="true" id="260831">
<pattern>\#K\%(?:@MIPid)\d+FFF(?hpstring:([A-M]\~\d+\~*){1,10})(.*)</pattern>
<value>hpstring=%replace(@hpstring,"~",|)
#sub %ansi(high,red)%3
#if (%ismember(A,@hpstring)) {hpcur=%item(@hpstring,(%ismember(A,@hpstring)+1))}
#if (%ismember(B,@hpstring)) {hpmax=%item(@hpstring,(%ismember(B,@hpstring)+1))}
#if (%ismember(C,@hpstring)) {spcur=%item(@hpstring,(%ismember(C,@hpstring)+1))}
#if (%ismember(D,@hpstring)) {spmax=%item(@hpstring,(%ismember(D,@hpstring)+1))}
#if (%ismember(G,@hpstring)) {gp1=%item(@hpstring,(%ismember(G,@hpstring)+1))}
#if (%ismember(L,@hpstring)) {ehealth=%item(@hpstring,(%ismember(L,@hpstring)+1))}</value>
</trigger>
|
Now add (\033\)? between the 10} and (.*) and it will freeze you. The pattern works like this, you have a unique identifier, then following that you have different letters which indicate different aspects of combat, the delimiter is ~. so C~658 is my max spellpoints, K~Elf is whatever folowed K is my enemy, the L~100 is the life of my enemy, the variables only appear when something has changed (if the enemy health is the same the next round i wouldn't see it util it dropped below 100) |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Mon Dec 08, 2008 9:11 pm |
Quote: |
This is freezing me even with the class disabled, soon as i add the (\033\)? |
You have a mismatched parenthesis there. The \ indicates that the next character should be treated literally instead of whatever special main it normally has, or would have for that location. In this case "(\033\)?" result in the sequence 'open capture, character octal 033= char dec 27=, chararacter ) matched 0 or 1 times'. What you actually want is '(?:\033)?' which means 'as a non-captured group matched 0 or 1 times--character octal 033=char dec 27='.
So there is an error in your regex that is leading to this crash. I will look into it further to make sure that the version used by the current beta does not crash when presented with this type of flawed regex. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
chris-74269 Magician
Joined: 23 Nov 2004 Posts: 364
|
Posted: Tue Dec 09, 2008 1:31 am |
Even with that change, cmud still locks up immediately after the pattern is shown/class is enabled.
|
|
|
|
Rahab Wizard
Joined: 22 Mar 2007 Posts: 2320
|
Posted: Tue Dec 09, 2008 9:10 pm |
You've shown the code that works. could you show the exact code that does not?
|
|
|
|
chris-74269 Magician
Joined: 23 Nov 2004 Posts: 364
|
Posted: Wed Dec 10, 2008 12:23 am |
Code: |
<trigger type="ReParse" priority="2608310" ansi="true" regex="true" id="260831">
<pattern>\#K\%(?:@MIPid)\d+FFF(?hpstring:([A-M]\~\d+\~?){1,10})(?:\033)?(.*)</pattern>
<value>#print fired
hpstring=%replace(@hpstring,"~",|)
#sub %ansi(high,red)%3
#if (%ismember(A,@hpstring)) {hpcur=%item(@hpstring,(%ismember(A,@hpstring)+1))}
#if (%ismember(B,@hpstring)) {hpmax=%item(@hpstring,(%ismember(B,@hpstring)+1))}
#if (%ismember(C,@hpstring)) {spcur=%item(@hpstring,(%ismember(C,@hpstring)+1))}
#if (%ismember(D,@hpstring)) {spmax=%item(@hpstring,(%ismember(D,@hpstring)+1))}
#if (%ismember(G,@hpstring)) {gp1=%item(@hpstring,(%ismember(G,@hpstring)+1))}
#if (%ismember(L,@hpstring)) {ehealth=%item(@hpstring,(%ismember(L,@hpstring)+1))}</value>
</trigger>
|
Upon activating the class cmud will lag seriously, and when the pattern that will fire it appears cmud will crash and need to be exited with control+alt+delte
pattern example:
#K28001234FFFa~23You just hit a mob hard! |
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Thu Dec 11, 2008 10:58 pm |
I can't replicate any sort of crash with that trigger and you test text. It consistently comes back with no match as soon as it finds the "%" to not be present.
If I remove the "\%" from the pattern then it fires perfectly on your test text and sets hpstring to the correct value. There must be something else in the class that is causing a problem. |
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
chris-74269 Magician
Joined: 23 Nov 2004 Posts: 364
|
Posted: Fri Dec 12, 2008 3:05 am |
oops, it should be #K%280001234FFFa~23ect..., but i'll try to get this occurring in a blank session
|
|
|
|
|
|
|
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
|
|