Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ Help! How to make a colour-matching trigger

Help! How to make a colour-matching trigger

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


Posted by Superdzl   (6 posts)  Bio
Date Tue 07 Apr 2009 11:08 AM (UTC)
Message
I want to make a colour-matching trigger,but the colour is not in the 8 options (Black ,Red,Green,Yellow,blue,Magenta,cyan,white).How do I.
And how can I get the colour code from mud.
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #1 on Tue 07 Apr 2009 11:58 AM (UTC)
Message
The colour -should- be in the list. If it isn't, that is most likely because you have the bold representation of some colour changed to what you know it as. Look at Configuration -> Appaerance -> ANSI Colour for all the supported colours. If you find the colour you are looking for is indeed one of the bold colours, just select the appropriate colour in your trigger and make sure the checkmark for bold is black on white, rather than the default dark gray on a lighter grey (which signifies either is allowed).

If that doesn't solve it, we probably need some more information. Probably your mud is using MXP then, and I'm not entirely sure how to help you with that.
Top

Posted by Superdzl   (6 posts)  Bio
Date Reply #2 on Tue 07 Apr 2009 02:58 PM (UTC)
Message
I do as you said,it still can't work . I try to copy the line which I want to match as HTML,it shows the background colour is "#800000",how can I do to match this background colour.
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #3 on Tue 07 Apr 2009 04:45 PM (UTC)
Message
That tells me nothing, actually.

Can you select Edit -> Debug Packets, have the mud produce the line in question (and then deselect the option again to turn it off)? I'd like to see the precise data in question so I know what I'm dealing with.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #4 on Tue 07 Apr 2009 10:55 PM (UTC)
Message
Select the word in question, then go to Display -> Text Attributes. That shows the name of the colour it is in.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Superdzl   (6 posts)  Bio
Date Reply #5 on Wed 08 Apr 2009 01:21 AM (UTC)

Amended on Wed 08 Apr 2009 09:44 PM (UTC) by Nick Gammon

Message
It's a maze map. The debug information :


Sent  packet: 56 (4 bytes) at ¯ŠúŽO, ŽlŒŽ 08, 2009, 9:15:39 ãŒß

mm..               6d 6d 0d 0a

Incoming packet: 100 (783 bytes) at ¯ŠúŽO, ŽlŒŽ 08, 2009, 9:15:39 ãŒß


.[256D.[K.......   1b 5b 32 35 36 44 1b 5b 4b c3 d4 b9 ac b5 d8 cd
................   bc a3 ba 0d 0a b0 d7 c9 ab b7 bd bf e9 b1 ed ca
................   be c3 d4 b9 ac c8 eb bf da a3 bb ba ec c9 ab b7
................   bd bf e9 b1 ed ca be c3 d4 b9 ac b3 f6 bf da a3
................   bb 0d 0a c0 b6 c9 ab ce e5 bd c7 d0 c7 b1 ed ca
................   be c4 e3 b5 b1 c7 b0 b5 c4 ce bb d6 c3 a1 a3 0d
................   0a a9 b0 a9 a4 a9 d0 a9 a4 a9 d0 a9 a4 a9 d0 a9
................   a4 a9 d0 a9 a4 a9 d0 a9 a4 a9 d0 a9 a4 a9 d0 a9
.......      ..    a4 a9 b4 0d 0a a9 a6 20 20 20 20 20 20 a9 a6 20
 ..                20 a9 a6 20 20 20 20 20 20 20 20 20 20 20 20 20
 ..  ......  ...   20 a9 a6 20 20 a9 a6 0d 0a a9 c0 20 20 a9 e0 a9
...  ..........    a4 a9 e0 20 20 a9 e0 a9 a4 a9 e0 a9 a4 a9 e0 20
 ..  ..  ......    20 a9 e0 20 20 a9 e0 20 20 a9 c8 0d 0a a9 a6 20
             ..    20 20 20 20 20 20 20 20 20 20 20 20 20 a9 a6 20
 ..  ..      ...   20 a9 a6 20 20 a9 a6 20 20 20 20 20 20 a9 a6 0d
.......  ......    0a a9 c0 a9 a4 a9 e0 20 20 a9 e0 a9 a4 a9 e0 20
 ..  ......  ...   20 a9 e0 20 20 a9 e0 a9 a4 a9 e0 20 20 a9 e0 a9
........[41;1m     a4 a9 c8 0d 0a a9 a6 1b 5b 34 31 3b 31 6d 20 20
.[2;37;0m    ..    1b 5b 32 3b 33 37 3b 30 6d 20 20 20 20 a9 a6 20
 ..      ..  ..    20 a9 a6 20 20 20 20 20 20 a9 a6 20 20 a9 a6 20
     ......  ..    20 20 20 20 20 a9 a6 0d 0a a9 c0 20 20 a9 e0 20
 ..  ..  ..  ..    20 a9 e0 20 20 a9 e0 20 20 a9 e0 20 20 a9 e0 20
 ..  ..........    20 a9 e0 20 20 a9 e0 a9 a4 a9 c8 0d 0a a9 a6 20
 ..  ..      ..    20 a9 a6 20 20 a9 a6 20 20 20 20 20 20 a9 a6 20
     ...[34m...[   20 20 20 20 20 a9 a6 1b 5b 33 34 6d a1 ef 1b 5b
2;37;0m  .[47;1m   32 3b 33 37 3b 30 6d 20 20 1b 5b 34 37 3b 31 6d
  .[2;37;0m.....   20 20 1b 5b 32 3b 33 37 3b 30 6d a9 a6 0d 0a a9
.  .............   c0 20 20 a9 e0 a9 a4 a9 e0 a9 a4 a9 e0 a9 a4 a9
.  ..  ..  ..  .   e0 20 20 a9 e0 20 20 a9 e0 20 20 a9 e0 20 20 a9
.....  ..          c8 0d 0a a9 a6 20 20 a9 a6 20 20 20 20 20 20 20
       ..      .   20 20 20 20 20 20 20 a9 a6 20 20 20 20 20 20 a9
.  .............   a6 20 20 a9 a6 0d 0a a9 c0 a9 a4 a9 e0 a9 a4 a9
.............  .   e0 a9 a4 a9 e0 a9 a4 a9 e0 a9 a4 a9 e0 20 20 a9
.  ..  ......  .   e0 20 20 a9 e0 20 20 a9 c8 0d 0a a9 a6 20 20 a9
.      ..          a6 20 20 20 20 20 20 a9 a6 20 20 20 20 20 20 20
   ..  ..  .....   20 20 20 a9 a6 20 20 a9 a6 20 20 a9 a6 0d 0a a9
.  ......  .....   c0 20 20 a9 e0 a9 a4 a9 e0 20 20 a9 e0 a9 a4 a9
.....  ..  ..  .   e0 a9 a4 a9 e0 20 20 a9 e0 20 20 a9 e0 20 20 a9
.....      ..  .   c8 0d 0a a9 a6 20 20 20 20 20 20 a9 a6 20 20 a9
.          ..  .   a6 20 20 20 20 20 20 20 20 20 20 a9 a6 20 20 a9
.  ..........  .   a6 20 20 a9 a6 0d 0a a9 c0 a9 a4 a9 e0 20 20 a9
.  ..........  .   e0 20 20 a9 e0 a9 a4 a9 e0 a9 a4 a9 e0 20 20 a9
.  ..........      e0 20 20 a9 e0 a9 a4 a9 c8 0d 0a a9 a6 20 20 20
                   20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
   ..      .....   20 20 20 a9 a6 20 20 20 20 20 20 a9 a6 0d 0a a9
................   b8 a9 a4 a9 d8 a9 a4 a9 d8 a9 a4 a9 d8 a9 a4 a9
................   d8 a9 a4 a9 d8 a9 a4 a9 d8 a9 a4 a9 d8 a9 a4 a9
......[256D.[1;3   bc 0d 0a 0d 0a 1b 5b 32 35 36 44 1b 5b 31 3b 33
3m> .[2;37;0m..    33 6d 3e 20 1b 5b 32 3b 33 37 3b 30 6d ff f9

Top

Posted by Superdzl   (6 posts)  Bio
Date Reply #6 on Wed 08 Apr 2009 01:33 AM (UTC)
Message
I do as Nick Gammon says,the text attributes are:
letter:
text: White
Background: Red
Custom: n/a

RGB colour
text: #FFFFFF
Background: #800000

I make a trigger as follows
<triggers>
<trigger
back_colour="9"
enabled="y"
keep_evaluating="y"
match=".*"
match_back_colour="y"
match_text_colour="y"
regexp="y"
sequence="100"
text_colour="15"
>
<send>haha</send>
</trigger>
</triggers>
but it does not work.why?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #7 on Wed 08 Apr 2009 09:54 PM (UTC)
Message
In trying out your test data I find that the red square is not the first character in a line.

The help for "edit trigger" says:


The first character of the matching text is checked for the specified colour.


Thus it doesn't match (the first character is white on black).

See http://mushclient.com/faq point 33. There it discusses how you might check for the colour of each character.

In particular see this thread: http://mushclient.com/forum/?id=7818

What you would need to do, when you know you have the map line, is use the ideas discussed in that thread, and then check each character, to see if there is the correct colour combination in a particular part of the line.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Superdzl   (6 posts)  Bio
Date Reply #8 on Thu 09 Apr 2009 07:22 AM (UTC)
Message
Thanks for Nick Gammon's help!
I read the article you given. There's a fourth argument to a function called by a trigger. I try it in Jscript because I don't know Lua language, but failed. Is the fourth argument only supported by function in Lua?
Top

Posted by Superdzl   (6 posts)  Bio
Date Reply #9 on Thu 09 Apr 2009 07:22 AM (UTC)
Message
Thanks for Nick Gammon's help!
I read the article you given. There's a fourth argument to a function called by a trigger. I try it in Jscript because I don't know Lua language, but failed. Is the fourth argument only supported by function in Lua?
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #10 on Thu 09 Apr 2009 10:29 AM (UTC)

Amended on Thu 09 Apr 2009 10:30 AM (UTC) by Worstje

Message
Aye. The styles argument is only supported in Lua due to technical limitations in the Windows Script Host. I think there's a function GetLineStyleInfo() though.

Slight derail for Nick Gammon's eyes: I've suggested before to make the third parameter mandatory for plugins that have the version higher than whatever version introduces that.

Eg.. suppose this version were to be 4.50, then the trigger matching code would go like this for non-Lua scripts in versions 4.50 and above (pseudo code):

if trigger or alias matches then
  
  ...
  
  if script attached then
    if plugin_version >= 4.50 then
      CallScriptFunction(function, name, line, wildcards, styles)
    else
      -- old default behaviour
      CallScriptFunction(function, name, line, wildcards)
    end
  end
  
  ...
  
end


That way you could preserve and support old plugins until they are updated.
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.


33,835 views.

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

Go to topic:           Search the forum


[Go to top] top

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