Adding triggers from an alias

Posted by Satu on Sun 04 May 2003 01:56 PM — 6 posts, 19,260 views.

United Kingdom #0
Hi,

I'm trying to write an alias that creates a colour trigger, but I seem to be utterly hopeless at it.
Could anyone suggest how to go about this?

It's for adding pk highlights (cos I'm lazy), so ideally all I'd have to type is "addthief <name>" and it would create a trigger on that name. I've tried mucking about with AddTrigger, but I can't even get that working on its own. =)

Any help please?

Thanks,
Satu

Australia Forum Administrator #1
This should do it ...


<aliases>
  <alias
   match="addthief *"
   enabled="y"
   echo_alias="y"
   send_to="12"
   sequence="100"
  >
  <send>AddTrigger "", "%1", "", 1 + 8 + 32, 1, 0, "", ""</send>
  </alias>
</aliases>



It adds a regular expression trigger that matches the word you specify, and colours it in custom colour 2.
Amended on Sun 04 May 2003 11:30 PM by Nick Gammon
United Kingdom #2
Wonderful, thank you. =)

One more question, is there an option to add the trigger to a group using AddTrigger?
Australia Forum Administrator #3
You would have to do it a bit differently. You cannot directly do it, so you would need to give the trigger a label, and then change the group using SetTriggerOption. The most reliable way would be this, although you end up with triggers with long labels...


<aliases>
  <alias
   match="addthief *"
   enabled="y"
   echo_alias="y"
   send_to="12"
   sequence="100"
  >
  <send>tname = "T" &amp; GetUniqueID
AddTrigger tname, "%1", "", 1 + 8 + 32, 1, 0, "", ""
SetTriggerOption tname, "group", "thieves"</send>
  </alias>
</aliases>

Greece #4
Nice suggestion here, make the AddTrigger function accept an argument that specifies the group you want the trigger to belong to.
Australia Forum Administrator #5
The problem is that COM objects are supposed to have well-defined argument lists, that don't change once published. Also, they don't have optional arguments, AFAIK.

Now that I have the routines SetTriggerOption (and ImportXML) I don't plan to keep upgrading the original AddTrigger (and AddTriggerEx) with yet another version, which will itself be out-of-date when yet another trigger option is added.