"Omit from output" omits output from script

Posted by Faux on Sat 15 Jan 2005 12:25 PM — 6 posts, 28,159 views.

United Kingdom #0
Please don't say "DUH!".. :p

I effectively want to re-write lines as they come in from the mud.

With "Omit from output", using Send-to-output (ie.
<triggers>
  <trigger
   enabled="y"
   match="^([A-Za-z]+ wisps.*)$"
   omit_from_output="y"
   regexp="y"
   send_to="2"
   sequence="100"
  >
  <send>(One) %1</send>
  </trigger>
</triggers>

) works nicely, but using send-to-script (ie.

<triggers>
  <trigger
   enabled="y"
   omit_from_output="y"
   match="^Hp: ([-0-9]+)\(([-0-9]+)\)  Gp: ([-0-9]+)\(([-0-9]+)\)  Xp: ([-0-9]+)"
   regexp="y"
   send_to="12"
   sequence="96"
  >
  <send>
function numtobar(p,w)
 p=string.format("%i",p/10)
 r=string.rep("#",p)
 r=r..string.rep("-",w-p)
 return r
end

a=GetVariable("nextlev")


ss = "Hp: [" .. numtobar((%1/%2)*100,10) .. "]  Gp: [" .. numtobar((%3/%4)*100,10) .. "]  "

if (a ~= nil) then
 ss=ss .. "Xp: [" .. numtobar((%5/GetVariable("nextlev"))*100,20) .. "]"
else
 ss=ss .. "Xp: %5"
end
Note(ss)</send>
  </trigger>
</triggers>
(note that the only important line in that is the "Note (ss)" bit)) produces no output.


Bug, or am I missing something?
Amended on Sat 15 Jan 2005 12:26 PM by Faux
Russia #1
That's an old thing. Nick said that it's not really a bug, though I still don't see why omitting the matched line from output should result in your own text or script being omitted as well. Especially if it's still possible to send from a gagging trigger, just not to script.

And while I am at it, the thingy with script execution order, where if a trigger is set to keep evaluating and sends to script, the script will be executed only after all triggers finish matching on the line, also doesn't make too much sense. Perhaps it would be possible to change these two? Personally I've never seen those types of behavior be useful, while they often complicate things. For example, I prefer to use class instances in my scripts, instead of functions, and the only way to call those is through the "Send to script" option, but the behavior of "keep evaluating" and omitting triggers in relation to immediate scripting breaks the otherwise flawless and uniform scheme, necessitating special care to be taken whenever you want to gag something or cram a trigger into an existing sequence without disrupting it.
USA #2
You can put it in a script file (and call via a script routine).

http://www.gammon.com.au/forum/?bbsubject_id=4161
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4832

United Kingdom #3
Oops, sorry Flannel. I did search, but apparently..

And, to quote Nick, "..known feature.." means it isn't going to be (can't be) fixed?


I prefer to put everything in a trigger if the code isn't going to be duplicated.. it makes sending it to other people a hell of a lot easier (no matter how easy the plugin wizard is it isn't going to get under 1 click at my end and 1 at their's).

Sorry for duplicating the old threads, btw.
Australia Forum Administrator #4
It is hard to fix, so probably not for a while.
USA #5
I wasnt implying you werent searching, it just saves me time retyping regurgitated information (just the details of why it doesnt work, etc) and makes it less likely that I'd miss something.

But yeah, putting it in a script file will work for now, especially if it's going to be in a plugin. Well, assuming you designed it to be in a plugin, you'd do other things differently anyway.