Duplicate world.Send's

Posted by Ked on Fri 06 May 2005 01:57 PM — 2 posts, 12,055 views.

Russia #0
I've had this problem pop up before, but I could never link it to anything in particular. The problem is that world.Send commands seem to sometimes "breed", meaning that a single call to world.Send in a script results in more than one call seemingly happening - everything gets sent twice in a row. Now I suspect that it has something to do with an error that I seem to get every time before that starts happening.

I connect, send some commands from OnWorldConnect routine, some of them go through, and then the connection is dropped with a "Cannont decompress distance code from MUD" error message. I re-connect, the same thing happens. Finally, I realize that it must be due to one of my plugins, uninstall the plugin, and connect again. But now, after a portion of the commands in my OnWorldConnect function go through normally, the remaining two commands are repeated three times each. My suspicion is that 3 = 2 failed connections + the last successful one.

The cause of the connection error, I think, was this function in one of my plugins:


def OnPluginSend(strText):
    world.Tell(strText)
    if freeze:
        if strText.lower() in ['nw','ne','n','north','se','sw','s','south',
                               'e','w','east','west','u','p','up','down',
                               'i','o','in','out']:
            return False
        else:
            return True
    else:
        return True


And more exactly the world.Tell, I believe.
Australia Forum Administrator #1
I wouldn't do that myself. The Tell puts stuff in the output buffer without a newline, and doing that in the middle of capturing data being sent out may conceivably set up some sort of strange race condition.

I would append to notepad or something like that instead.