[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  StopEvaluatingTriggers broken across plugins outside of SendToScript
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

StopEvaluatingTriggers broken across plugins outside of SendToScript

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


Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Sat 17 Dec 2016 04:52 PM (UTC)

Amended on Sat 17 Dec 2016 04:56 PM (UTC) by Fiendish

Message
https://mushclient.com/scripts/doc.php?function=StopEvaluatingTriggers implies that using StopEvaluatingTriggers outside of SendToScript _should_ affect other plugins, but that it just won't affect the current plugin. That's fine. That's what I want anyway. Except it doesn't work. The following two plugins together keep printing "test 1\ntest 2" instead of only "test 1"

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
   name="test_trigger_1"
   author="Fiendish"
   id="b0ba651e71e0c226a60ae8f1"
   language="Lua"
   date_written="2014-04-08 09:43:19"
   requires="4.90"
   version="1.0"
   sequence="-5000"
>
</plugin>
<triggers>
  <trigger
   name="all"
   enabled="y"
   match="^(.*)$"
   omit_from_output="n"
   regexp="y"
   sequence="100"
   script="test_1"
  ></trigger>
</triggers>
<script>
function test_1()
   print("test 1")
   StopEvaluatingTriggers(true)
end
</script>
</muclient>



<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
   name="test_trigger_2"
   author="Fiendish"
   id="b0ba651e71e0c226a60ae8f2"
   language="Lua"
   date_written="2014-04-08 09:43:19"
   requires="4.90"
   version="1.0"
>
</plugin>
<triggers>
  <trigger
   name="all"
   enabled="y"
   match="^(.*)$"
   omit_from_output="n"
   regexp="y"
   sequence="100"
   script="test_2"
  ></trigger>
</triggers>
<script>
function test_2()
   print("test 2")
end
</script>
</muclient>

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (21,324 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sat 17 Dec 2016 09:06 PM (UTC)
Message
I think you are misreading the implications. As documented here:

http://www.gammon.com.au/forum/?id=6554

"send to script" is done in step 12.

Running functions named in a trigger "script" parameter (not send-to-script) is done in step 20.

In other words, external function calls are remembered in a list, and then processed later. It is too late at that point for such a function to alter trigger evaluation (by doing "StopEvaluatingTriggers").

The documentation for StopEvaluatingTriggers says:

Quote:

This would have to be called from "send to script" (not send-to-script-after-omit), nor from a trigger script file, in order to be effective.


This is correct. There is no implication there that it can be usefully called elsewhere.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Fiendish   USA  (1,641 posts)  [Biography] bio   Global Moderator
Date Reply #2 on Sat 17 Dec 2016 11:28 PM (UTC)
Message
I'm talking about the part that says (emphasis added)

Quote:
Note that since calling a trigger script (script name in Script box) is done after all triggers are evaluated for that plugin, doing this inside a script file will be too late (for the current plugin). It has to be done in send-to-script.

https://github.com/fiendish/aardwolfclientpackage
[Go to top] top

Posted by Nick Gammon   Australia  (21,324 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Sun 18 Dec 2016 03:12 AM (UTC)
Message
That is just saying that each plugin (plus the main world file) are evaluated in turn.

So, script files are called when all triggers are evaluated in all plugins.

I think the documentation might be slightly misleading. "for that plugin" should probably read "for all plugins".

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] 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.


1,505 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]