Ok, this is just the relevant parts of the packets I believe but here is what happens, I log in, and get my room desc. I send anything to the mud and get the response beginning with > .... Now i'm not sure if this error will crop up in other situations, but if possible I want to eliminate it.
50 33 36 6d 77 65 73 74 1b 5b 30 6d 2e 0d 0a 35 30
2 iron weights.. 32 20 69 72 6f 6e 20 77 65 69 67 68 74 73 2e 0d
.ÿü.ÿü.> 0a ff fc 01 ff fc 03 3e 20
Sent packet: 3 (3 bytes) at Thursday, April 30, 2009, 4:43:16 PM
l.. 6c 0d 0a
Incoming packet: 4 (409 bytes) at Thursday, April 30, 2009, 4:43:17 PM
.[1mA garden.[0m 1b 5b 31 6d 41 20 67 61 72 64 65 6e 1b 5b 30 6d
..A small garden 0d 0a 41 20 73 6d 61 6c 6c 20 67 61 72 64 65 6e
looks very well 20 6c 6f 6f 6b 73 20 76 65 72 79 20 77 65 6c 6c
tended.
...502 iron weights.
> A garden
A small garden looks very well tended.
At the moment, I've modified the code a little... it is as follows:partial = ""
function OnPluginPacketReceived (s)
local t = {} -- table of reassembled lines
if s == "> " then
s = ""
end
-- get rid of carriage-returns, add new packet to existing partial one
partial = partial .. string.gsub (s, "\r", "")
-- turn finished lines into table t
partial = string.gsub (partial, "(.-)\n",
function (line)
-- remove prompt as we add to the table
line = string.gsub (line, "^\027%[0m> ", "\027[0m", 1)
line = string.gsub (line, "^> ", "", 1)
if line ~= "" then
table.insert (t, line)
end -- if not empty
return ""
end) -- function
if #t > 0 then
table.insert (t, "") -- to get final linefeed
end -- if
-- return table of lines, concatenated with newlines between each one
return table.concat (t, "\n")
end
|