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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Bug reports
. . -> [Subject]  Full lines received within a packet, Note(), and triggers

Full lines received within a packet, Note(), and triggers

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


Pages: 1 2  3  4  5  

Posted by Galaban   (19 posts)  [Biography] bio
Date Thu 25 Jun 2015 11:44 AM (UTC)

Amended on Thu 25 Jun 2015 11:59 AM (UTC) by Galaban

Message
I'm using r1820. I've also seen this in the master branch compiled from github.

This is the packet we get from the mud:

++Received from MUD: [IAC][SB]Écomm.tick {}[IAC][SE][ESC][1;34mYou see the black moon rising in the east.[ESC][0;37m[LF][CR][ESC][0;37mYou see the grey moon rising in the east.[ESC][0;37m[LF][CR]-->[ESC][1;37m TICK [ESC][0;37m<--[LF][CR][LF][CR]

The triggers

Trigger 1 (sort of): (gmcp) comm.tick
I have code that prints out a Note() when we get the GMCP data comm.tick (first thing in the packet above). That works great. (Technically it isn't a trigger, but a plugin broadcast handler that prints a note.)

Trigger 2: ^You see the black moon rising in the east\.$
This trigger sets a value and prints a note when we get this next line in the packet.

Trigger 3: ^You see the grey moon rising in the east\.$

Trigger 2 isn't firing. #1 and #3 are.

Analysis
My trigger is matching on "^You see the black moon rising in the east\.$" (I converted to regex to avoid the auto-conversion that happens internally.) This isn't matching. I tried dropping the ^ and the $ (both separately and together) and it still didn't match.

I changed the Note() call to AnsiNote(), but that had no impact (which didn't surprise me).

Finally, I tried delaying the note printing when the comm.tick comes in and that fixed it. (A DoAfterSpecial call.)

My first thought is that adding Note()s to the output alters the CurrentLine or PreviousLine pointers in some unexpected way. For some reason, it's causing the mid-packet line to not execute the triggers.

However, I have notes writing out for triggers 2 and 3 as well (for debug purposes at this point). When Trigger 2 prints out a note, it doesn't mess up the firing of Trigger 3.

So, I'm thinking that there must be something with the GMCP data or the plugin broadcast that we're getting that is causing the second trigger not to fire. I haven't figured out what it is, but it's really bugging me.

Workaround
One possibility that I have not tried is to check for the comm.tick gmcp data OnPacketReceived in the plugin, alter it to remove the data, and then broadcast the event (so that it continues to work). That might work to solve this problem. However, it might make the problem worse (if the plugin broadcast is to blame).

Another workaround is to deal with the tick in some other way. We get in -->TICK<-- line. When I used a trigger to fire off of that, everything worked fine. When I switched to using the GMCP data, it caused problems.

The workaround I chose is to delay any notes that are occurring from the comm.tick event.

This is far from ideal, however. If other plugins get the comm.tick broadcast and print a note, my triggers are hosed.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Thu 25 Jun 2015 09:08 PM (UTC)
Message
Can you please post the raw packet debug output? I can use that to reproduce this.

Can you also post the actual triggers? Copy and paste.

Template:copying For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


Also the actual functions that handle the GMCP tick line?

Template:version Please help us by advising the version of MUSHclient you are using. Use the Help menu -> About MUSHclient.


Also get line information on the problem line "You see the black moon rising in the east" and see if it is classified as MUD output or Note output.

- Nick Gammon

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

Posted by Galaban   (19 posts)  [Biography] bio
Date Reply #2 on Mon 29 Jun 2015 10:32 AM (UTC)
Message
Aah, sure thing.

The packet that came in:


Incoming packet: 61 (104 bytes) at Monday, June 29, 2015, 6:08:29 AM

ÿúÉcomm.tick {}ÿ   ff fa c9 63 6f 6d 6d 2e 74 69 63 6b 20 7b 7d ff
ð.[0;37mYou see    f0 1b 5b 30 3b 33 37 6d 59 6f 75 20 73 65 65 20
the grey moon ri   74 68 65 20 67 72 65 79 20 6d 6f 6f 6e 20 72 69
sing in the east   73 69 6e 67 20 69 6e 20 74 68 65 20 65 61 73 74
..[0;37m..-->.[1   2e 1b 5b 30 3b 33 37 6d 0a 0d 2d 2d 3e 1b 5b 31
;37m TICK .[0;37   3b 33 37 6d 20 54 49 43 4b 20 1b 5b 30 3b 33 37
m<--....           6d 3c 2d 2d 0a 0d 0a 0d


I stripped the plugin down to the basics and it's still behaving the same. The entire plugin:


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
   name="Stripped_Moon_Plugin"
   author="Galaban"
   id="2e1f6126c7419c94e739611d"
   language="Lua"
   purpose="A plugin with a trigger and a broadcast handler"
   save_state="y"
   date_written="2015-06-11 12:21:04"
   requires="4.81"
   version="1.0"
   >
<description trim="y">
<![CDATA[
A plugin with a trigger and a broadcast handler
]]>
</description>

</plugin>

<!--  Get our standard constants -->

<include name="constants.lua"/>


<!--  Triggers  -->

<triggers>
  <trigger
   enabled="y"
   match="You (.*?) the (.*?) moon (falling|rising) (.*?) the (east|west)"
   regexp="y"
   name="trgMoons1"
   send_to="12"
   sequence="100"
  >
  <send>Note("---------------")</send>
  </trigger>

</triggers>

<!--  Aliases  -->

<script>
<![CDATA[


----------------------
-- GMCP 
function OnPluginBroadcast (msg, id, name, text)
   if id == "3e7dedbe37e44942dd46d264" then -- gmcphandler
      if (text == "comm.tick") then
         Note("--GMCP TICK---")
      end 
   end --if gmcphandler
end

]]>
</script>

</muclient>



I also ripped out all unneccesary plugins to remove the possible sources. The plugins installed:

* Aardwolf_gmcp_handler (required for the broadcast)
* My plugin above

When I use "Test Trigger", the moon rises/falls correctly fire the trigger, sending out a "--------" line. However, live data does not do it. Also, when I change the "gmcp tick" to a DoAfterSpecial, the note fires later and the trigger fires every time:


         DoAfterSpecial(0.1,"Note('--GMCP TICK---')",12)


Thanks,
Galaban
[Go to top] top

Posted by Galaban   (19 posts)  [Biography] bio
Date Reply #3 on Mon 29 Jun 2015 10:42 AM (UTC)
Message
Oh, also the moon rise/fall lines are mud output. I also removed all local triggers. So there's nothing else triggering on those two events other than those two plugins.

Thanks,
Galaban
[Go to top] top

Posted by Galaban   (19 posts)  [Biography] bio
Date Reply #4 on Mon 29 Jun 2015 03:17 PM (UTC)

Amended on Mon 29 Jun 2015 03:20 PM (UTC) by Galaban

Message
This appears to be the same issue from here:

http://www.mushclient.com/forum/bbshowpost.php?bbsubject_id=10580

However, the sub-negotiation text comes in as a new line--a tick message, specifically--rather than mid-line.

This example isn't changing the trigger match (as in the previous post), but it is still causing the trigger to not match.
[Go to top] top

Posted by Galaban   (19 posts)  [Biography] bio
Date Reply #5 on Mon 29 Jun 2015 04:28 PM (UTC)
Message
As an improved workaround, I've added a temporary, one-shot trigger to fire off the code after the next line is received from the mud. It may possibly mess up multi-line triggers, though.:


local trgCntr = 1
function DelayCall(text)

    -- Make the label semi-unique in case this gets called twice in succession
    if (trgCntr > 100) then
        trgCntr = 1
    end
    trgCntr = trgCntr + 1

    -- (Make it match a full line so we're not messing up trigger test
    AddTriggerEx("tmpTrgMoons"..trgCntr, 
        "^(.*?)$", 
        text,   --what to execute
        trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.OneShot + trigger_flag.KeepEvaluating + trigger_flag.Temporary, 
        -1, 0, "", "",sendto.script, 100)

end


with the call


    DelayCall("Note('--GMCP Tick--')")
    or
    DelayCall("processTick()")
[Go to top] top

Posted by Fiendish   USA  (2,514 posts)  [Biography] bio   Global Moderator
Date Reply #6 on Mon 29 Jun 2015 05:11 PM (UTC)

Amended on Mon 29 Jun 2015 05:12 PM (UTC) by Fiendish

Message
Galaban said:

I'm using r1820.

n.b. That is an Aardwolf specific version with MUSHclient 4.98

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

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #7 on Tue 30 Jun 2015 02:24 AM (UTC)
Message
Quote:

Trigger 2: ^You see the black moon rising in the east\.$
This trigger sets a value and prints a note when we get this next line in the packet.

Trigger 3: ^You see the grey moon rising in the east\.$

Trigger 2 isn't firing. #1 and #3 are.


You haven't posted a packet dump with Trigger 2 in it.

- Nick Gammon

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

Posted by Galaban   (19 posts)  [Biography] bio
Date Reply #8 on Tue 30 Jun 2015 09:54 AM (UTC)
Message
Yes, the packet dump I posted didn't fire on the moon rise.

The problem isn't a specific trigger or specific text, but any trigger text that is occurring after I output a Note() (or AnsiNote) on the telnet subnegotiation.

In the packet above, we get that "comm.tick" gmcp data, output a Note() for it and then fail to trigger on the moon rise.
[Go to top] top

Posted by Manacle   (28 posts)  [Biography] bio
Date Reply #9 on Tue 30 Jun 2015 04:57 PM (UTC)
Message
For what it's worth, I've noticed this exact problem (I even almost had a note posted on it myself two or three days ago but got interrupted with work issues).

I notice it most in the same situation as above: I use MushClient 4.84 (wharblegarbleUPDATE but I haven't seen anything in changelogs that refers to this similar issue, so I think it's still valid, especially given the evidence of the note at the beginning of this thread).
I play Aardwolf.
I have a 3Moons plugin that Note()s a message every tick when the moons are up.
I have a script that will quickly enchant that I often run during this time.
That script often fails to trigger on solidify/illuminate/resonate messaging when the tick-based Note() happens just before the MUD responds to my solidfy cast.

At first I thought it affected only multi-line triggers, but this is not true (see below).

I've also noticed it at other times with other Note()ed output. The easiest way for me to notice? I have {channel} tags on but trigger-hidden, but if one of my notification plugins Note()s output just before I receive a {channel} message, the trigger (it's one of Fiendish's plugins, whichever one) doesn't trigger on that line so I see the tag. One can also notice this because at times I notice the default blue Note() color bleed into game lines if the timing is perfect. I can, for the most part, resolve this issue by Execute()ing something blank during the most troublesome part of the scripts, but this isn't perfect and it's obviously a hack.

I have not been able to recreate the issue with a set of triggers and timers attempting to Note() output at the same time that the game sends text in, but I have tried. It requires something (timing? Packet order?} very specific, but it affects me for better or worse ten or twenty times a day. It's so difficult to catch in log form though since it's very sparse.

Most of my Note() outputs happen on game ticks and I always use GMCP to capture game ticks. I have not specifically noticed this happen except for output that occurs on game ticks.

There's definitely an issue here in some cases matching triggers just after Note() output is sent to the window, possibly involving that Note() happening during the processing of a comm.tick GMCP message from Aardwolf.
[Go to top] top

Posted by Galaban   (19 posts)  [Biography] bio
Date Reply #10 on Tue 30 Jun 2015 06:07 PM (UTC)
Message
Menacle,

The problem is that when you call Note(), AnsiNote() or Tell() during the OnTelnetSubnegotiation, it messes up...something.

For aardwolf purposes, you probably have a plugin that respons to the gmcp tick. If you output any Notes during that "tick" response, the next line of text will be ignored if it came in that same packet of data.

I posted a workaround a few responses back, but basically instead of using:

Note("I have a tixors")

you can use:

DelayCall("Note('I have a tixors')")


And it behaves nearly the same, but it doesn't stop the triggers from firing. It will delay the note by 1 line. Also, it will mess up any multi-line triggers you have. So, something to keep in mind... :)

Anyways, if you're looking for a workaround, that will solve it.

Thanks,
Galaban
[Go to top] top

Posted by Manacle   (28 posts)  [Biography] bio
Date Reply #11 on Tue 30 Jun 2015 06:58 PM (UTC)
Message
Actually, that does seem like it will fix my issue for the nonce.

Thank you; I'd marked this subject for later reading but basically pasted the note I had prepared earlier in case it had any useful debug information, but I think you've basically made this a nonissue for me (for the moment) in one easy to parse statement. I appreciate it; this was a pretty big item sitting on my stack and I kept pushing it down a bit because I was dreading having to work through it.

I wonder if it would be easier to modify the GMCP plugin to issue its information after the line is fully parsed, but I also wonder if that would interrupt how the standard mapper and/or channel plugins might work. Maybe a DoAfterSpecial on the GMCP plugin's broadcast line?
[Go to top] top

Posted by Galaban   (19 posts)  [Biography] bio
Date Reply #12 on Tue 30 Jun 2015 08:26 PM (UTC)
Message
I've been debugging Mushclient and I've found the key...

The input from the mud that isn't matching has it's ->flags set to 1 (Note). For some reason, it's hanging onto the flag from the previous display line (which was the note from the TelnetSubnegotiation code).

I'll keep digging, but that flag should definitely be 0 and it's 1.
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #13 on Tue 30 Jun 2015 08:31 PM (UTC)
Message
For future reference, this can be used as test data for "test trigger"


\ff\fa\c9comm.tick {}\ff\f0\1b[0;37mYou see the grey moon rising in the east.\1b[0;37m\0a\0d-->\1b[1;37m TICK \1b[0;37m<--\0a\0d\0a\0d


You didn't respond to this:

Quote:

Also get line information on the problem line "You see the black moon rising in the east" and see if it is classified as MUD output or Note output.


The line info for the problem line says:


Line 470 (470), Wednesday, July 01, 7:27:19 AM
 Flags = End para: YES, Note: YES, User input: no, Log: no, Bookmark: no
 Length = 41, last space = 35
 Text = "You see the grey moon rising in the east."


So it has indeed been converted to a note rather than MUD output.

I'll look into it, but I suspect that the "line type" got changed, probably because it wasn't expecting a note to occur during the middle of handling line input.

- Nick Gammon

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

Posted by Galaban   (19 posts)  [Biography] bio
Date Reply #14 on Tue 30 Jun 2015 08:45 PM (UTC)
Message
Ooh, that's nice output. How do we get that line info?
[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.


125,463 views.

This is page 1, subject is 5 pages long: 1 2  3  4  5  [Next page]

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 HostDash]