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

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Adding triggers from an alias

Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

Adding triggers from an alias

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page


Posted by Satu   United Kingdom  (2 posts)  [Biography] bio
Date Sun 04 May 2003 01:56 PM (UTC)  quote  ]
Message
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

[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sun 04 May 2003 11:28 PM (UTC)  quote  ]

Amended on Sun 04 May 2003 11:30 PM (UTC) by Nick Gammon

Message
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.

- Nick Gammon

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

Posted by Satu   United Kingdom  (2 posts)  [Biography] bio
Date Reply #2 on Sun 04 May 2003 11:42 PM (UTC)  quote  ]
Message
Wonderful, thank you. =)

One more question, is there an option to add the trigger to a group using AddTrigger?
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Mon 05 May 2003 02:15 AM (UTC)  quote  ]
Message
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>


- Nick Gammon

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

Posted by Poromenos   Greece  (1,037 posts)  [Biography] bio
Date Reply #4 on Mon 05 May 2003 07:26 AM (UTC)  quote  ]
Message
Nice suggestion here, make the AddTrigger function accept an argument that specifies the group you want the trigger to belong to.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
[Go to top] top

Posted by Nick Gammon   Australia  (18,772 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Mon 05 May 2003 08:00 AM (UTC)  quote  ]
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[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.


1,327 views.

[Reply to this subject]  Reply to this subject   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Internet Contents Rating Association (ICRA) - 2K]    [Web site powered by FutureQuest.Net]