
/<
lastmsg=""
function 过验证()
local str=获取NPC对话内容()
if not str or str==lastmsg then return end -- 防止重复过
lastmsg = str
local tab={
{"加","+"},{"减","-"},{"乘","*"},{"除","/"},
{"+","+"},{"—","-"},{"×","*"},{"÷","/"},
{"%[","("},{"%]",")"},{"【","("},{"】",")"},
{"{","("},{"}",")"},{"<","("},{">",")"},
}
local function maskstr(str)
for k,v in ipairs(tab) do
str=str:gsub(v[1],v[2])
end
return str
end
if str:match("选择正确的答案") then
local sf=nil
local gs = str:match("([0-9+%+%-%—÷×%*加减乘除%[%]%(%)【】{}]+)=")
if gs then
print("计算公式:"..maskstr(gs))
sf = load("return "..maskstr(gs))
end
if sf then
local num = sf()
local nearest=65535
print("计算结果:"..num)
local cmd = nil
for k,c in str:gmatch("<(%d+)/(@[^>]+)>") do
if math.abs(k-num) < nearest then
nearest = math.abs(k-num)
cmd = c
end
end
if cmd then
print(cmd)
选择(cmd)
等待(1500)
end
end
end
end
过验证() -- 回收验证保留此行,删除下面一行
设置用户检测("过验证",2000) -- 脱机验证保留此行,删除上面一行
/>