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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Suggestions
. . -> [Subject]  Triggers

Triggers

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


Posted by Matthias   (28 posts)  [Biography] bio
Date Wed 06 Aug 2003 02:19 PM (UTC)

Amended on Wed 06 Aug 2003 04:45 PM (UTC) by Matthias

Message
I think there should be an option to disable that feature that only checks triggers when the linefeed is received. This is because the word wrapping usually changes the lines.
For example, let's say I have a trigger: "* punches you with a large force." and I reply with "punch %1.".
Well, sometimes the line is like:
Bob punches you with a large force.
But other times it is like:
Methuselah punches you with a
large force.
To avoid this sort of thing, I shortened the triiger to "* punches you", but it doesn't work, because of the linefeed thing, so it makes sense to be able to disable that/remove it entirely.

I also think that triggers should be able to check for matches on one or more lines, like how they send one more more lines. For example, checking for:
You are:
Desperatly in love with Kitt

and respond with
outr bellwort
eat bellwort

Give a man a fire and you warm him for a day.
Set a man on fire and you warm him for the rest of his life.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Wed 06 Aug 2003 08:18 PM (UTC)

Amended on Wed 06 Aug 2003 08:19 PM (UTC) by Nick Gammon

Message

For lengthy discussions on this subject, see: question with multiple line triggers, trigger that match more then one line, Multiple line triggers and Matching on multiple lines.

That should get you started.


- Nick Gammon

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

Posted by Shadowfyr   USA  (1,786 posts)  [Biography] bio
Date Reply #2 on Wed 06 Aug 2003 08:27 PM (UTC)
Message
First off, you should use:

* punches you *

or a regular expression like:

^/w+ punches you

Which as long as you don't add $ to specify (end of line) will match anyway. It is also safer, since yours could match on:

Fred says: Methuselah punches you

Which is almost certainly not what you wanted. ;)

As to why no partial lines can be matched, as Nick has often explained, the design of the trigger system needs to know if the full line has arrived 'before' it can be 100% certain that a match has happened. Making it match on partial lines without a newline would require something sneaky to work right and may slow down the client slightly. Basically what happens now is this:

Packet> <Hello t>
Packet> <here!{Newline}>
Test> Hello - Match
Test> Hello fred! - Fail
Test> Hello there! - Match
Test> Go away! - Fail

To do what you want it would need to do:

Packet> <Hello t>
Test> all triggers, "Hello" matches.
Packet> <here!{newline}>
Test> all triggers, "Hello there!" matches.

This is possible, but requires testing at the arrival of every single data packet, not just when the newline arrives and you are 100% certain it is a complete line. The problem is when using "Omit From Output". When that is selected the client would have to automatically assume that you want the current behavior and only act on a complete line. Other things like scripts and such would then also 'require' the use of regular expressions that end with $ or a normal trigger that "doesn't" end with a * in order to work right in some existing cases where the complete line is needed. However, a new flag that specifies that the trigger should match a partial would fix that, since by default the triggers would work as they do now.

All in all, I am not sure how much retesting after the arrival of every new packet would slow stuff down. You can work around it currently if you design your trigger right though and the only 'major' issue is with coloring lines when there is lag. However, this would if introduced allow something that could do:

Match = "HP: 100/5000"
Send = "HP: Critical"
CustomColour = "Other"
OtherForeColor = "Red"
Regex = "y"
Sendto = "Replace"

Which is currently impossible, however it would mean that the contents would not be displayed until 'after' the triggers had all been run, while right now the line gets shown, then all the coloring and trigger stuff is done to it. This presents a slight mess, since in essence you would need to show each partial line as it arrived, but still have the client prepared to omit, color, or replace parts of or the entire line depending on what cropped up before the actual newline. And of course having the feature means it being used when better solutions exist,such as in your case, where a better match was needed, not a sloppier one. ;)
[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.


10,358 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at HostDash]