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 broken across plugins outside of SendToScript
StopEvaluatingTriggers broken across plugins outside of SendToScript
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Fiendish
USA (2,534 posts) 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 | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) 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 | Top |
|
Posted by
| Fiendish
USA (2,534 posts) 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 | Top |
|
Posted by
| Nick Gammon
Australia (23,133 posts) 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 | 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.
11,814 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top