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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  Mapper Woes 2: Electric Boogaloo (Xterm colours in triggers)

Mapper Woes 2: Electric Boogaloo (Xterm colours in triggers)

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


Posted by Xolorion   (2 posts)  [Biography] bio
Date Tue 20 Jul 2021 07:40 AM (UTC)
Message
I have been using the mapper plugin written for TI:Legacy in this thread: https://www.gammon.com.au/forum/bbshowpost.php?id=14139

It's wonderful and writing it for us was a great kindness. It works great right up until you enable xterm colours ingame. I quite enjoy xterm colours, so I took it upon myself to try to update the plugin to be compatible.

I've worked out that the problem lies with the "got_room_name" trigger not being triggered due to the text_colour flag. The trigger fires fine when text_colour is removed - unfortunately, its colour is the only identifying factor available to me when it comes to room names.


<trigger
   enabled="y"
   match="^([^[].*)$"
   match_text_colour="y"
   script="got_room_name"
   text_colour="9"
   keep_evaluating="y"
   sequence="90"
   regexp="y"
   name="room_name"
  >
  </trigger>


So is it possible to match triggers to colours with xterm enabled? I'm having trouble finding documentation on the topic.
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #1 on Tue 20 Jul 2021 05:50 PM (UTC)

Amended on Tue 20 Jul 2021 05:58 PM (UTC) by Fiendish

Message
Unless MUSHclient is changed to accept values higher than 15 for the match color, you may have to instead have it match any color and then do the color check in the got_room_name function on the incoming styles table.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (22,989 posts)  [Biography] bio   Forum Administrator
Date Reply #2 on Wed 21 Jul 2021 04:54 AM (UTC)
Message
Exactly. Something like:


function got_room_name (name, line, wildcards, styles)
  
  if styles [1].textcolour ~= ColourNameToRGB ("#ff0000") then
    return
  end -- if not the right colour

  -- usual processing here

end -- got_room_name


And then don't match on the colour in the trigger itself.

Of course you need to work out the RGB code for the xterm colour of the room name, but that should be easy enough.

Select an example room name (the first part, which is the colour you are testing on) and then go to Display Menu -> Text Attributes.

In the middle of that dialog box is the exact HTML colour code you need to copy/paste into the script.

- Nick Gammon

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

Posted by Xolorion   (2 posts)  [Biography] bio
Date Reply #3 on Wed 21 Jul 2021 07:00 AM (UTC)
Message
Special thanks!

I was able to make the changes as you outlined. It seems to work regardless of whether xterm is enabled ingame or not. In case anyone else has the same curiosity or is trying to find this version of the plugin, my code is on pastebin at https://pastebin.com/0LKM6D9a
[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.


9,584 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 HostDash]