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
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sat Jul 26, 2008 3:06 am   

[2.33-2.35] Disregard this... Problem solved.
 
Please see the last comment for an update on this.


This is slightly askew from this topic, which is why I decided to create a new post. The topics are slightly relative to each other, though. Here's the situation:

The following trigger was working fine for me, even in this version.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="9790" trigontrig="false" copy="yes">
    <pattern>~{stats~}(*)</pattern>
    <value>#gagspace
statline=%replace( %replace( %1, "/", "|"), ",", "|")
</value>
  </trigger>
</cmud>


Today, I tried to do this regex:

#REGEX {((?:\(K\)))?((?:\(I\)))?((?:\(M\)))?((?:\(G\)))?((?:\(H\)))?} {#SUB {%ansi(white)"("%subchar(%1,"()")%subchar(%2,"()")%subchar(%3,"()")%subchar(%4,"()")%subchar(%5,"()")}}

Yes, I know (now, at least) that this regex should have never even been born, but after I entered it, it locked up CMUD. I restarted it, and, as far as I know, all of my other triggers work except for that one listed above. Well, it does continue to gag, and I can still get information from statline by using %item(@statline, #), but my buttons will not update, nor my status window, which is based off statline. Can someone else test this to see if they get the same error? Appreciate it!

Charneus

This is what a statline would look like:

{stats}176/83,235/136,151/107,177/90,126/73,226/129,100,100,100,315,430,You are Standing.,9999,4509/4509,3707/3707,3678/3678,487953,4090,22,-859,1190,134,5

You can either clear the statline variable to see if it repopulates (probably the easiest way) or change numbers within the line above to see if it changes in the statline variable.


Last edited by charneus on Thu Jul 31, 2008 10:43 pm; edited 2 times in total
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sat Jul 26, 2008 12:42 pm   
 
It causes a fatal trigger error, spikes the CPU to 100%, and causes an infinite loop.

The pattern you have isn't very good. You have a capture group trying to capture a non-capture group, and everything is optional. Basically you are telling CMUD to do an optional backreference on something you state that should not be backreferenced. Why not just write "(\(K\))?". That pattern you have above fires on anything you enter on the command line with #show and causes a fatal trigger error and loop.

Also %subchar doesn't seem to be working right. It's only replacing the first "(" of "()" for example.

Enter a test trigger and see.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="10" regex="true" copy="yes">
    <pattern>This is (\(a\))? test</pattern>
    <value>#sub {%subchar(%1,"()","=")}</value>
  </trigger>
</cmud>


When you enter to show "This is ~(a~) test" on the command line you get "=a" as the output and not "=a=".

If the trigger pattern is just "(\(a\))?", then it does the same thing as your trigger and spikes the CPU and goes into a loop. As "(\(a\))" it won't, but it still only outputs "=a" and not "=a=".
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sat Jul 26, 2008 1:46 pm   
 
%subchar is working just fine for me. Try this on a command line:

#SAY %subchar("This (is) a test.","()")

When I do it, it shows "This is a test."

As for the pattern, yeah, I already said that it wasn't good at all. I was just mucking around and put that in. *shrug*

As a slight update, I have gone and recreated the trigger to no avail. *sigh* I wonder if I inadvertently corrupted my package file somehow to where it fails to update my buttons/status window...

Charneus
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sat Jul 26, 2008 2:19 pm   
 
Charneus that's not the same thing. Your version replaces it with nothing. My version should replace both ( and ) with =. It doesn't.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sat Jul 26, 2008 2:19 pm   
 
So I had to do a complete restart of the computer (not CMUD, but the computer) for this trigger to start working again...

Charneus
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sat Jul 26, 2008 2:19 pm   
 
Bah...just got a an error when I posted above and it double posted. Oh well.

I'm not sure how you are getting that trigger to even work to be honest. It doesn't work.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Sat Jul 26, 2008 3:00 pm   
 
Let me rephrase that.

I had to restart my computer for my original trigger to work, and yes, it does work.

Oldguy2, the reason why your subchar is not working the way you think it should is because you're only defining one character. The way it is supposed to be is this:

#say %subchar("This (is) a test.","()","==")

Doing that will display:

This =is= a test.

If you're going to sub all characters, you need to put that many replacements as the newlist. Since there are two arguments in the oldlist, you'd need to put two arguments in the newlist. If it were ()|, and you wanted = for all of them, you'd have:

%subchar("yourstringhere","()|","===")

See the difference?

The reason my works without any newlist is because if %subchar does not get an argument corresponding to the position of the character in oldlist, it'll just remove them.

Charneus
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Sat Jul 26, 2008 5:10 pm   
 
Yeah you're right. My memory is going downhill.
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