About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri May 28, 2010 5:08 pm   

[3.18a and previous]#PSUB/#PCOL bug annoyances
 
One of the most frustrating things for me so far is that the #PSUB/#PCOL bug hasn't been "fixed" for lack of a better word. I use both extensively, and today, I'm using it to help a friend with a script because those two are my only options to retain as much color as possible. It's a simple script, consisting of:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="7040" regex="true" copy="yes">
    <pattern>^[A-Z() ]+?(.*) (should be a fair fight!)$</pattern>
    <value>#PCOL white %x1
#PCOL cyan %x2
#SAYADD { %ansi(high, white)~(%ansi(high, magenta)%eval(%item(@statline, 31)+3) to %eval(%item(@statline, 31)+8)%ansi(high, white)~)}</value>
  </trigger>
</cmud>


@statline is just a stringlist variable based off statmon tags in Aardwolf, but item 31 is the level. When tested on the line:

(R) A small bug should be a fair fight!

the script debugger spits out:

Code:
(R) A small bug should be a fair fight! (4 to 9)


for coloring while the MUD outputs:

(R) A small bug should be a fair fight! (4 to 9) -- Note I am using blue as a substitute for white.

The result I got for #PSUB wasn't any better... However, instead of returning just the subbed part, it returned this:

(R) A small bug should be a fair fight! (4 to 9) should be a fair fight!

This is with using:

Code:
#PSUB {%ansi( white)%1 %ansi( high, cyan)%2 %ansi( high, white)~(%ansi( high, magenta)%eval( %item( @statline, 31)+3) to %eval( %item( @statline, 31)+8)%ansi( high, white)~)} %x1 %x2


as the script.

Is there any way this can be fixed for the next version? I realize it's probably something low on your to-do list, but it would be greatly appreciated if it could be fixed for 3.19... please?

Charneus
Reply with quote
Zugg
MASTER


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

PostPosted: Fri May 28, 2010 5:15 pm   
 
Sorry, but right now I'm more concerned with testing everything else that the new tables and string lists might have broken.

Tell you what...if you keep doing more testing for me, then maybe I'll try to get the above bug fixed before the public release. Might not be 3.19, but we'll see.
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Jul 01, 2010 9:43 pm   
 
OK, I took a look at this and I'm confused. It seems to be working just fine as far as I can tell from your script.

Your trigger has the pattern: ^[A-Z() ]+?(.*) (should be a fair fight!)$
When triggered with the line:

(R) A small bug should be a fair fight!

then %1 = "R) A small bug" and %2 = "should be a fair fight!"

Now, your script has "#PCOL white %x1" which turns the %1 value white, which is exactly what it does. The initial ( character is NOT part of the matching %1 result. Your trigger pattern has [A-Z() ]+? at the beginning which is matching the minimum (from the ?) possible number of characters. So it just matches the initial ( character.

So I think you need more work on your trigger pattern here, or else you can explain what CMUD is doing that you don't think is correct.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Thu Jul 01, 2010 10:22 pm   
 
Ha, you're right. Something I had missed. My apologies for that. However... regarding #PSUB, at least:
Code:

<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="20" copy="yes">
    <pattern>(~{chan ch=cap~})(*)$</pattern>
    <value>#PSUB {} %x1</value>
  </trigger>
</cmud>


changes

{chan ch=cap}(Imm): Testing

to

(Imm): Testing

Note that I am using blue in place of white.

I may have been wrong with the #PCOL issue mentioned above, but I'll continue to work on that issue to see what I can come up with.

Charneus
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Jul 01, 2010 10:31 pm   
 
OK, that's something easier for me to test and fix. I think you might have been mixing multiple issues. I'll put the #PSUB issue back on the list.
Reply with quote
Anaristos
Sorcerer


Joined: 17 Jul 2007
Posts: 821
Location: California

PostPosted: Thu Jul 01, 2010 10:45 pm   
 
Try the following pattern:
Code:

^(\(\w\))\s*(.*)$

It might help.
_________________
Sic itur ad astra.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Thu Jul 01, 2010 11:07 pm   
 
And going back to the original script, the #PCOL (maybe #SAYADD is the culprit?) issue is best shown in the picture below:
http://charneus.ds4a.com/screens/iac90c63b8161.png (may have to copy/paste in address bar)

The script for the two different lines displayed there is:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="12620" trigontrig="false" regex="true" copy="yes">
    <pattern>^(?:[A-Z()]+)? No Problem! (.*) is weak compared to you\.$</pattern>
    <value><![CDATA[//#SUB {<color yellow>%1</color> <color gray>is 5 to 9 levels lower than you.</color>}
//#RAISE OnAddMob %1
#PCOL white %x1
#PCOL cyan %x2
#SAYADD { %ansi(high, white)~(%ansi(high, magenta)%eval(%item(@statline,31)-5) to %eval(%item(@statline,31)-9)%ansi(high, white)~)}]]></value>
  </trigger>
  <trigger priority="12630" trigontrig="false" regex="true" copy="yes">
    <pattern>^(?:[A-Z()]+)? (.*) looks a little worried about the idea\.$</pattern>
    <value><![CDATA[//#SUB {<color yellow>%1</color> <color gray>is 2 to 4 levels lower than you.</color>}
//#RAISE OnAddMob %1
#PCOL white %x1
#PCOL cyan %x2
#SAYADD { %ansi(high, white)~(%ansi(high, magenta)%eval(%item(@statline,31)-2) to %eval(%item(@statline,31)-4)%ansi(high, white)~)}]]></value>
  </trigger>
  <trigger priority="12640" trigontrig="false" regex="true" copy="yes">
    <pattern>^(?:[A-Z()]+)? (.*) should be a fair fight!$</pattern>
    <value><![CDATA[//#SUB {<color yellow>%1</color> <color cyan>is -1 to +1 levels from you.</color>}
//#ADDITEM mobcons %word(%1,%numwords(%1))
//#RAISE OnAddMob %1
#PCOL white %x1
#PCOL cyan %x2
#SAYADD { %ansi(high, white)~(%ansi(high, magenta)%eval(%item(@statline,31)-1) to %eval(%item(@statline,31)+1)%ansi(high, white)~)}]]></value>
  </trigger>
</cmud>



I modified it because I realized I wanted all preceding tags to be colored properly. The output from the script debugger is:

Code:
0.0081 | a  Aardwolf |(R) No Problem! A bloody squid is weak compared to you.
0.0050 | f  Aardwolf |  Pattern: ^(?:[A-Z()]+)? No Problem! (.*) is weak compared to you\.$ : (%1="A bloody squid")
0.0040 | c  Aardwolf |  exec : Pattern "^(?:[A-Z()]+)? No Problem! (.*) is weak compared...
0.0033 | n  Aardwolf |  Exec Trigger "^(?:[A-Z()]+)? No Problem! (.*) is weak compared to you\.$"
0.0048 | g  Aardwolf =(R) No Problem! A bloody squid is weak compared to you. (14 to 10)
0.0054 | a  Aardwolf |(R) A white jellyfish should be a fair fight!
0.0037 | f  Aardwolf |  Pattern: ^(?:[A-Z()]+)? (.*) should be a fair fight!$ : (%1="A white jellyfish")
0.0040 | c  Aardwolf |  exec : Pattern "^(?:[A-Z()]+)? (.*) should be a fair fight!$" : ...
0.0039 | n  Aardwolf |  Exec Trigger "^(?:[A-Z()]+)? (.*) should be a fair fight!$"
0.0045 | g  Aardwolf =(R) A white jellyfish should be a fair fight! (18 to 20)
0.0049 | a  Aardwolf |(R) No Problem! A bloody squid is weak compared to you.
0.0036 | f  Aardwolf |  Pattern: ^(?:[A-Z()]+)? No Problem! (.*) is weak compared to you\.$ : (%1="A bloody squid")
0.0039 | c  Aardwolf |  exec : Pattern "^(?:[A-Z()]+)? No Problem! (.*) is weak compared...
0.0031 | n  Aardwolf |  Exec Trigger "^(?:[A-Z()]+)? No Problem! (.*) is weak compared to you\.$"
0.0045 | g  Aardwolf =(R) No Problem! A bloody squid is weak compared to you. (14 to 10)
0.0143 | a  Aardwolf |(R) No Problem! A white jellyfish is weak compared to you.
0.0037 | f  Aardwolf |  Pattern: ^(?:[A-Z()]+)? No Problem! (.*) is weak compared to you\.$ : (%1="A white jellyfish")
0.0039 | c  Aardwolf |  exec : Pattern "^(?:[A-Z()]+)? No Problem! (.*) is weak compared...
0.0042 | n  Aardwolf |  Exec Trigger "^(?:[A-Z()]+)? No Problem! (.*) is weak compared to you\.$"
0.0083 | g  Aardwolf =(R) No Problem! A white jellyfish is weak compared to you. (14 to 10)
0.0064 | a  Aardwolf |(R) A blue jellyfish looks a little worried about the idea.
0.0060 | f  Aardwolf |  Pattern: ^(?:[A-Z()]+)? (.*) looks a little worried about the idea\.$ : (%1="A blue jellyfish")
0.0053 | c  Aardwolf |  exec : Pattern "^(?:[A-Z()]+)? (.*) looks a little worried about...
0.0035 | n  Aardwolf |  Exec Trigger "^(?:[A-Z()]+)? (.*) looks a little worried about the idea\.$"
0.0062 | g  Aardwolf =(R) A blue jellyfish looks a little worried about the idea. (17 to 15)


So, I'm not quite sure what is happening there, whether it's the #SAYADD or the #PCOL. I hope this helps things out a bit. You can use:

Code:
#SAY {%ansi(red)(R) %ansi(white)No Problem! A bloody squid is weak compared to you.}
#SAY {%ansi(red)(R) %ansi(white)A white jellyfish should be a fair fight!}
#SAY {%ansi(red)(R) %ansi(white)No Problem! A bloody squid is weak compared to you.}
#SAY {%ansi(red)(R) %ansi(white)No Problem! A white jellyfish is weak compared to you.}
#SAY {%ansi(red)(R) %ansi(white)A blue jellyfish looks a little worried about the idea.}


to mimic the MUD output. It's not exact, but it demonstrates the problem still.

Thanks for looking into this!

Charneus
Reply with quote
Zugg
MASTER


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

PostPosted: Thu Jul 01, 2010 11:25 pm   
 
OK, looks like this is already fixed in 3.22 then. I used your XML and your test lines and it all seemed to work fine. I got the following output:

(R) A white jellyfish should be a fair fight! (-1 to 1)
(R) No Problem! A bloody squid is weak compared to you. (-5 to -9)
(R) No Problem! A white jellyfish is weak compared to you. (-5 to -9)
(R) A blue jellyfish looks a little worried about the idea. (-2 to -4)

(the black text shows up as white)

Edited: Hmm, the problem is that when I do this test in v3.21 I also get the correct results. So I guess I still cannot reproduce your problem with the above script.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Thu Jul 01, 2010 11:35 pm   
 
Using the XML in my script above, the entire output shouldn't have been white. However, I also noticed a flaw (once again) in my script that might need to be looked at regardless.

In the script, I had

Code:
#PCOL cyan %x2


but had nothing to define %2. So instead, it colored the entire line cyan with white for the %1, apparently. The output was:



Note: The last line isn't part of the problem - I accidentally captured that as well.

I /really/ should stop attempting bug searches when I'm overly tired. Not trying to send people out on wild goose chases, though it certainly seems that way. :\ Maybe someone else will be able to duplicate this issue.

Charneus


Last edited by charneus on Fri Jul 02, 2010 12:14 am; edited 1 time in total
Reply with quote
Zugg
MASTER


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

PostPosted: Fri Jul 02, 2010 12:07 am   
 
I'm going to let some other people try to look into this and help. I cannot get anything like the example screenshot that you showed when testing in a blank session in v3.21. I don't get any cyan color at all.
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Jul 02, 2010 8:37 pm   
 
Oddly enough, the #PCOL issue seems to have been 'fixed' for me in 3.22. Also, though I didn't see it documented in version history, it seems the #PSUB issue has been fixed as well. At least, I think so. I'll continue to work around with it, too.

Thanks for the work you do!

Charneus
Reply with quote
Zugg
MASTER


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

PostPosted: Fri Jul 02, 2010 10:02 pm   
 
Quote:
Fixed problem with #PSUB deleting color of next character on line

That was your PSUB bug. Glad the PCOL bug also disappeared! That's your reward for beta testing. Don't ever say I didn't get you anything Razz
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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