| Posted by
| Nick Gammon
Australia (23,169 posts) Bio
Forum Administrator |
| 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 | | Top |
|