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
➜ General
➜ Send to script after omit
Send to script after omit
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Myrk
(7 posts) Bio
|
Date
| Mon 28 Jul 2014 04:28 AM (UTC) |
Message
| Hi,
Is there a way to detect if the line was omitted (by a different trigger) in a send to script after omit trigger?
Thanks :) | Top |
|
Posted by
| Nick Gammon
Australia (23,162 posts) Bio
Forum Administrator |
Date
| Reply #1 on Mon 28 Jul 2014 04:48 AM (UTC) |
Message
| Providing the other trigger(s) haven't added to the output buffer this should work:
- Find what the trigger matched on
- Find what the last line in the output buffer is
If they are not the same, we presume that line was omitted.
Example:
<triggers>
<trigger
enabled="y"
match="Exits: *"
name="myname"
omit_from_output="y"
send_to="14"
sequence="100"
>
<send>
matched = GetTriggerInfo ("myname", 32) -- what we matched on
lastLine = GetLineInfo (GetLinesInBufferCount (), 1) -- last line in buffer
if matched ~= lastLine then
print "Last line was omitted"
end -- if
</send>
</trigger>
</triggers>
 |
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.
|
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Myrk
(7 posts) Bio
|
Date
| Reply #2 on Mon 28 Jul 2014 04:53 AM (UTC) |
Message
| Great idea, thanks for the fast reply :) | Top |
|
Posted by
| Nick Gammon
Australia (23,162 posts) Bio
Forum Administrator |
Date
| Reply #3 on Mon 28 Jul 2014 08:38 PM (UTC) |
Message
| My reply may not work for long lines (ones that wrap) as the last line in the output buffer is a single line after wrapping. So for example if the output was two lines long the last line will be the second one. You can work around that by finding where the previous line ends and then working forwards. However for short lines my solution should be OK. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | 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.
14,663 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top