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
Dwoggurd
Wanderer


Joined: 29 Jan 2008
Posts: 63

PostPosted: Sat Jun 07, 2008 5:04 pm   

[2.26] ANSI colors
 
Sometimes #SAY output is not colored properly. Often first #SAY line after a mud text/prompt is not colored. This is an old bug actually.

Something like this: (I type in two #SAY commands after a prompt).
<100%hp 100%m 100%mv 1750tnl (50.00%)>
#say ==== 1 =====
#say ==== 2 =====
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Jun 09, 2008 5:32 pm   
 
I would need to see the exact dump of the raw data from the MUD to see how your prompt is being colored. Use the #DEBUGFILE command like this:

#DEBUGFILE test.raw test.txt

and then do your #SAY command after a prompt. You can post the test.txt file within CODE tags here on the forums (but don't post the test.raw file since it contains raw control codes). You can also get this information via the Raw Input/output messages in the Script Debugger window.
Reply with quote
Dwoggurd
Wanderer


Joined: 29 Jan 2008
Posts: 63

PostPosted: Mon Jun 09, 2008 7:57 pm   
 
Prompt is not colored actually.

Here is test.txt (I pressed ENTER after prompts with #SAY commands inbetween and first #SAY is not colored):
Code:

out (    2) 06/09/08 14:52:06:046 : <CR><LF>
in  (   41) 06/09/08 14:52:06:250 : <LF><CR>
<100%hp 100%m 100%mv 1750tnl (50.00%)>
out (    2) 06/09/08 14:52:16:578 : <CR><LF>
in  (   41) 06/09/08 14:52:16:718 : <LF><CR>
<100%hp 100%m 100%mv 1750tnl (50.00%)>
out (    2) 06/09/08 14:52:26:265 : <CR><LF>
in  (   41) 06/09/08 14:52:26:703 : <LF><CR>
<100%hp 100%m 100%mv 1750tnl (50.00%)>
out (    6) 06/09/08 14:52:39:656 : quit<CR><LF>
in  (   56) 06/09/08 14:52:39:984 : Awaiting the hour of reprisal, your time slips away...<LF><CR>

I wonder if the order of <LF> and <CR> matters.
Reply with quote
Zugg
MASTER


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

PostPosted: Mon Jun 09, 2008 8:24 pm   
 
I cannot reproduce this. Something else must be going on. I just did the following test to simulate the MUD prompt:
Code:
#SHOWPROMPT "<100%hp 100%m 100%mv 1750tnl (50.00%)> "
#say this is a test
#say this is a test

and both #say commands were colored normally here. Maybe instead of using #debugfile you can open the Script Debugger and turn on the Raw Input/output messages and then capture your two #say commands there.
Reply with quote
Dwoggurd
Wanderer


Joined: 29 Jan 2008
Posts: 63

PostPosted: Mon Jun 09, 2008 8:36 pm   
 
I have a prompt trigger too:

Code:
<trigger priority="100" case="true" regex="true" prompt="true" id="720">
  <pattern>(^<.*\d+.*\d+.*\d+.*?> )(.*)</pattern>
  <value>#IF (%2 != %null)
{
  #SUB {%1}
  #SHOW %2
}
#RAISE Prompt
</value>
</trigger>

It looks wierd but I had problems with #SUB before.

I did this: pressed ENTER to invoker a mud prompt and then typed #SAY twice:
Code:
       | a      test |<100%hp 100%m 100%mv 1750tnl (50.00%)>
0.0027 | j      test >
0.2299 | a      test |
0.0034 | a      test ]<100%hp 100%m 100%mv 1750tnl (50.00%)>
0.0006 | f      test |  Pattern: (^<.*\d+.*\d+.*\d+.*?> )(.*) : (%1="<100%hp 100%m 100%mv 1750tnl (50.00%)> ", %2="")
0.0003 | c      test |  exec : Pattern "(^<.*\d+.*\d+.*\d+.*?> )(.*)" : #IF (%2 != %null...
12.768 | ---
0.0013 | c      test |  exec : #say === 1 ===
0.0004 | a      test |<100%hp 100%m 100%mv 1750tnl (50.00%)> === 1 ===
0.0010 | f      test |  Pattern: (^<.*\d+.*\d+.*\d+.*?> )(.*) : (%1="<100%hp 100%m 100%mv 1750tnl (50.00%)> ", %2="=== 1 ===")
0.0003 | c      test |  exec : Pattern "(^<.*\d+.*\d+.*\d+.*?> )(.*)" : #IF (%2 != %null...
0.0009 | a      test |=== 1 ===
0.0023 | g      test ==== 1 ===
5.9769 | ---
0.0011 | c      test |  exec : #say === 2 ===
0.0006 | a      test |=== 2 ===
0.0002 |


Edit: I got it, first say is substituted. I need to figure out how to make it work as expected.
Reply with quote
Dwoggurd
Wanderer


Joined: 29 Jan 2008
Posts: 63

PostPosted: Mon Jun 09, 2008 10:07 pm   
 
I dig more and found another problem.

I'm trying to split other text from a prompt and keep the original text color.
When I changed my trigger
Code:
<trigger priority="101" case="true" regex="true" id="720">
  <pattern>(^<.*\d+.*\d+.*\d+.*?> )(.*)</pattern>
  <value>#IF (%2 != %null)
{
  #SUB {%1}
  #SHOW %2
}</value>
</trigger>

into ANSI color pattern type it got broken. CMUD detects trigger loop when I type in #SAY right after a prompt.
Without ANSI color option it splits #SAY output from a prompt but I lose colors.
Reply with quote
oldguy2
Wizard


Joined: 17 Jun 2006
Posts: 1201

PostPosted: Thu Jun 12, 2008 8:54 am   
 
I don't see a problem. Well yes I do. Your prompt trigger pattern is horrible. No offense.

Try this.

Code:
^(<[^>]*>)\s((={3})\s\d\s\3)?

or

^(<[^>]*>)((\s={3})\s\d\3)?


As for your last post, checking ANSI Trigger option means the pattern contains ANSI control codes...which it does not. I'm sure someone else has a better option but oh well. Either way the #say color is showing up just fine.

Edit: By the way, I think what you are trying to do is take the === 2 === part and place it on a line under the prompt instead of at the end of the prompt, but you want to keep the prompt colors that come from the mud. You weren't really talking about the color of the #say to begin with were you? This of course is why Zugg said the say colors show up normal, because they do. Recoloring your prompt in the Sub is just as easy, but since you didn't post any of the colors no one knows what they are.
Reply with quote
Dwoggurd
Wanderer


Joined: 29 Jan 2008
Posts: 63

PostPosted: Thu Jun 12, 2008 8:12 pm   
 
No, I'm trying to place #SAY on a line under prompt with say-color. And not only say, any text after a prompt. And I want to preserve colors.
May anybody suggest me a way to do that?
I tried ansi colored trigger, it actually worked because it captures color codes in variables so I can #SAY/#SHOW it on the next line but I have problems with #SUB.
It seems any trigger with #SUB/#PSUB is executed at least twice (shown in script debugger) and when I set color option for a trigger it falls into a loop. It looks like #SUB'ed line is processed by the same trigger over and over though #SUB help file specifically states it should not happen. And this behavior is triggered only after I set ansi colored option for a trigger.

Addiction: my prompt trigger pattern is horrible because it supposed to catch "any" prompt with any text after it. Prompt format may be changed in my mud by special commands so here I just assume that most common thing for various prompt is 3 digits with arbitrary text in angle brackets. My pattern catches most of those prompts (though it is possible to set a prompt that will be missed by my pattern). It also does not fire on other angle brackets that are not prompts. Your proposed pattern simply does not work for me.
Reply with quote
Tech
GURU


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

PostPosted: Thu Jun 12, 2008 10:29 pm   
 
Did you try disabling the 'Trigger on Trigger' option for the ansi version of this Trigger?
_________________
Asati di tempari!
Reply with quote
Dwoggurd
Wanderer


Joined: 29 Jan 2008
Posts: 63

PostPosted: Fri Jun 13, 2008 12:08 am   
 
I need other trigger to fire on the text that follows a prompt.
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