StopEvaluatingTriggers function

Posted by Redryn on Sat 06 Dec 2014 02:14 PM — 8 posts, 30,580 views.

#0
I've been trying to use the function:
StopEvaluatingTriggers (true) in a plugin, but it doesn't seem to be doing anything.

I have plugin A which triggers on a certain line, omitting it from output and then using Simulate to recreate it again.

I have plugin B which also triggers on that line.

Currently, plugin B fires twice, once on the omitted line, and again on the Simulated line. I'm trying to get it to only fire on the simulated line. I added the StopEvaluatingTriggers function just above the simulate function in the script for plugin A, but plugin B is still firing twice.

Any help would be appreciated!
Australia Forum Administrator #1
Can you show this trigger that stops evaluation?

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


Also, what order are the plugins evaluated in? See point 3 in:

http://www.gammon.com.au/scripts/showrelnote.php?version=4.89&productid=0
#2
Plugin A
<plugin
   name="ExpRatio"
   id="aaaaa53cdc4ab39a6a2a6a7c"
   language="Lua"
   purpose="Calculate exp/time for fights, + delaycast +exp gain compacter"
   date_written="2010-12-18 09:53:55"
   requires="4.70"
   version="1.0"
   sequence="100"
   >

  <trigger
   enabled="n"
   match="^.*$"
   regexp="y"
   omit_from_output="y"
   name="EndExpBlock"
   script="PrintExp"
   sequence="120"
  >

function PrintExp(sName,sLine,wildcards,styles)
    
	if Gagtype==1 then
		Note("")
	end
	for i,v in pairs (exptable) do
		if i=="You" then
			ColourTell ("white", "#555555","Exp: ","limegreen", "#555555", v,"silver","black"," ")
			avgexp = v/roundcount
		else
			ColourTell ("silver", "black",i..": ","green", "black", v.." ")
		end
	end
	ColourNote("silver","black","(","limegreen","black",string.format( "%.2f",avgexp),"silver","black"," Avg/"..roundcount.."mob)")
	if sName=="EndExpBlock" then
        StopEvaluatingTriggers (true)
        EnableTrigger("EndExpBlock",false)
		Simulate(stylesToANSI(styles).."\r\n") 
	else
	Note ("")
	end
	roundcount = 0
	exptable={You = 0}
	Waitcheck = 0
	if Gagtype==1 then
		EnableTrigger("EndBlock", false)
	else
		EnableTrigger("EndExpBlock",false)
	end
end
#3
Hmm, so any idea what the problem might be?
USA Global Moderator #4
I want to see both plugins and the text they trigger from.
#5

<plugin
   name="AardCPwin"
   author="Bast"
   id="aaa66f81c50828bbbfda7101"
   language="Lua"
   purpose="Manages CP and its miniwin"
   save_state="y"
   date_written="2009-02-18 12:31:01"
   requires="4.73"
   version="6.1"
   sequence="5000"
   >

 <trigger
   enabled="n"
   match="Congratulations, that was one of your CAMPAIGN mobs!"
   send_to="10"
   sequence="150"
   script="cp_mob_dead"
   group="campaignin"
  >
  </trigger>

function cp_mob_dead (name, line, wildcards)
  Execute("cp check")
end


...

It triggers on

You receive 52 experience points.
Congratulations, that was one of your CAMPAIGN mobs!

Becomes ->

Exp: 52 (52.00 Avg/1mob)
Congratulations, that was one of your CAMPAIGN mobs!
cp check
cp check
Australia Forum Administrator #6
Quote:


StopEvaluatingTriggers (true)
EnableTrigger("EndExpBlock",false)
Simulate(stylesToANSI(styles).."\r\n") 



Yes, but StopEvaluatingTriggers stops evaluating the current trigger in the current plugin. If you Simulate something that would be a new trigger.

From the help:

Quote:

This causes trigger evaluation to stop, for the current line, and the current plugin. If not in a plugin, then all triggers in the "main" world trigger list stop being evaluated.
#7
I see, thanks.

I guess I have to do some sort of plugin broadcast, and have a special skip so that it will only do 1 cp check?

Would appreciate any other suggestions way to fix the double triggering!