Nick's "Prompt Newline" script no longer works in the new Lua engine introduced in 3.80 (I upgraded from 3.78 to 3.82). The entire file is below. I can't figure out how to fix it myself (I code in VBScript, not Lua), so I was wondering if anyone (see: Nick :D) could fix up the code so that it'll work as it should (namely, allow me to trigger on the last line of the prompt). Thanks!
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient[
<!ENTITY prompt_regexp "^Alisha \- \((.*?)\/(.*?) (.*?)\/(.*?) (.*?)\/(.*?) (.*?) (.*?)\/(.*?)\) (.*?)$" >
]>
<!-- MuClient version 3.59 -->
<!-- Plugin "Add_Newline_To_Prompt" generated by Plugin Wizard -->
<muclient>
<plugin
name="Add_Newline_To_Prompt"
author="Nick Gammon"
id="8316c19c35a9ebdb46055874"
language="Lua"
purpose="Adds a newline to prompt lines"
date_written="2004-12-13 12:08:00"
requires="3.59"
version="1.0"
>
<description trim="y">
Detects prompt lines without a newline, and if found, adds one.
Change ENTITY line on 3rd line of plugin to be a regular expression
that matches your prompt.
</description>
</plugin>
<!-- Script -->
<script>
re = rex.new ("&prompt_regexp;")
<![CDATA[
partial = "" -- partial line from last time through
function OnPluginPacketReceived (s)
-- add packet to what we already have (excluding carriage-returns)
partial = partial .. string.gsub (s, "\r", "")
t = {} -- table of lines to be returned
-- iterate over each line
partial = string.gsub (partial, "(.-)\n",
function (line) table.insert (t, line) end)
-- look for prompt
if (re:match (partial)) then
table.insert (t, partial)
partial = ""
end -- if found prompt
if table.getn (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 -- function OnPluginPacketReceived
]]>
</script>
</muclient>
|