Trigger Trouble

Posted by Tsinghahla on Sun 17 Apr 2005 05:18 PM — 11 posts, 46,046 views.

Sweden #0
Hi,

I've stumbled upon a few problems trying to trigger certain things, one thing is that my prompt mess the trigger up.

If the text I want to trigger comes out like this;

H:233 M:340 E:1381 W:1600 <eb> You are taken by a sudden and overwhelming affection for Kanthari.


It will execute my alias, but it also works if I just say it out
You say," -trigger text-".


I've tried with regular expressions, but it is somewhat hard to comprehend.

What I want to do, is to have the triggers go off if they come on a new line or my prompt comes up in the same line, and not when I say it or
"someone tells you," -trigger text-".


Is there a way to do this?
Amended on Sun 17 Apr 2005 05:30 PM by Tsinghahla
USA #1
Well, Regexps are definately the way to go. However, if you wanted to have a completely regexp free method, you could have a bunch of triggers (for you say * or * tells you *) with low sequence (so they fire first) and then not have them keep evaluating.
Of course, this is unweildy and breaks under certain conditions (and makes it so you couldnt naturally match on tell/say lines, unless you change THAT sequence).

So the obvious way to go is a regexp.
You'll need to figure out the prompt regexp, and then include it in your trigger (to save against prompt changes, you could store it in a variable and then expand it in the trigger, that will allow you to change it in the future with only having to edit one thing, of course, your prompt might not be changable).
^H:\d+ M:\d+ E:\d+ W:d\+ will match the number parts on the beginning of a line. Does the eb change? I imagine it does. What are the possibilities?

And what are the triggers you already have for the lines?
Sweden #2
My prompt can and will change, (eb) is for Equilibrium and Balance, if I don't have balance, for example it will look like this (e-) and there can be more to it, (eb)dbp for example (deaf, blind,prone).

I tried just to have it going like this first;

* You are taken by a sudden and overwhelming affection for *.


But that would trigger anything before and after the actual line I want to trigger, of course it works. But it would mess up too much just to have it that way.

I looked at someones plugin for Aetolia/Achaean games,
where the man behind the plugin was using regexp, but I'm having some major problems just to understand it all.

^(.*?)You are taken by a sudden and overwhelming affection for \.$


The above code is simply a regexp that that author of the plugin was using a lot. I understant that the ^ will match the trigger if it -starts- with the text, but the prompt will mess that up. And, testing that a bunch of times, changing the regexp aswell has been somewhat useless, either it won't trigger at all, or it will trigger on everything before and after the actual text I want to trigger.

I'm reading the help files for regexp all the time, and trying to understand, but it's still hard.

Edit Start: Would it work if I had the trigger like this...

* You are taken by a sudden and overwhelming affection for$


So it would end at 'for'? Then it wouldn't care what text shows up before, but it won't work if anything shows up after 'for'? Or the $ would work so that is something comes up after 'for' it won't trigger at all?
...if that makes any sense..

Edit end.
Amended on Sun 17 Apr 2005 06:38 PM by Tsinghahla
USA #3
If you are playing an IRE game, then the affliction line showing up on the same line as the prompt is actually a small error. With v 3.66, you can select the world option interpret GA EOR (or something) as newline. THis will corectly place the affliction message on the next line, and let your triggers match it correctly.

Then the regexp you could use is for example:

^You are taken by a sudden and overwhelming affection for \w+\.$

I hope that helps.
Sweden #4
Thanks to both of you, it seems to work as it should now.
Sweden #5
I couldn't find that GA EOR setting, nor could I find v3.66 (only 3.65). Point me in the right direction, please?
USA #6
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=5423
is 3.66.

The front page version only gets updated sporatically (when we get all the bugs worked out), while other updates may be available. Those updates are only available through the forum (theory is, if you've found the forum, you'll come back if something doesn't work right and ask, rather than just thinking it's broken). And if you need to check for the newest updates, you can always check the 'news and updates' forum (since nick is the only one who can post there, you won't have to weed through help posts, etc).
Sweden #7
Now it works, to some extent. Only problem is that MC seems to add an extra linefeed, making it all ~50% extra spammy. Is there any option/fixes for this? What I want is the emulation to be like zMUD (bear with me, I'm pondering a switch after nine years) which only adds one linebreak.

---- MUSHclient currently ----
H:315 M:206 E:1479 W:1102 <eb> 

The sun climbs to its apex, scattering darkness, illuminating the land with its
holy light.
H:315 M:206 E:1479 W:1102 <eb> 

The bright sun shines down upon you.
H:315 M:206 E:1479 W:1102 <eb>
USA #8
You can set up a trigger to match on the empty line, and omit it. Depending on what's sent, you'll either match on (as a regexp) ^$ or ^ $ (the second one is if the line contains a space). If it is the former, You'll need to let the regexp match on an empty line (in global preferences, check the box).
Sweden #9
Ahh, good thinking. But when I tried it out.. Didn't work. This is what I have so far:
<triggers>
  <trigger
   enabled="y"
   match="^ $"
   omit_from_log="y"
   omit_from_output="y"
   regexp="y"
   sequence="100"
  >
  </trigger>
  <trigger
   enabled="y"
   match="^$"
   omit_from_log="y"
   omit_from_output="y"
   regexp="y"
   sequence="100"
  >
  </trigger>
</triggers>


EDIT: Missed the part with the global config, sorry. It's working great now. Thanks alot!
Amended on Sat 23 Apr 2005 08:05 AM by tobiassjosten
USA #10
No, the omit is it. Your trigger must not be matching. Did you enable 'match on empty line' in global preferences?

And, one or the other will work, you can delete the extra one (whichever it may be for your server).

Edit: Aye, the one with the space can be deleted (most likely) then (since it would have matched without the global change if the line had a space), if you find you need it, add it in later, I doubt you will though.
It can only cause (potential) conflicts later and by that time, you'll have forgotten about this trigger.