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
➜ Suggestions
➜ Triggers
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Matthias
(28 posts) 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. | Top |
|
Posted by
| Nick Gammon
Australia (23,140 posts) 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
| |
Posted by
| Shadowfyr
USA (1,791 posts) 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. ;) | 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.
11,991 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top