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
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: Sat Aug 16, 2008 4:32 pm   

[2.36] Oddity with PSUB and CW (Bug?)
 
Consider the following code
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="2320" copy="yes">
    <pattern>(*)</pattern>
    <value>#PSUB {%1} %x1
</value>
  </trigger>
  <trigger priority="2302" copy="yes">
    <pattern>dolly</pattern>
    <value>#cw pink
</value>
  </trigger>
</cmud>


When I type the following command
Code:
#show dolly daisy darling do
#show daisy dolly darling do


I get some unexpected results.

The first time you run it I get the highlighted background but all of the first line is pink.
If I disable the PSUB trigger, the dolly is highlighted as expected.
If I re-enable the PSUB trigger, and disable the CW trigger the backgrounds are highlight as expected.
If I re-enable the CW trigger and set it's priority to be more than the PSUB trigger, the lines are highlighted and colored as expected, but the 'dolly' background is black instead of the gray tone I've specified.

Now it could be that I've just written a god awful PSUB trigger. I've never been adept at, and I've never been required to use it often... BUT methinks somethings amiss here.

This behavior may or may not be related to this post.
_________________
Asati di tempari!
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sun Aug 17, 2008 9:34 pm   
 
The fact that with both triggers enabled the #CW trigger is affecting the entire line by itself I would call a bug.

Edit: Removed an incorrect assumption.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram

Last edited by Arminas on Mon Aug 18, 2008 2:07 am; edited 1 time in total
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sun Aug 17, 2008 9:58 pm   
 
Edit: Could a moderator please move this post to its own thread? It is not really relevant to Tech's Bug.
I played with this a bit more and got an error. Here is the dump.

This was in a blank settings file. I pasted the xml for the entire package in the report.

Code:
date/time         : 2008-08-17, 16:47:39, 937ms
computer name     : SCROLL-II
user name         : Ramoth <admin>
registered owner  : Ramoth
operating system  : Windows XP Service Pack 3 build 2600
system language   : English
system up time    : 46 minutes 34 seconds
program up time   : 23 minutes 23 seconds
processors        : 2x AMD Athlon(tm) 64 X2 Dual Core Processor 4800+
physical memory   : 1437/2046 MB (free/total)
free disk space   : (D:) 7.46 GB
display mode      : 1280x1024, 32 bit
process id        : $884
allocated memory  : 30.67 MB
executable        : cMUDPro.exe
exec. date/time   : 2008-08-14 21:42
version           : 2.36.0.0
compiled with     : BCB 2006/07
madExcept version : 3.0h
contact name      : Joshua Jewell AKA Arminas
contact email     :
callstack crc     : $91ce7aec, $c3c4f49d, $c3c4f49d
exception number  : 1
exception class   : EAccessViolation
exception message : Access violation at address 004034CB in module 'cMUDPro.exe'. Read of address 0B5F644E.

Main ($d7c):
004034cb +0067 cMUDPro.exe  System      3661  +34 Move
00a9bdb4 +0274 cMUDPro.exe  term        3663  +43 TTerm.DeleteText
00a9b2eb +009b cMUDPro.exe  term        3195   +8 TTerm.ReplaceText
00d6972d +0275 cMUDPro.exe  MAIN        6014  +40 TMUDForm.HandlePSub
00d9660f +162f cMUDPro.exe  MAIN       18212 +201 HandleCase
00da0bfc +00a0 cMUDPro.exe  MAIN       19929  +12 TMUDForm.ExecCommand
00e2a309 +00a9 cMUDPro.exe  CodeExec     936   +9 ExecMUDCommand
00e302d0 +0454 cMUDPro.exe  CodeExec    2589  +45 DoDefault
00e3137b +0f2f cMUDPro.exe  CodeExec    2859 +254 HandleCom
00e32abe +060e cMUDPro.exe  CodeExec    3276 +108 TCodeExec.InternalExecute
00e29365 +0051 cMUDPro.exe  CodeExec     480   +8 TCodeExec.Execute
00e1ea4e +00c2 cMUDPro.exe  PrefDat    11298   +9 TCacheNode.Execute
00e1acbb +02ef cMUDPro.exe  PrefDat     9724  +52 PrefRec.InternalExecute
00e1af0a +0022 cMUDPro.exe  PrefDat     9781   +2 PrefRec.Execute
00d6ac11 +0151 cMUDPro.exe  MAIN        6473  +14 TMUDForm.ExecThread
00d73d35 +0519 cMUDPro.exe  MAIN        9354 +102 TMUDForm.ExecTrig
00d7154d +12c5 cMUDPro.exe  MAIN        8526 +339 TMUDForm.HandleTrigger
00d6fd73 +000f cMUDPro.exe  MAIN        8009   +1 TMUDForm.UserOutNewLine
00aadc21 +0039 cMUDPro.exe  term        9162   +3 TTerm.DoTriggerLine
00aac5b4 +0218 cMUDPro.exe  term        8728  +34 HandleNewLine
00aace18 +06e4 cMUDPro.exe  term        8856 +104 TTerm.PutText
00aad3d7 +0053 cMUDPro.exe  term        8962   +2 TTerm.Add
00d5a179 +00b1 cMUDPro.exe  MAIN        1666   +8 TMUDForm.OutputStr
00d5a451 +00d9 cMUDPro.exe  MAIN        1749  +26 TMUDForm.NextMUDLine
00d5a91e +0022 cMUDPro.exe  MAIN        1827   +4 TMUDForm.DoNextLine
00da9854 +0048 cMUDPro.exe  MAIN       22372   +4 TMUDForm.ProcessMUDNow
00da0bfc +00a0 cMUDPro.exe  MAIN       19929  +12 TMUDForm.ExecCommand
00d187e1 +00e1 cMUDPro.exe  CodeThread  1225  +12 TRunCodeThread.DoExecCommand
0047a68d +00fd cMUDPro.exe  Classes     9835  +22 CheckSynchronize
00d1774d +00ed cMUDPro.exe  CodeThread   502  +28 MsgWaitForSingleObject
00d17870 +0024 cMUDPro.exe  CodeThread   574   +4 WaitForThread
00d6a878 +0244 cMUDPro.exe  MAIN        6417  +52 TMUDForm.ExecComThread
00d6b7ba +046a cMUDPro.exe  MAIN        6663  +47 TMUDForm.NewProcessStr
00d6a2a1 +0009 cMUDPro.exe  MAIN        6284   +2 TMUDForm.ProcessStr
00d69d3b +003b cMUDPro.exe  MAIN        6159  +10 TMUDForm.ParseCommand
00d7cdc9 +023d cMUDPro.exe  MAIN       12495  +34 TMUDForm.Command
00d7e12a +025e cMUDPro.exe  MAIN       12848  +37 TMUDForm.FormKeyDown
00da8033 +0013 cMUDPro.exe  MAIN       21810   +1 TMUDForm.UserInKeyDown
004c4af0 +0020 cMUDPro.exe  Controls    8096   +1 TWinControl.KeyDown
0097f287 +0013 cMUDPro.exe  RVScroll     568   +1 TRVScroller.KeyDown
00922ddc +0014 cMUDPro.exe  RichView    1970   +1 TCustomRichView.KeyDown
008f21d8 +0044 cMUDPro.exe  RVEdit      1768   +6 TCustomRichViewEdit.KeyDown
004c4b8c +0090 cMUDPro.exe  Controls    8125  +22 TWinControl.DoKeyDown
004c4bae +000a cMUDPro.exe  Controls    8134   +1 TWinControl.WMKeyDown
008f20fa +0206 cMUDPro.exe  RVEdit      1742  +41 TCustomRichViewEdit.WMKeyDown
004bef28 +0024 cMUDPro.exe  Controls    5021   +5 TControl.Perform
004c55ca +00b2 cMUDPro.exe  Controls    8568  +18 TWinControl.CNKeyDown
004bf29b +02bb cMUDPro.exe  Controls    5146  +83 TControl.WndProc
004c329f +04fb cMUDPro.exe  Controls    7304 +111 TWinControl.WndProc
004c29c8 +002c cMUDPro.exe  Controls    7073   +3 TWinControl.MainWndProc
0047c4f0 +0014 cMUDPro.exe  Classes    11583   +8 StdWndProc
7e4196c2 +000a USER32.dll                         DispatchMessageA
004ad974 +00fc cMUDPro.exe  Forms       8105  +23 TApplication.ProcessMessage
004ad9ae +000a cMUDPro.exe  Forms       8124   +1 TApplication.HandleMessage
004adca3 +00b3 cMUDPro.exe  Forms       8223  +20 TApplication.Run
00eb09fc +0088 cMUDPro.exe  cMUDPro      352  +20 initialization
7c912c01 +0069 ntdll.dll                          RtlUnicodeStringToAnsiString
7c812c24 +00b6 kernel32.dll                       GetVersionExA

error details:
I was testing a bug that Tech found with the following code.
.
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="2299" trigontrig="false" copy="yes">
    <pattern>dolly</pattern>
    <value>;#pcol pink (%pos(dolly,%line)-1) (%len(dolly)+%pos(dolly,%line)-1) 0 0
;#pcol pink (%pos(dolly,%trigger)-1) (%len(dolly)+%pos(dolly,%trigger)-1) 0 0
#pcol pink (%pos(dolly,@trig)-1) (%len(dolly)+%pos(dolly,@trig)-1) 0 0</value>
  </trigger>
  <trigger priority="2320" trigontrig="false" copy="yes">
    <pattern>(*)</pattern>
    <value>#PSUB {%1} %x1
#var Trig %1</value>
  </trigger>
</cmud>
.
I put the following into the command line and hit enter.
.
#show dolly daisy darling do
#show daisy dolly darling do


Edit: Error reduced to its simplest form.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="2200" trigontrig="false" copy="yes">
    <pattern>(*)</pattern>
    <value>#PSUB {%1} %x1</value>
  </trigger>
  <trigger priority="2100" trigontrig="false" copy="yes">
    <pattern>dolly</pattern>
    <value>#pcol red -1 0</value>
  </trigger>
</cmud>


Type
#show dolly

Note that the priority matters. The #PCOL trigger must fire first to cause the error.
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram

Last edited by Arminas on Mon Aug 18, 2008 2:06 am; edited 3 times in total
Reply with quote
Arminas
Wizard


Joined: 11 Jul 2002
Posts: 1265
Location: USA

PostPosted: Sun Aug 17, 2008 11:29 pm   
 
Playing with this more I found that if you use ansi colors and if you check ANSI trigger then everything works fine.
Except that with ANSI trigger checked you MUST add your own new line. Which looks like another BUG.

Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="2299" trigontrig="false" copy="yes">
    <pattern>dolly</pattern>
    <value>;#cw pink
#cw red</value>
  </trigger>
  <trigger priority="2320" ansi="true" trigontrig="false" copy="yes">
    <pattern>(*)</pattern>
    <value>#PSUB {%1%crlf} %x1</value>
  </trigger>
</cmud>


But if you comment out the #cw red and un-comment the #cw pink dolly will be black.
So the PSUB still doesn't understand the custom styles. Sad Which is why Tech noticed this.

The reason that it was coloring the whole line pink before is that ANSI trigger was not ticked so the psub could not remove the beginning color code and was stripping out the </color>, or rather it's equivalent, tag in the replacement text.

Anyway I hope all this is helpful.

Edit:
Post Edited Multiple times for clarity as I played with the triggers.

After lots of tinkering here is how I see things.

1. There are two bugs here the first one is in the fact that when you have ANSI trigger checked you have to add your own new line as mentioned above.
2. If you do want a PSUB something without the colors use, %e[0S, it resets the line to the default style.
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <trigger priority="2319" trigontrig="false" copy="yes">
    <pattern>^(*)</pattern>
    <value>#PSUB {%e[0S%1} %x1</value>
  </trigger>
</cmud>


3. The second one is for whatever reason when you are using an ANSI trigger for PSUB if a non-ANSI color was used on the line the text will show up as BLACK.

If you want to do what Tech was attempting above it is best to set the #cw trigger to a higher priority number than the #PSUB trigger. It works perfectly that way. Laughing
_________________
Arminas, The Invisible horseman
Windows 7 Pro 32 bit
AMD 64 X2 2.51 Dual Core, 2 GB of Ram
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Aug 18, 2008 5:17 pm   
 
I've put this thread into my bug list to look at in the future, but it sounds pretty obscure.

On the issue with #PSUB with the ANSI Trigger option checked, keep in mind that none of the #SUB, #PSUB commands work within ANSI triggers currently. That is a known limitation and is on the wish-list for the future.
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