 |
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Fri Jun 20, 2008 3:19 pm
[2.28] Packet breaks with #say in the middle foul up triggers |
So having learned from your comments how Cmud can and will display a #say statement between packets I think I have a case where this is causing a problem.
Example:
| Code: |
8360h, 8470m, 34223e, 31441w cexdb- (Not Selfish)
You offer up the corpse of a[Acropolis]: Failsafe: eq
fairy Knight of Sidhe to Lupus, Wild God of the Beasts.
8360h, 8470m, 34223e, 31441w cexdb- (Not Selfish)
|
What is happening here is that I'm sending a large amount of text all at once to the server and the server in turn is spamming me with tons of responses. This inundation of text from the server causes all sorts of interesting packet breaks such as the one observed above. In this case the last part of one packet contained, "You offer up the corpse of a". Right after that packet was received an #alarm statement went off making the "#say [Acropolis]: Failsafe: eq". Now comes the next packet with the rest of the line, " fairy Knight of Sidhe to Lupus, Wild God of the Beasts."
The line "You offer up the corpse of a fairy Knight of Sidhe to Lupus, Wild God of the Beasts." should have matched a trigger and have been #gaged, but with the #say statement interrupting it doesn't match the trigger.
I've seen this happen when #alarms happen to fire right between packets (which isn't often but does happen). From your explanations on what happens behind the scenes I'm fairly sure that this is what is happening. Perhaps you don't see this because on Vista, as you mentioned, they handle networking a bit differently. Perhaps the #say statement could be delayed if you detect a packet ending in the middle of a line (without a newline or GA/EOR). It might affect performance in this case, but the rarity of a #say from an #alarm to interrupt a specifically divided packet, I'd say it would be better to get right the very infrequent times it occurs rather than to be fast and do it wrong. |
|
|
|
 |
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Fri Jun 20, 2008 3:30 pm |
If you want to look at an example of the #debugfile output for this I don't have it and it would be very spammy if I did have it. It should look exactly like the other umteen packet break examples I recorded for the ATCP bleedthrough issue if you want to grab one of those.
|
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Jun 20, 2008 4:30 pm |
This is normal and cannot be fixed. Unless the first partial packet is in the middle of an ATCP or other control sequence, the text from the #SAY will always show up between the two packets. CMUD has no way to know that the first packet isn't just part of your MUD prompt or something. Both packets just look like normal text.
#SAY and #ECHO *are* delayed and placed at the end of the current network buffer (unlike #SHOW which is executed immediately). So if the MUD sends a lot of stuff at once, even if with multiple packets, then you won't always see the #SAY between the packets. But it is still very possible for that to happen as you mentioned and absolutely nothing that can be done about it.
Since you seem to see these problems more than most people I think you might be able to tweak your network packet properties somehow to increase your packet size. When I was testing the ATCP problems in previous versions, I certainly learned that the packets are *not* being broken at the server end.
Sometimes ISPs will break packets. and sometimes your router will do it, and there are also some settings in Windows to do it. You might do some Google searching or maybe someone else can post more information on how you might mess with your packet sizes in Windows. |
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Jun 20, 2008 4:46 pm |
Btw, many years ago in zMUD I played with something like this. That was before some MUDs used IAC-EOR, but the idea was that #SAY would only output after a newline was received. The idea of "waiting" for something form the MUD before outputting the results of #SAY was a disaster. You never want to wait for something that might not be received. For example, if the connection has timed-out or something.
|
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Fri Jun 20, 2008 5:02 pm |
I wonder if an exception could be made for MUDs that properly use EOR like they should. If a MUD uses EOR properly, and you know it does, either because the user's told you it does or because you've detected that (somehow - no idea if that'd work often enough to be worthwhile), then you know that a packet boundary without a newline or an EOR isn't a prompt. MUDs that can't use the protocol properly can be left in the cold 
|
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Fri Jun 20, 2008 6:46 pm |
Well, CMUD would still need to wait for the EOR character. Like I said, I dabbled with that kind of stuff in zMUD and doing any sort of waiting for something from the MUD just runs into all sorts of trouble. You have to do the wait in a background thread so that the entire application doesn't come to a halt while waiting for the EOR to be received. And doing output to the screen (or accessing any UI elements) from a thread is very tricky and difficult. It would be a huge amount of work and would probably cause all sorts of new unstable thread bugs that would be hard to track down. All for something that would only benefit on a handful of MUDs that use EOR.
zMUD has worked the same as this for over 10 years and this is the first time I have really gotten a serious request for this. And I honestly thing that ReedN can fix the problem even better himself via tweaking some TCP/IP window settings on his computer or on his router to minimize the packets being broken. |
|
|
|
 |
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Sat Jun 21, 2008 12:00 am |
For the next couple of weeks I'm still in Malaysia and that may be the cause of it, I don't know how many intermediate locations might be tweaking my network packets. I'll see how much this affects me when I get back to Oregon and have a decent internet provider again.
If this is still an issue at that point, I'll have to brainstorm. I could delay printing text myself if I was able to know from Cmud whether I was in a non-terminated line (when the mud uses EOR and hasn't finished a line properly either designated as a prompt or otherwise with a newline). That way it would just be setting a system variable on your side and I could take the hard actions of delaying the print on my part. But perhaps it won't come to that. I'll see if what happens when I'm back in the US. |
|
|
|
 |
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Mon Jun 30, 2008 12:02 am |
One other thing I've noted. The case above deals with a line without formatting on it. If I print/say occurs in between packets where some formatting was going on it messes up the text when it tries to continue printing the text on the next line. Is the formatting state properly saved in the cases where there is an intervening say/print between packets?
|
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Jul 01, 2008 4:53 pm |
Yes, the formatting state should be properly saved. If you run into a specific case where a #say/print messes up the formatting, then post the raw input/output message data from the Script Debugger window so I can see exactly what is happening.
|
|
|
|
 |
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Wed Jul 02, 2008 12:39 am |
Here's an example when I have a #say statement contained in an ATCP trigger. The context is that I have a flag set to lookup the next room (because I suspect the mapper isn't on my current room). When I've found the room it prints that it found the correct room, thus causing this issue. I artificially put in a #say to assure that it shows the issue:
The "[1;35m" is the issue:
| Code: |
8360h, 8470m, 36900e, 28554w cexdb-|0h(0%):+12m(+0%)|ne
[Acropolis]: Teleport: 10545
[Acropolis]: Missing: nw w. Seen: 4 Map: 2
hello!
Guardian's Avenue along the Wall.
[1;35mA rune resembling a horse has been sketched into the ground here. A runic totem is planted solidly in the ground.
You see exits leading northeast and southwest.
|
ATCP Trigger at work. The '#say hello!' and probably the other printing as well, is what is causing the issue:
| Code: |
<trigger name="RoomBriefTrigger" type="Telnet" param="200" priority="2" case="true" stop="true" regex="true" id="3283">
<pattern>^Room\.Brief\s+(?:Flying above |In the trees above )?(.+?)(?: \(road\))?$</pattern>
<value>#var RoomName %1
#if (%iskey( @flags, find_room)) {
i_del flags find_room
find_current
#say hello!
}
#if (!@PromptSeen) {
#if (%1 == "Surrounded by dirt") {i_add flags {ignore_room|burrowed}} {i_del flags burrowed}
#RAISEEVENT RoomName %1
#TAG name %1
#ok
}</value>
</trigger>
|
Debugfile information:
| Code: |
out ( 4) 07/02/08 08:21:52:567 : ne<CR><LF>
in ( 572) 07/02/08 08:21:52:802 : <ESC>[1;33mGuardian's Avenue along the Wall.<CR><LF>
<ESC>[0;37m<IAC><SB><200>Room.Brief Guardian's Avenue along the Wall<IAC><SE><ESC>[1;35mA rune resembling a horse has been sketched into the ground here.<ESC>[0;37m<ESC>[1;35m A runic totem is planted solidly in the ground.<ESC>[0;37m<ESC>[36m<CR><LF>
<ESC>[37m<ESC>[1;31mYou see exits leading<ESC>[0;37m<IAC><SB><200>Room.Exits ne,sw<IAC><SE><ESC>[1;31m northeast and southwest.<CR><LF>
<ESC>[0;37m<IAC><SB><200>Char.Vitals<LF>
H:8360/8360 M:8470/8470 E:36898/36900 W:28578/33900 NL:40/100 <IAC><SE><ESC>[32m8360h, <ESC>[37m<ESC>[32m8470m, <ESC>[37m<ESC>[32m36898e, <ESC>[37m<ESC>[32m28578w <ESC>[37mcexdb-<IAC><EOR><IAC><SB><200>Room.Brief Guardian's Avenue along the Wall<IAC><SE><IAC><SB><200>Room.Exits ne,sw<IAC><SE>
|
Debug Window:
| Code: |
| f Achaea | Alarm: *30
0.0010 | c Achaea | exec : Alarm "WakeCommandRec" : #T+ CommandRec #T- WakeCommandRec
0.8602 | ---
0.0001 | c Achaea | exec : Macro "KEY9" : ne
0.0003 | f Achaea | Command Input: ^.
0.0006 | c Achaea | exec : Command Input "CommandRec" : #T+ SendLine trigger #T+ Wak...
0.0008 | f Achaea | Command Input: ^\s*(d|u|in|out|n|ne|e|se|s|sw|w|nw)\s*$ : (%1="ne")
0.0001 | c Achaea | exec : Command Input "^\s*(d|u|in|out|n|ne|e|se|s|sw|w|nw)\s*$" ...
0.0002 | c Achaea | exec : Event "Movement" : i_failsafe_moving %1 %2
0.0049 | a Achaea |5390h, 7018m, 23398e, 24792w cexdb-ne
0.0030 | j Achaea >ne
0.2112 | a Achaea #Telnet 200: Room.Brief Guardian's Avenue along the Wall
0.0005 | f Achaea | Telnet: ^Room\.Brief\s+(?:Flying above |In the trees above )?(.+?... : (%1="Guardian's Avenue along the Wall")
0.0005 | c Achaea | exec : Telnet "RoomBriefTrigger" : #var RoomName %1 #if (%iskey(...
0.0049 | a Achaea |[Acropolis]: Teleport: 10545
0.0143 | c Achaea | exec : Event "onRoomEnter" : #if (@flag( ignore_room)) {i_del fl...
0.0070 | a Achaea |[Acropolis]: Missing: nw w. Seen: 4 Map: 2
0.0128 | a Achaea |hello!
0.0051 | a Achaea #Telnet 200: Room.Exits ne,sw
0.0004 | f Achaea | Telnet: ^Room\.Exits\s+(.*)$ : (%1="ne,sw")
0.0008 | c Achaea | exec : Telnet "RoomExitsTrigger" : #if (@PromptSeen) { #var Ro...
0.0011 | a Achaea #Telnet 200: Char.Vitals<LF>H:5390/5390 M:7018/7018 E:23398/23400 W:24840/27900 NL:40/100
0.0005 | f Achaea | Telnet: ^Char\.Vitals\12(H:(\d+)/(\d+) M:(\d+)/(\d+) E:(\d+)/(\d+... : (%1="H:5390/5390 M:7018/7018 E:23398/23400 W:24840/27900", %2=5390, %3=5390, %4=7018, %5=7018, %6=23398, %7=23400, %8=24840, %9=27900)
0.0004 | c Achaea | exec : Telnet "^Char\.Vitals\12(H:(\d+)/(\d+) M:(\d+)/(\d+) E:(\...
0.0041 | c Achaea | exec : Event "Vitals" : #T+ i_scan_damage event
0.0012 | a Achaea #Telnet 200: Room.Brief Guardian's Avenue along the Wall
0.0005 | f Achaea | Telnet: ^Room\.Brief\s+(?:Flying above |In the trees above )?(.+?... : (%1="Guardian's Avenue along the Wall")
0.0005 | c Achaea | exec : Telnet "RoomBriefTrigger" : #var RoomName %1 #if (%iskey(...
0.0014 | c Achaea | exec : Event "RoomName" : #T+ roomDescription #var roomType %nul...
0.0017 | c Achaea | exec : Event "RoomName" : i_add flags runes 2 #T+ rune_prompt #T...
0.0020 | a Achaea #Telnet 200: Room.Exits ne,sw
0.0004 | f Achaea | Telnet: ^Room\.Exits\s+(.*)$ : (%1="ne,sw")
0.0008 | c Achaea | exec : Telnet "RoomExitsTrigger" : #if (@PromptSeen) { #var Ro...
0.0012 | a Achaea |
0.0024 | a Achaea |Guardian's Avenue along the Wall.
0.0006 | f Achaea | Pattern: ^(?:(?:\e\[37m)?(?:Flying above|In the trees above))?\e\[... : (%1="Guardian's Avenue along the Wall")
0.0010 | c Achaea | exec : Pattern "^(?:(?:\e\[37m)?(?:Flying above|In the trees abo...
0.0025 | a Achaea |[1;35mA rune resembling a horse has been sketched into the ground here. A runic totem is planted solidly in the ground. Smaryl is here, sleeping soundly. She wields a bard's mandolin in her left hand and an ornate steel rapier in her right.
0.0007 | f Achaea | Pattern: ^(?:(?:\e\[37m)?(?:Flying above|In the trees above))?\e\[... : (%1="[1;35mA rune resembling a horse has been sketched into the ground here")
0.0004 | c Achaea | exec : Pattern "^(?:(?:\e\[37m)?(?:Flying above|In the trees abo...
0.0060 | a Achaea |You see exits leading northeast and southwest.
0.0051 | a Achaea ]5390h, 7018m, 23398e, 24840w cexdb-
0.0006 | f Achaea | Pattern: ^\d+h, \d+m, \d+e, \d+w ([cexkdb]*)\- : (%1="cexdb")
0.0004 | c Achaea | exec : Pattern "prompt" : #var pflags %1 #RAISEEVENT Prompt #if ...
0.0004 | c Achaea | exec : Event "Prompt" : $count = @flag( runes) - 1 #if ($count >...
0.0018 | c Achaea | exec : Event "Prompt" : #var prompt_lock 1 #var fst_prompt %null...
0.0007 | c Achaea | exec : Event "i_scan_damage" : $h_delta = (@health - %db( @damag...
0.0100 | c Achaea | exec : Event "Prompt" : #T- roomDescription #if (!%maplocked and...
1.4521 | f Achaea | Alarm: *1.5
0.0009 | c Achaea | exec : Alarm "rune_timer" : i_del flags runes #T- rune_prompt #T...
0.2174 | f Achaea | Alarm: *2
0.0009 | c Achaea | exec : Alarm "fst_moving" : #if (!%iskey( @fst_prompt, fst_movin...
|
|
|
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jul 02, 2008 1:00 am |
Yes, doing a #SAY in an ATCP trigger will have this problem. During an ATCP trigger, you are essentially working in "server mode" where CMUD is still at a low level of processing. The ATCP trigger processing is done at a much lower level than normal trigger processing. So the formatting state while in an ATCP trigger is still in the "server state" and not in the "user state".
In fact, I hesitate to recommend doing *any* output to the screen from an ATCP trigger. If you have to output anything from an ATCP trigger, it's probably best to use #SHOW since it treats the text as if it was received from the MUD (which keeps it within the server context).
If you find a problem with #SAY effecting formatting outside of an ATCP trigger, let me know. |
|
|
|
 |
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Wed Jul 02, 2008 1:51 am |
Couldn't the 'server state' be exited before the code for the ATCP trigger is run? So the ATCP trigger matches and finishes 'server state' and then executes the code from the trigger. Is that possible?
Or if it needs to run the code in 'server state' it could just execute the #say statements at the end after the 'server state' has finished.
As always, users tend to do things that shouldn't be done if they are at all possible to do. If this truly shouldn't be done, could Cmud ensure it won't with one of the suggestions posted here? |
|
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Jul 02, 2008 3:01 pm |
I dunno, it's not really been Zugg's philosophy in the past (as I understand it) to stop CMUD being able to do things like this. It's useful, for example, when you're setting up ATCP triggers for the first time, because you can tolerate it looking a bit poo then. But beyond that, it's just one of those things.
One thing you could try is using a very short alarm or an event to print the text. |
|
|
|
 |
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Wed Jul 02, 2008 4:16 pm |
It doesn't seem like as a user I should be able to execute things while Cmud is in a 'server state'. So perhaps if it wrapped up the detection of the trigger in server state, exited server state and then executed the code for the trigger. But I'm really guessing here because the first I knew about a server state was Zugg's post in this topic.
|
|
|
|
 |
Tech GURU

Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Wed Jul 02, 2008 4:20 pm |
In cases like that I use #MESSAGE since it should disrupt the MUD output or it's flow at all, and to my understanding can't be trigger off of either.
|
|
_________________ Asati di tempari! |
|
|
 |
Zugg MASTER

Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jul 02, 2008 5:02 pm |
Now you know why zMUD/CMUD doesn't normally trigger on anything at the "raw" network level. Sorry if it's confusing, but it was better to add ATCP triggers so that advanced users could use them to perform advanced functions on IRE MUDs. ATCP are not like normal triggers as I have explained. Yes, I could probably spent a lot more time making them more useable in the future. But I didn't want to hold up an important feature like this just because there were certain things that didn't work well. Most people who needed ATCP triggers just needed to capture data into variables and did not need to alter the MUD output during the ATCP trigger.
But this is my typical frustration too. I add a feature like ATCP support that is requested by several people. But I can't spend a month on making it perfect because there are too many other things that need to be worked on. So I release the new feature anyway so that 90% of the people who wanted it are happy. But then the other 10% of people come along and complain that it's not perfect. Makes me wish sometimes that I never bothered to add any new features.
So yes, of course this could be improved. Just like there are hundreds of other little things like this that could be improved. For example, CMUD shouldn't let you enter non alphanumeric characters into the name of a Class. But all of those things take time, and I'm only one person. I have to prioritize what I work on. |
|
|
|
 |
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Thu Jul 03, 2008 2:09 am |
Don't get me wrong, I love having ATCP available, it makes things so much easier I can't even begin to describe. The things I can do now with ATCP make this type of side effect of very little consequence.
Please don't interpret my posting of bugs to be complaints, as I'm just trying to help work towards a better CMud for myself (and for everyone else as well). I know you've planned to work on the mapper now and so if this type of thing needs to be ignored indefinitely to prioritize then I'm not complaining. |
|
|
|
 |
|
|
|