Trigger Isolation

Posted by Trunks_Zero on Wed 27 Aug 2003 10:52 PM — 10 posts, 30,226 views.

#0
Hey... Just me again :p

I was just wondering... How, in a trigger, would you set it to only isolate part of the line that needs to be matched?

For example:

People set their gossip colours to stupid things, and it gets annoying, and distracting. I want to set it so no matter who gossips in what colour, it'll turn out to be dark purple (the base gossip colour). The line would appear as follows:

Baron Billybob gossips 'haha I use stupid colours'

I currently have the trigger set to:

* gossips '*'

But, I'm not very good with triggers or anything, so it turns the entire phrase purple, even the name, when all I want is the gossip'd phrase, inside '' those.

So if anyone could help me, would be greatly appreciated.
Australia Forum Administrator #1
One approach is just to redo the colours on the line, like this (you can copy and paste this into MUSHclient) ...


<triggers>
  <trigger
   enabled="y"
   match="* gossips '*'"
   send_to="12"
   sequence="100"
 >
  <send>ColourTell "white", "black", "%1 gossips "
ColourNote "purple", "black", "'%2'"</send>
  </trigger>
</triggers>


You can rejig the colours (eg. if your background colour is not black, change "black" above to what it is).
#2
Sorry for bothering... But I don't suppose you could give a bit of a step-by-step thing to that, could you? :/
Greece #3
copy everything from <triggers> to </triggers>, go to the mushclient triggers window, and press the paste button :p
#4
Yea... sorry. I figured that out after ripping about 1000 hairs out of my head... *smirk*

Anyways, that doesn't quite work... it ends up something like this:

Baron Billybob gossips ' I still use stupid colours'

and then, directly after that, it returns:

Baron Billybob gossips ' I still use stupid colours'

Only with the modifyed colouring.

Baron Billybob gossips ' I still use stupid colours'
Baron Billybob gossips ' I still use stupid colours'

Like that, only two different colours. :p

And, it changes the colour of the ' things as well
Australia Forum Administrator #5
To fix the doubling-up problem, check the "omit from output" box for the trigger.

If you don't want the quotes coloured, you'll need to replace the send text with these 3 lines:

ColourTell "white", "black", "%1 gossips '"
ColourTell "purple", "black", "%2"
ColourNote "white", "black", "'"


What that does is put the quotes into the white-on-black part.
USA #6
There is another solution. Try:
<triggers>
  <trigger
   custom_colour="17"
   enabled="y"
   keep_evaluating="y"
   regexp="y"
   match="^/w+ gossips '.*'"
   send_to="12"
   sequence="100"
   other_text_colour="purple"
   other_back_colour="black"
 >
  </trigger>
</triggers>

<triggers>
  <trigger
   custom_colour="17"
   enabled="y"
   keep_evaluating="y"
   regexp="y"
   match="^/w+ gossips "
   send_to="12"
   sequence="101"
   other_text_colour="white"
   other_back_colour="black"
 >
  </trigger>
</triggers>

This should capture the full line, change it to purple, then recapture just the start of the line and change that to white. The key is the keep_evaluating and sequence settings. ;)
#7
Omitting from output cancelled any return at all, neither the original message, nor the corrected message appeared.

And, the second suggestion, (Shadowfyr's), didn't seem to work at all... I tried tweaking it some, but couldn't get it to correct...
USA #8
You could try using .* instead of /w+. I used it because it is more specific, but it could cause a problem if the line isn't what I was thinking it should be.
Australia Forum Administrator #9
OK, there is a problem in MUSHclient that if you omit from output it also omits things that you have done as part of the trigger. However, doing it in the script file works. So do this instead ...

Have this as the trigger:


<triggers>
  <trigger
   enabled="y"
   match="* gossips '*'"
   omit_from_output="y"
   script="gossip"
   sequence="100"
>
  </trigger>
</triggers>


And put this into a separate file, and make this file the script file used in the script configuration tab. Make sure you turn scripting on ...


sub gossip (name, line, wildcards)
  ColourTell "white", "black", wildcards (1) & " gossips '"
  ColourTell "purple", "black", wildcards (2)
  ColourNote "white", "black", "'"
end sub