[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Bug reports
. . -> [Subject]  [Solved] Color matching trigger will not match any color other than white.
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

[Solved] Color matching trigger will not match any color other than white.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Tyro   (4 posts)  [Biography] bio
Date Sun 13 Aug 2017 10:38 PM (UTC)

Amended on Fri 18 Aug 2017 02:24 AM (UTC) by Tyro

Message
I'm using MUSHclient 5.05

I'm attempting to set a trigger to grab room names from Armageddon MUD. The room name lines are bold yellow text, and they end with brown text describing the exits.

When I set a trigger to match on yellow lines and send the line to a script, the trigger never seemed to match anything. So I moved to the trigger GUI and attempted to duplicate the setup, hoping I'd just messed up the trigger definition in the plugin.

This eventually led me to just seeing if I was missing something fundamental about triggers in MUSHclient, so I started testing with just a '*' for the match and no other requirements. As you'd expect, that matched all lines.

Changing only the setting to have it match yellow lines produced no matches. Oddly enough, changing it to only match white lines matched exactly as you'd expect. No other color settings managed to match any lines.

This made me wonder if there was something I didn't understand about how MUDs send colors, and that maybe the colors in Armageddon weren't coming as simple ANSI codes. So I matched on a word from the yellow room name line and sent the whole line to a script. The script ran GetStyle on the third column and it told me the line was yellow.

I'm out of ideas as to why I can't seem to match colored lines. I'm hoping it's just something that I'm failing to understand, but I seem to have pinned the issue down tightly enough to warrant a bug report.

To make sure I wasn't missing some check box that could help, here are some screen shots: http://imgur.com/a/sFFmj

[Solved]
Using `Display -> Text Attributes` on the line in question revealed that the MUD was sending all colors except for white as 256-ANSI color codes instead of plain ANSI color codes. MUSHclient triggers don't match on 256-ANSI color codes, so a workaround is used for this match: Match on every line and send the match to another script that reads the styles table to determine the color.
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Mon 14 Aug 2017 05:45 AM (UTC)
Message
Please post the trigger in question.

Template:copying For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


Also please post a "packet debug" of a room name, that should match the trigger. Use the Edit menu -> Packet Debug to turn on packet debugging, capture a room or two, and then turn packet debugging off.

Paste the resulting packet(s) here as an answer.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Tyro   (4 posts)  [Biography] bio
Date Reply #2 on Mon 14 Aug 2017 12:03 PM (UTC)
Message
Nick, thank you for the fast response. I've just been informed that I'll be out of town for the next two days, and I don't want you to feel like I'm unresponsive. When I get back, I'll follow your instructions and see if we can get to the bottom of this. Sorry about the delay.
[Go to top] top

Posted by Tyro   (4 posts)  [Biography] bio
Date Reply #3 on Thu 17 Aug 2017 03:29 AM (UTC)

Amended on Thu 17 Aug 2017 03:42 AM (UTC) by Tyro

Message
Here's the original trigger that stared this investigation.


<trigger
    script="got_room_name"
    match="*"
    match_text_colour="y"
    text_colour="11"
    match_bold="y"
    keep_evaluating="y"
    sequence="90"
    enabled="y"
    >
</trigger>




Sent  packet: 26 (3 bytes) at Thursday, August 17, 2017, 12:39:48 AM

l..                6c 0d 0a

Incoming packet: 42 (27 bytes) at Thursday, August 17, 2017, 12:39:49 AM

.[38;5;11mTempla   1b 5b 33 38 3b 35 3b 31 31 6d 54 65 6d 70 6c 61
rs' Way.[0m        72 73 27 20 57 61 79 1b 5b 30 6d

Incoming packet: 43 (535 bytes) at Thursday, August 17, 2017, 12:39:49 AM

.[38;5;208m [N,    1b 5b 33 38 3b 35 3b 32 30 38 6d 20 5b 4e 2c 20
S].[0m..   Templ   53 5d 1b 5b 30 6d 0a 0d 20 20 20 54 65 6d 70 6c
ars' Way stretch   61 72 73 27 20 57 61 79 20 73 74 72 65 74 63 68
es north and sou   65 73 20 6e 6f 72 74 68 20 61 6e 64 20 73 6f 75
th through the v   74 68 20 74 68 72 6f 75 67 68 20 74 68 65 20 76
ery heart of..th   65 72 79 20 68 65 61 72 74 20 6f 66 0a 0d 74 68
e crowded city.    65 20 63 72 6f 77 64 65 64 20 63 69 74 79 2e 20
The road is made   54 68 65 20 72 6f 61 64 20 69 73 20 6d 61 64 65
 of large, black   20 6f 66 20 6c 61 72 67 65 2c 20 62 6c 61 63 6b
-colored stones,   2d 63 6f 6c 6f 72 65 64 20 73 74 6f 6e 65 73 2c
..coated with du   0a 0d 63 6f 61 74 65 64 20 77 69 74 68 20 64 75
st, dung, and ot   73 74 2c 20 64 75 6e 67 2c 20 61 6e 64 20 6f 74
her unsavory mat   68 65 72 20 75 6e 73 61 76 6f 72 79 20 6d 61 74
erials, and pass   65 72 69 61 6c 73 2c 20 61 6e 64 20 70 61 73 73
es..under the Ar   65 73 0a 0d 75 6e 64 65 72 20 74 68 65 20 41 72
ena's morbid sha   65 6e 61 27 73 20 6d 6f 72 62 69 64 20 73 68 61
dow, a gigantic    64 6f 77 2c 20 61 20 67 69 67 61 6e 74 69 63 20
structure standi   73 74 72 75 63 74 75 72 65 20 73 74 61 6e 64 69
ng to the..east    6e 67 20 74 6f 20 74 68 65 0a 0d 65 61 73 74 20
against the nigh   61 67 61 69 6e 73 74 20 74 68 65 20 6e 69 67 68
t-darkened sky.    74 2d 64 61 72 6b 65 6e 65 64 20 73 6b 79 2e 20
The Commoners' Q   54 68 65 20 43 6f 6d 6d 6f 6e 65 72 73 27 20 51
uarter, quieted.   75 61 72 74 65 72 2c 20 71 75 69 65 74 65 64 0a
.by the evening'   0d 62 79 20 74 68 65 20 65 76 65 6e 69 6e 67 27
s advent, lies t   73 20 61 64 76 65 6e 74 2c 20 6c 69 65 73 20 74
o the west....[3   6f 20 74 68 65 20 77 65 73 74 2e 0a 0d 1b 5b 33
8;5;14mThe sands   38 3b 35 3b 31 34 6d 54 68 65 20 73 61 6e 64 73
tone statue of a   74 6f 6e 65 20 73 74 61 74 75 65 20 6f 66 20 61
 bearded templar   20 62 65 61 72 64 65 64 20 74 65 6d 70 6c 61 72
 towers here, ar   20 74 6f 77 65 72 73 20 68 65 72 65 2c 20 61 72
ms sternly folde   6d 73 20 73 74 65 72 6e 6c 79 20 66 6f 6c 64 65
d..[0m.[38;5;14m   64 2e 1b 5b 30 6d 1b 5b 33 38 3b 35 3b 31 34 6d
...[0m..98hp 91m   0a 0d 1b 5b 30 6d 0a 0d 39 38 68 70 20 39 31 6d
v 99st>            76 20 39 39 73 74 3e

Sent  packet: 27 (3 bytes) at Thursday, August 17, 2017, 12:39:50 AM

n..                6e 0d 0a

Incoming packet: 44 (66 bytes) at Thursday, August 17, 2017, 12:39:51 AM

You pass beneath   59 6f 75 20 70 61 73 73 20 62 65 6e 65 61 74 68
 the shadow of t   20 74 68 65 20 73 68 61 64 6f 77 20 6f 66 20 74
he red sandstone   68 65 20 72 65 64 20 73 61 6e 64 73 74 6f 6e 65
 templar statue.   20 74 65 6d 70 6c 61 72 20 73 74 61 74 75 65 2e
..                 0a 0d

Incoming packet: 45 (460 bytes) at Thursday, August 17, 2017, 12:39:51 AM

.[38;5;11mTempla   1b 5b 33 38 3b 35 3b 31 31 6d 54 65 6d 70 6c 61
rs' Way.[0m.[38;   72 73 27 20 57 61 79 1b 5b 30 6d 1b 5b 33 38 3b
5;208m [N, E, S]   35 3b 32 30 38 6d 20 5b 4e 2c 20 45 2c 20 53 5d
.[0m..   Templar   1b 5b 30 6d 0a 0d 20 20 20 54 65 6d 70 6c 61 72
s' Way stretches   73 27 20 57 61 79 20 73 74 72 65 74 63 68 65 73
 north and south   20 6e 6f 72 74 68 20 61 6e 64 20 73 6f 75 74 68
 through the ver   20 74 68 72 6f 75 67 68 20 74 68 65 20 76 65 72
y heart of..the    79 20 68 65 61 72 74 20 6f 66 0a 0d 74 68 65 20
crowded city. Th   63 72 6f 77 64 65 64 20 63 69 74 79 2e 20 54 68
e road is made o   65 20 72 6f 61 64 20 69 73 20 6d 61 64 65 20 6f
f large, black-c   66 20 6c 61 72 67 65 2c 20 62 6c 61 63 6b 2d 63
olored stones,..   6f 6c 6f 72 65 64 20 73 74 6f 6e 65 73 2c 0a 0d
coated with dust   63 6f 61 74 65 64 20 77 69 74 68 20 64 75 73 74
, dung, and othe   2c 20 64 75 6e 67 2c 20 61 6e 64 20 6f 74 68 65
r unsavory mater   72 20 75 6e 73 61 76 6f 72 79 20 6d 61 74 65 72
ials, and passes   69 61 6c 73 2c 20 61 6e 64 20 70 61 73 73 65 73
..under the Aren   0a 0d 75 6e 64 65 72 20 74 68 65 20 41 72 65 6e
a's morbid shado   61 27 73 20 6d 6f 72 62 69 64 20 73 68 61 64 6f
w, a gigantic st   77 2c 20 61 20 67 69 67 61 6e 74 69 63 20 73 74
ructure standing   72 75 63 74 75 72 65 20 73 74 61 6e 64 69 6e 67
 to the..east ag   20 74 6f 20 74 68 65 0a 0d 65 61 73 74 20 61 67
ainst the night-   61 69 6e 73 74 20 74 68 65 20 6e 69 67 68 74 2d
darkened sky. Th   64 61 72 6b 65 6e 65 64 20 73 6b 79 2e 20 54 68
e Commoners' Qua   65 20 43 6f 6d 6d 6f 6e 65 72 73 27 20 51 75 61
rter, quieted..b   72 74 65 72 2c 20 71 75 69 65 74 65 64 0a 0d 62
y the evening's    79 20 74 68 65 20 65 76 65 6e 69 6e 67 27 73 20
advent, lies to    61 64 76 65 6e 74 2c 20 6c 69 65 73 20 74 6f 20
the west.....98h   74 68 65 20 77 65 73 74 2e 0a 0d 0a 0d 39 38 68
p 91mv 99st>       70 20 39 31 6d 76 20 39 39 73 74 3e
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Thu 17 Aug 2017 04:10 AM (UTC)
Message
Hmm. Converting your debug packets into something I can test with, and then looking at one of those yellow lines, I see this:


Line 146 (146), Thursday, August 17, 2:53:23 PM
 Flags = End para: YES, Note: no, User input: no, Log: YES, Bookmark: no
 Length = 20, last space = 17
 Text = "Templars' Way [N, S]"

3 style runs

1: Offset = 0, Length = 13, Text = "Templars' Way"
 No action.
 Flags = Hilite: no, Underline: no, Blink: no, Inverse: no, Changed: no
 Foreground colour 256-ANSI   : R=255, G=255, B=0
 Background colour ANSI  : 0 (Black)

2: Offset = 13, Length = 7, Text = " [N, S]"
 No action.
 Flags = Hilite: no, Underline: no, Blink: no, Inverse: no, Changed: no
 Foreground colour 256-ANSI   : R=255, G=135, B=0
 Background colour ANSI  : 0 (Black)

3: Offset = 20, Length = 0, Text = ""
 No action.
 Flags = Hilite: no, Underline: no, Blink: no, Inverse: no, Changed: no
 Foreground colour ANSI  : 7 (White)
 Background colour ANSI  : 0 (Black)

20 columns in 3 style runs


To do this, select text on that line, then go to the Display menu -> Text Attributes, then click Line Info.

The yellow part ("Templars' Way") is yellow, but it isn't ANSI yellow. It's 256-ANSI yellow (see where it says 256-ANSI) which isn't triggering a match.

A reasonably simple way around this is to match every line, and then ignore ones which don't start with yellow. So change the trigger to remove the colour match, and then start your script function like this:


YELLOW = ColourNameToRGB ("yellow")

function got_room_name (name, line, wildcards, styles)

  -- see if line starts with yellow  
  if styles [1].textcolour ~= YELLOW then
    return
  end -- line doesn't start with yellow
  
  -- do stuff here
 
end  -- got_room_name

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Tyro   (4 posts)  [Biography] bio
Date Reply #5 on Thu 17 Aug 2017 04:30 PM (UTC)
Message
Ah, I see. That explains why my other tests were only matching on white lines and couldn't match on other colors. Armageddon is using 256-ANSI colors, but it's sending the white lines intentionally as ANSI-white.

That means this isn't a bug with triggers, more like a feature request for 256-ANSI trigger matching. Course, your workaround IS exactly what the feature would be doing, so I don't think it's worth a formal feature request.

I will be able to rewrite and test the new trigger in a few hours. Assuming that goes smoothly, I'll consider this report closed. I don't see a "close" or "solved" button, so I'll just amend the description with the solution, and edit the title to begin with "[SOLVED]".

Thanks for your help. I'm especially happy to have been pointed to the Packet Debug and Text Attributes tools. I doubt I would have had to file this false-bug at all had I known about them already.
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


1,054 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]