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 ➜ Triggers on channels

Triggers on channels

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


Posted by Iris Bosmans   (2 posts)  Bio
Date Wed 23 Jul 2003 04:22 PM (UTC)
Message
Hello,

I've been trying and trying to get triggers to work on channels. The trigger should react on the following (made up silly example with eclair)

(Eclairs): Magenta says, "Eclair."

which should trigger me into sending an eclair (in this case). It doesn't help if I use "regular expression" either.

It does work with * tells you, "Eclair." and then send %1 eclair, but not with the channels. It seems the trigger can't get around the channel name or something.

If there is anyone who knows how to get this to work, I'd be very happy :)

Thanks in advance,

Iris
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Wed 23 Jul 2003 08:52 PM (UTC)
Message
Can you please paste the exact trigger you are using?

- Nick Gammon

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

Posted by Shadowfyr   USA  (1,792 posts)  Bio
Date Reply #2 on Wed 23 Jul 2003 09:19 PM (UTC)

Amended on Wed 23 Jul 2003 09:22 PM (UTC) by Shadowfyr

Message
You can do something like:

^\(Eclairs|Donuts\)\: (\w+) says, (.*)

Note, this is for multiple channels, in this case it will match on a channel named Eclairs, but also on one called Donuts. I am not entirely certain what you are actually trying to do, but this would give you the name of the person in %1 and the thing they said in %2. Channels can get complicated, but ironically, you are probably better off in this case than with most muds. Why? Because of those "". ;)

When a mud auto-wraps channels, it is hard to tell when the final line appears. I have a complex set of about 2-3 triggers to test for case where things should be turned off, but with that final " available you can do something like:
<triggers>
  <trigger
   custom_colour="1"
   enabled="y"
   keep_evaluating="y"
   name="StartEclairCap"
   regexp="y"
   match = "^\(Eclairs\)\: (\w+) says, (.*)"
   sendto = "script"
   sequence="100"
   other_text_colour="black"
   other_back_colour="black"
   <send>
    enabletrigger "ColorCapture",1
   </send>
  >
  </trigger>
</triggers>

<triggers>
  <trigger
   custom_colour="1"
   enabled="y"
   group="channels"
   keep_evaluating="y"
   match = "^.*$"
   sequence="100"
   other_text_colour="black"
   other_back_colour="black"
  </trigger>
</triggers>

<triggers>
  <trigger
   enabled="y"
   keep_evaluating="y"
   name="ColorCapture"
   regexp="y"
   match = "^.*&quot;"
   sequence="101"
   other_text_colour="black"
   other_back_colour="black"
  >
  </trigger>
</triggers>

This would in effect capture the first line and color it, then turn on the second trigger. That trigger would match on 'all' lines that follow, also coloring them. The third and final trigger colors the last line, but having found a " at the end, it turns off the trigger that captures all lines. This way everything in a channel message is colored, but stuff arriving before and after are left alone. The same can be used to redirect the lines to someplace else, etc. Like I said, you are lucky. My mud doesn't place "" around things, so I need a much more complex system to do the same thing on my mud. :(

To use this trick to color different channels different colors you need to call a real script and add some additional code to the first triggers effects:
<triggers>
  <trigger
   custom_colour="1"
   enabled="y"
   keep_evaluating="y"
   name="StartEclairCap"
   regexp="y"
   match="^\(Eclairs\)\: (\w+) says, (.*)"
   script="setcolorcapture"
   sequence="100"
   other_text_colour="black"
   other_back_colour="black"
  >
  </trigger>
</triggers>

setcolorcapture (trigname, output, wildcards)
  enabletrigger "ColorCapture",1
  SetTriggerOption "ColorCapture", "custom_colour", gettriggeroption(trigname, "custom_colour")
  settriggeroption "ColorCapture", "other_text_colour", gettriggeroption(trigname, "other_text_colour")
  settriggeroption "ColorCapture", "other_back_colour", gettriggeroption(trigname, "other_back_colour")
end sub

This will take the custom color and extended colors defined by selecting "Other" in the custom color list and automatically set the capture trigger to use that same colors. ;) Then all you do is make a special trigger like the one above for each channel you want to capture, set the colors you want it to use and have it call the setcolorcapture script. ;)
Top

Posted by Iris Bosmans   (2 posts)  Bio
Date Reply #3 on Thu 24 Jul 2003 09:34 AM (UTC)
Message
First of all, thanks for all the help :) I finally managed to get it to work using something very simple (which my sis found after some trial and error). I was always trying with ^ and \ in all sorts of combinations, but apparently

(*): * says, "Gate."
send gate %2

works perfectly... Guess I should have thought of that myself... Anywayz, thanks again, and next time I'll be sure to try the simple things before running to the cavalry :)

Greetz,

Iris



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.


14,234 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.