Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, 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.
Entire forum
➜ MUSHclient
➜ General
➜ Help with Triggers, Is This Possible?...
Help with Triggers, Is This Possible?...
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
3
Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Date
| Reply #30 on Sat 20 Aug 2011 07:20 AM (UTC) |
Message
| I see. So the net effect is that triggers no longer can be designed to fire on what arrives from the MUD (which is probably well-defined). They now have to fire on whatever-it-is that previous triggers changed the line to. And this is somewhat dependent on trigger evaluation order. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #31 on Sat 20 Aug 2011 11:25 PM (UTC) |
Message
|
Etzli said: As for how other clients prevent infinite loops, it's really on the part of the scripter to prevent infinite loops. What I mean by this is given a trigger that substitutes a line, if a scripter substitutes that line back to the original, that'll no doubt cause the infinite loop. Not entirely true. zMUD will not easily let you get into an infinite loop, because a given trigger won't re-sub for the same line index. If you have one trigger that replaces "apple" with "pear" and another that replaces "pear" with "apple", the first trigger will not fire again.
Nick Gammon said:
I see. So the net effect is that triggers no longer can be designed to fire on what arrives from the MUD (which is probably well-defined). They now have to fire on whatever-it-is that previous triggers changed the line to. And this is somewhat dependent on trigger evaluation order.
Well, MUSHclient does already have a set evaluation order. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Date
| Reply #32 on Sun 21 Aug 2011 06:04 AM (UTC) |
Message
| Yes I understand that. But at present if two triggers fire on "apple" (and are set to keep evaluating) they both fire. One can't change the line (eg. change apple to pear) so that the other doesn't fire at all. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Date
| Reply #33 on Sun 21 Aug 2011 06:07 AM (UTC) |
Message
|
Fiendish said:
zMUD will not easily let you get into an infinite loop, because a given trigger won't re-sub for the same line index.
Does zMUD let you substitute the actual contents? In other words, change the line "in situ" so that the next trigger matches the changed line? If so, the line index wouldn't come into it, would it? THe trigger has already been processed. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #34 on Sun 21 Aug 2011 06:53 AM (UTC) Amended on Sun 21 Aug 2011 06:56 AM (UTC) by Fiendish
|
Message
|
Nick Gammon said:
Fiendish said:
zMUD will not easily let you get into an infinite loop, because a given trigger won't re-sub for the same line index.
Does zMUD let you substitute the actual contents? In other words, change the line "in situ" so that the next trigger matches the changed line? If so, the line index wouldn't come into it, would it? THe trigger has already been processed.
Yes it does. If the server is sending "I am Fiendish", triggering on the pattern "Fiendish" (zMUD patterns implicitly begin and end with glob * unless specified otherwise) with the script "#sub awesome" makes it look like the server had sent you "I am awesome" instead of "I am Fiendish". And if you have that AND a subsequent trigger on the pattern "awesome" with the script "#sub delighted" it will look like the server had instead sent "I am delighted". But if you have another trigger that #subs "delighted" into "Fiendish" again, the first trigger will not fire a second time. Thus, no loop.
I think the line index comes into it in the sense that at some point you need to decide to allow the first trigger to fire again. I guess this might be at each newline received from the server. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Nick Gammon
Australia (23,046 posts) Bio
Forum Administrator |
Date
| Reply #35 on Sun 21 Aug 2011 11:09 PM (UTC) |
Message
|
Fiendish said:
I think the line index comes into it in the sense that at some point you need to decide to allow the first trigger to fire again. I guess this might be at each newline received from the server.
I don't fully understand this part. The triggers are always evaluated once, per line received. Why is a line index required? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Fiendish
USA (2,533 posts) Bio
Global Moderator |
Date
| Reply #36 on Mon 22 Aug 2011 12:04 AM (UTC) Amended on Mon 22 Aug 2011 12:06 AM (UTC) by Fiendish
|
Message
|
Quote: The triggers are always evaluated once, per line received. Why is a line index required? Triggers are evaluated once per line "seen", not necessarily per line "received". I am distinguishing here between lines from the server (what I call received) and lines that appear on the screen (seen). If I have a script in zMUD that echos text to the screen, triggers will fire on that text as well, even though it didn't get "received" from the server. This is all because zMUD apparently does not distinguish between echoing and printing mud output in the same way that MUSHclient does. In fact, if you have a trigger that echos a line of text that it also matches on, you *will* get into an infinite loop in zMUD because the echo is a new line. This is obviously something very easy to avoid in practice, but it gives an insight into the inner workings.
I will also note that zMUD detects infinite loops and offers an opportunity to kill the runway script. |
https://github.com/fiendish/aardwolfclientpackage | Top |
|
Posted by
| Etzli
USA (4 posts) Bio
|
Date
| Reply #37 on Mon 22 Aug 2011 01:15 AM (UTC) |
Message
| It should probably also be noted that in CMUD, there is now a #PRINT command that will print the message on the screen but will not fire any triggers. This is similar to the Note functions in MUSH (as far as I can tell). | 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.
103,055 views.
This is page 3, subject is 3 pages long:
1
2
3
It is now over 60 days since the last post. This thread is closed.
Refresh page
top