Can triggers fire off MUSHclient output?

Posted by Terrori on Fri 26 Jun 2020 07:49 AM — 4 posts, 19,427 views.

#0
All my triggers at the moment fire off what the MUD tells me, e.g. losing concentration, a mob dying etc etc. Is it possible to also trigger off MUSHclient output?

An example would be for the speedwalk plugin where at the end, it says "Speedwalk completed." but I can't figure out if it's possible to trigger off these kinds of output. For all intensive purposes, this output seems to be invisible.

Thank you very much for any suggestions.
USA Global Moderator #1
Quote:
Is it possible to also trigger off MUSHclient output?

Yes, but only if you use Simulate to produce that output.

Quote:
For all intensive purposes

You mean "intents and purposes".
Amended on Fri 26 Jun 2020 12:31 PM by Fiendish
Australia Forum Administrator #2
You could conceivably use the OnPluginScreendraw callback inside a plugin. There is an example below.

If you are not using this function elsewhere (eg. in a screen reader) then this should work:



<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>

<muclient>
<plugin
   name="OnPluginScreendraw_test"
   author="Nick Gammon"
   id="2769a929215da74418b0bfc4"
   language="Lua"
   purpose="tests OnPluginScreendraw"
   date_written="2020-06-27 09:11:00"
   requires="4.72"
   version="1.0"
   >

</plugin>

<!--  Script  -->

<script>
<![CDATA[
function OnPluginScreendraw(t, log, line)
  if t == 1 and line == "Speedwalk completed." then
    print "We detected the Speedwalk completed message"
  end -- if
end

]]>
</script>


</muclient>



It detects a "note" line (type 1) and checks for the message you are interested in, and then you could act on seeing that message.


http://www.gammon.com.au/scripts/doc.php?general=plugin_callbacks
Australia Forum Administrator #3
Terrori said:

...

Is it possible to also trigger off MUSHclient output?

An example would be for the speedwalk plugin where at the end, it says "Speedwalk completed." but I can't figure out if it's possible to trigger off these kinds of output.

...


Strictly speaking, that is not "output". The word output suggests it is going somewhere (like to the MUD). Messages like "Speedwalk completed." are really "note" messages, that is, they are notes on your screen which are neither received from the MUD, nor typed by you.

The two main things MUSHclient provides for you are:

  1. Triggers - which can react to messages from the MUD
  2. Aliases - which can react to things you type


Note messages are intended just to help you know what is going on, in this case that a speedwalk has completed.

You could conceivably amend the speedwalk plugin to do a BroadcastPlugin function call - that would notify other plugins that something had happened (like a speedwalk ending).

Or you could do an "Execute" call, which could then be picked up by an alias - since the Execute calls are sent to the command processor.

http://www.gammon.com.au/scripts/doc.php?function=BroadcastPlugin

http://www.gammon.com.au/scripts/doc.php?function=Execute