Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ General ➜ StopEvaluatingTriggers function

StopEvaluatingTriggers function

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Redryn   (15 posts)  Bio
Date Sat 06 Dec 2014 02:14 PM (UTC)
Message
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!
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Sat 06 Dec 2014 07:58 PM (UTC)
Message
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

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Redryn   (15 posts)  Bio
Date Reply #2 on Sun 07 Dec 2014 02:08 AM (UTC)
Message
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
Top

Posted by Redryn   (15 posts)  Bio
Date Reply #3 on Tue 30 Dec 2014 02:48 AM (UTC)
Message
Hmm, so any idea what the problem might be?
Top

Posted by Fiendish   USA  (2,555 posts)  Bio   Global Moderator
Date Reply #4 on Tue 30 Dec 2014 04:44 PM (UTC)
Message
I want to see both plugins and the text they trigger from.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Redryn   (15 posts)  Bio
Date Reply #5 on Thu 15 Jan 2015 03:20 PM (UTC)
Message

<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
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #6 on Thu 15 Jan 2015 09:17 PM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Redryn   (15 posts)  Bio
Date Reply #7 on Sat 17 Jan 2015 03:34 AM (UTC)
Message
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!
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


28,673 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.