Trigger Passing On Text it reads

Posted by Savitar on Sat 18 Feb 2006 06:10 AM — 2 posts, 11,560 views.

#0
I'm not accustomed to scripting, or let's be honest I've got no real clue where to start. I'm just looking for some help setting up a Trigger and would be eternally grateful. Basically I want to be able to create a Trigger (under World Configuration -> Appearance -> Triggers of course) that when it receives something like:
(This is the literal way the line would show up.)
[Radio: (C) Broadband] Savitar says, "Yadda."

It sends back the parts inside the brackets as one colour and everything else as another colour.

Is this possible?


A second perhaps simpler question is, how do I perhaps match just the first part in Brackets to one colour, then have it use the 'Send' area of Triggers to send the rest. Is there some type of registrar code (for instance as PennMUSH has of %q1 or the standard %0) that would send everything else after a matched area?]

Thanks very much for any assistance anyone can offer.
Australia Forum Administrator #1
It isn't totally clear which parts of your example can vary:


[Radio: (C) Broadband] Savitar says, "Yadda."


However assuming that the name of the person, and what they say, are what vary, you could match on this:

Match: [Radio: (C) Broadband] * says, "*"

Then inside your "send" box the name (Savitar in this case) becomes %1 and what he says ("Yadda.") becomes %2.

To partially colour a line, you need a regular expression. This trigger would colour the stuff inside the brackets (and the brackets):


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   match="^\[Radio\: \(C\) Broadband\]"
   regexp="y"
   sequence="100"
  >
  </trigger>
</triggers>