Gagging lines with a script.

Posted by Batista on Sun 30 Apr 2006 01:32 PM — 2 posts, 13,426 views.

#0
Greetings,

Is there a way to gag a line that is also a trigger in certain situations? I'll give an example.

The line 'Hmmmm. Why must everything be so difficult to figure out?' is a trigger I have that sets the Stupidity variable to 1.

Whenever I get 'Hmmmm. Why must everything be so difficult to figure out?' by itself, I want it to appear as normal. However, when I get it followed by the Doubleslash message, I want it to gag that line but still set the Stupidity variable to 1.

This is the way it is now:
===============================
3500h, 3500m, 16400e, 16400w cexdb-
Hmmmm. Why must everything be so difficult to figure out?
3500h, 3500m, 16400e, 16400w cexdb-

3500h, 3500m, 16400e, 16400w cexdb-
Lightning-quick, Batista jabs you with a rapier.
Hmmmm. Why must everything be so difficult to figure out?
Lightning-quick, Batista jabs you with a rapier.
Hmmmm. Why must everything be so difficult to figure out?
3500h, 3500m, 16400e, 16400w cexdb-
===============================


This is the way I want it to be:
===============================
3500h, 3500m, 16400e, 16400w cexdb-
Hmmmm. Why must everything be so difficult to figure out?
3500h, 3500m, 16400e, 16400w cexdb-

3500h, 3500m, 16400e, 16400w cexdb-
Lightning-quick, Batista jabs you with a rapier.
Lightning-quick, Batista jabs you with a rapier.
3500h, 3500m, 16400e, 16400w cexdb-
===============================

Any ideas? I'd rather not have three sets of triggers to make this work, heh. Is there some sort of function I can use for this?

Thanks in advance for the help!

EDIT: Oh, and by gagging I mean is there a way I can retroactively check and uncheck 'omit from output' from a trigger?
Amended on Sun 30 Apr 2006 01:50 PM by Batista
#1
Short answer: No, not the way you want it to.

EDIT: Expanded why not: You can't gag multiline triggers, nor can you go back and remove lines once they've been drawn. That is by design.

Long answer: Here's how I would do it.

I'd have two triggers for the stupidity message. One always on at priority 90 or so, and one disabled by default at priority 100. I'd have the 90 one enable your stupidity affliction variable, and 100 gag the line.

DSL line would enable the 100 trigger, prompt would disable it.


<triggers>
  <trigger
   enabled="y"
   keep_evaluating="y"
   match="^Hmmmm\. Why must everything be so difficult to figure out\?$"
   regexp="y"
   send_to="9"
   sequence="90"
   variable="Stupidity"
  >
  <send>1</send>
  </trigger>
  <trigger
   enabled="y"
   group="DSL"
   match="Lightning-quick, * you with *."
   send_to="12"
   sequence="100"
  >
  <send>EnableTriggerGroup("gag_stupid")</send>
  </trigger>
  <trigger
   group="gag_stupid"
   match="*h, *m, *e, *w*-"
   send_to="12"
   sequence="100"
  >
  <send>EnableTriggerGroup("gag_stupid", false)</send>
  </trigger>
  <trigger
   group="gag_stupid"
   match="^Hmmmm\. Why must everything be so difficult to figure out\?$"
   omit_from_output="y"
   regexp="y"
   sequence="100"
  >
  </trigger>
</triggers>


=============================================

EDIT 2: Alternatively (I just thought of this) you can run a subroutine that looks something like this (not promising this code is correct):


function stupidity_gag ()
  if (GetVariable("DSL") == 0) then ColourNote("gray", "black", "Hmmmm. Why must everything be so difficult to figure out?") end
  SetVariable("Stupidity", 1)
end


And have the DSL trigger set DSL to 1, prompt set it to 0, and have the stupidity line gag from output, and just call this function.