|
发表于 2015-9-12 14:37:29
|
显示全部楼层
回复 3# nozshand
那个istillsun就是我。。。都说了让你去看代码了。。。
无语,直接给你贴出代码来好了。。。- ------创建多行触发------
- html_replacements = {
- ["<"] = "<",
- [">"] = ">",
- ["&"] = "&",
- ['"'] = """,
- }
- -- fix text so that < > & and double-quote are escaped
- function fixhtml (s)
- return (string.gsub (tostring (s), '[<>&"]',
- function (str)
- return html_replacements [str] or str
- end ))
- end -- fixhtml
- function GeneralAdd (t, which, plural)
- assert (type (t) == "table", "Table must be supplied to add a " .. which)
- local k, v
- local xml = {}
- local send = fixhtml (t.send or "") -- send is done differently
- t.send = nil
- -- turn into XML options
- for k, v in pairs (t) do
- -- fix true/false to y/n
- if v == true then
- v = "y"
- elseif v == false then
- v = "n"
- end -- if true or false
- table.insert (xml, k .. '="' .. fixhtml (v) .. '"')
- end -- for loop
- assert (ImportXML (string.format (
- "<%s><%s %s >%s%s>%s>",
- plural, -- eg. triggers
- which, -- eg. trigger
- table.concat (xml, "\n"), -- eg. match="nick"
- send, -- eg. "go north"
- which, -- eg. trigger
- plural) -- eg. triggers
- ) == 1, "Import of " .. which .. " failed")
- end -- GeneralAdd
- function LuaAddTrigger (t)
- GeneralAdd (t, "trigger", "triggers")
- end -- LuaAddTrigger
- LuaAddTrigger { match = "^.*\\|.*\\|.*\\|.*\\|.*$\\n^.*\\|.*\\|.*\\|.*\\|.*$\\n^.*\\|.*\\|.*\\|.*\\|.*$\\n^.*\\|.*\\|\\s*(\\d+)\\s*\\d+\\s*\\|.*\\|.*$\\n^.*\\|.*\\|.*\\|.*\\|.*\\Z",
- regexp = true,
- ['repeat'] = true, -- repeat is lua keyword
- send = "qlingwu.maxlevel\("%1"\)",
- sequence = 50,
- enabled = true,
- lines_to_match=5,
- multi_line=true,
- send_to=12,
- group="q_qlingwu",
- name="max_level",
- }
- ------多行触发结束------
复制代码 |
|