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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  Getting the currently-executing trigger/alias/timer

Getting the currently-executing trigger/alias/timer

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


Pages: 1  2 

Posted by Twisol   USA  (2,257 posts)  [Biography] bio
Date Reply #15 on Wed 14 Jul 2010 06:29 AM (UTC)

Amended on Wed 14 Jul 2010 06:30 AM (UTC) by Twisol

Message
WillFa said:
highlight("pie", "red", "green")


Why would a user set up a trigger to match pie, choose the UI settings, and then add scripting to do the same thing? Do this in the script file, sure, then you can addxml the whole trigger yourself.

They don't. Yes, if you want to highlight "pie" anywhere you'd just use a dedicated trigger, but it's often the case that you want to highlight items only in specific lines, or multiple times within the same line, or color things only under specific circumstances. Using this library, you can do all these thing from a single trigger, which is logically where it belongs.

WillFa said:
Or a user can use the UI...


<triggers>
  <trigger
   custom_colour="14"
   enabled="y"
   keep_evaluating="y"
   match="Twisol"
   regexp="y"
   sequence="100"
  >
  </trigger>
  <trigger
   custom_colour="3"
   enabled="y"
   keep_evaluating="y"
   match="tell"
   regexp="y"
   sequence="100"
  >
  </trigger>
</triggers>

The UI only allows highlighting of the entire matched contents, which can make it more complex than it should be to color specific parts. The Achaea user, as I said, was demonstrating a method using ColourTell to re-colour part of a matched line by gagging and re-echoing, which is both cumbersome and error-prone when two triggers do it to the same line. My way keeps the highlighting of a given line within the trigger that matches it, and two such triggers can cooperate, because the later styles are "painted" on top of the previous ones.

WillFa said:
Are you reinventing the wheel or something?

No.

WillFa said:
A regular expression of an unanchored literal will only color the literal (not the whole line).
Keep Evaluating will allow multiple highlight triggers to color (fragments of) the same line.
You can pick colors, bold, italic, underline etc right in the gui...

You can AddXML a trigger in scripting...

Quite. This is all how it works internally, except they're also one-shot so they don't apply themselves to later lines, effectively removing themselves immediately. (I'm also using my reflex.lua library so the heavy-lifting of the XML is done for me.)

Everything about this experimental library is totally possible without it. The point is that it makes it easier and clearer to do the task it's designed for. That's why I wrote Reflex, and PPI, and devised my structured-plugin paradigm. When you're highlighting part of a specific line, you really don't care to deal with the conceptual overhead of an extra trigger (or more) to deal with the highlighting, and there's always the possibility that it won't even match and deactivate itself, leaving you to handle that somehow yourself.

It's even entirely possible without this particular suggestion, as I've noted. But this would make it a bit cleaner, because everything you pass will be directly related to highlighting.

'Soludra' on Achaea

Blog: http://jonathan.com/
GitHub: http://github.com/Twisol
[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.


38,547 views.

This is page 2, subject is 2 pages long:  [Previous page]  1  2 

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]