Ok here is what I want to do, and I think I have to do it in the lua plugin you guys helped me out with.
I want the client to automatically send a carriage return to the mud when it sees this.
"--- Press <enter> for more. ---"
Current plugin follows:
I want the client to automatically send a carriage return to the mud when it sees this.
"--- Press <enter> for more. ---"
Current plugin follows:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Sunday, October 22, 2006, 7:40 AM -->
<!-- MuClient version 3.82 -->
<!-- Plugin "Add_NewLine_To_Prompt" generated by Plugin Wizard -->
<muclient>
<plugin
name="Add_NewLine_To_Prompt"
author="Nick Gammon"
id="1f68b8da856ceccb6f2ea308"
language="Lua"
purpose="Forces a newline after a prompt line"
date_written="2006-10-22 07:38:36"
requires="3.82"
version="1.0"
>
</plugin>
<!-- Script -->
<script>
<![CDATA[
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", "")
partial = string.gsub (partial, "\n\255\252\001", "\255\252\001\n")
partial = string.gsub (partial, "\n\255\252\003", "\255\252\003\n")
-- 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
]]>
</script>
</muclient>