noting in omitted send to script calls OnPluginScreendraw twice

Posted by Tspivey on Thu 20 Jan 2011 11:59 PM — 4 posts, 16,858 views.

Canada #0
Using this trigger, OnPluginScreendraw is called with two notes:

<triggers>
  <trigger
   enabled="y"
   match="test"
   omit_from_output="y"
   send_to="12"
   sequence="100"
  >
  <send>Note("note")</send>
  </trigger>
</triggers>


I was expecting OnPluginScreendraw to only be called with the one note. Sending to
script after omit, or using a script function with send to world works as expected.
Using MUSHclient 4.71.
Australia Forum Administrator #1
Testing that trigger for me only gives one speaking of the text, not two. Perhaps you have another trigger that also notes that particular line? Try enabling Trace mode (Ctrl+Alt+T) and seeing if more than one trigger matches.
Canada #2
I created a completely empty world, and put that trigger in it along with
a test plugin for OnPluginScreendraw with this function:

function OnPluginScreendraw(t, log, line)
AppendToNotepad("screendraw", t..":"..line.."\r\n")
end

When I use Debug simulated world input to trigger on the test line, I get the following in the notepad window:

1:note
1:note


The trace output (which doesn't seem very useful) shows:

TRACE: Trace onTRACE: Executing Plugin screendraw_test script
 "OnPluginScreendraw"
TRACE: Matched trigger "test"TRACE: Executing Plugin screendraw_test
 scriptTRACE: Executing Plugin screendraw_test script "OnPluginScreendraw"
 "OnPluginScreendraw"TRACE: Executing Plugin screendraw_test script
 "OnPluginScreendraw"
noteTRACE: Executing Plugin screendraw_test script "OnPluginScreendraw"TRACE:
 Executing Plugin screendraw_test script "OnPluginScreendraw"
TRACE: Trace offTRACE: Executing Plugin screendraw_test script
 "OnPluginScreendraw"
Australia Forum Administrator #3
OK, I can reproduce that, thanks.

This is a new side-effect of the new feature where note lines combined with "omit from output" are not omitted like they once were.

What is happening is:

  • You note the word "note"
  • OnPluginScreendraw is called which speaks the line
  • The line is omitted from output
  • As part of omitting the line, all notes and user input are saved in a special list
  • Output is now deleted from the start of the current output line to the end of the buffer
  • The special list is then traversed and the saved notes are put back by noting them to the output window
  • OnPluginScreendraw is called again because the line is noted again, which speaks the line a second time


I'm not sure there is a really easy way of fixing it. Probably you are best off using the known work-around, of using "script after omit" or a script function in the script file.