[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]  Suggestions
. . -> [Subject]  differentiate Simulate from received packets
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

differentiate Simulate from received packets

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 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
[Go to top] top

Posted by Nick Gammon   Australia  (21,322 posts)  [Biography] 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
[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.


2,220 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]