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 ➜ Suggestions ➜ differentiate Simulate from received packets

differentiate Simulate from received packets

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 Mon 02 Nov 2015 08:56 PM (UTC)

Amended on Tue 03 Nov 2015 03:11 AM (UTC) by Nick Gammon

Message
Following upon http://www.mushclient.com/forum/?id=12328 I also find myself wanting calls to Simulate to not trigger OnPluginPacketReceived. Can Simulate take an optional second argument for that? (Or maybe make a new function that does this claled something other than Simulate?)

obscure reasoning that depends on interplay between multiple plugins written by different people:

This is due to a combination of how useful Simulate is in practice and the fact that OnPluginPacketReceived is unaffected by plugin sequencing and StopEvaluatingTriggers.

Example:
One plugin takes the line "Hello, my name is Fiendish" and changes "Hello" to "Bonjour". The result is "Bonjour, my name is Fiendish". It omits from output and then uses Simulate to generate new output and then does StopEvaluatingTriggers(true) so that other things can trigger/omit/repeat on the same line without duplicating output (common problem with people doing multiple same line replacements).

A second plugin wants to blast changes into every packet received from the server so that it can easily adjust both displayed messages and also gmcp data without having to do anything with style runs, so it uses OnPluginPacketReceived. One of the things it wants to change is from "Fiendish" to "Fiendish (ButtHead)". On its own this works quite well. But when the other plugin runs and sees "Hello, my name is Fiendish (ButtHead)" and changes that to "Bonjour, my name is Fiendish (ButtHead)", the second plugin matches again on the new output (because it's looking for Fiendish and seeing it again on output produced by a plugin but not sent by the server) and changes the just-simulated packet to "Bonjour, my name is Fiendish (ButtHead) (ButtHead)", which is bad.

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

Posted by Nick Gammon   Australia  (23,131 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 03 Nov 2015 03:29 AM (UTC)

Amended on Tue 03 Nov 2015 03:30 AM (UTC) by Nick Gammon

Message
Added a GetInfo (123) call that lets you detect if the current input is being simulated or really arrived from the MUD.


https://github.com/nickgammon/mushclient/commit/f575af7

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


9,253 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.