通脉尝试enforce的脚本
本帖最后由 suwuji 于 2018-3-6 02:42 AM 编辑--功能,自动比对正常穴位和异常穴位
-------------------------------------------------------
---通脉
function tm_detail_tr1()
tm_detail_mark = true
wait.make(function()
tm_detail_all = ""
while tm_detail_mark==true do
local l,w = wait.regexp(".+",1)
if l~=nil then
if tm_detail_start==true then
tm_detail_all = tm_detail_all .. l
end
end
end
end)
end
function tm_detail_tr2()
tm_detail_mark = true
wait.make(function()
while tm_detail_mark==true do
local l,w = wait.regexp("───────────────────────────────────────────────",1)
if l~=nil then
if tm_detail_start~=true then
tm_detail_start = true
else
tm_detail_start = false
end
end
end
end)
end
function tmDetail()
wait.make(function()
tm_detail_mark = true
tm_detail_all = ""
tm_detail_tr1()
tm_detail_tr2()
Execute("vein detail")
wait.time(0.5)
local wc = 1
while tm_detail_start == true and wc<30 do
wait.time(0.1)
wc = wc + 1
end
tm_detail_mark = nil
tm_detail_start= nil
tm_detail_all = string.gsub(tm_detail_all,"[ ○◎⊕●\r\n─%]]","")
tm_detail_all = string.gsub(tm_detail_all,"%d+","")
tm_detail_all_ret = utils.split(tm_detail_all,"[")
table.remove(tm_detail_all_ret,table.getn(tm_detail_all_ret))
end)
end
function tmGoodInit()
if tmGoodInit_mark ~=true then
tmGoodInit_mark = true
wait.make(function()
tmDetail()
while tm_detail_mark == true do
wait.time(0.1)
end
tm_good_all_xue_wei = tm_detail_all_ret
tmGoodInit_mark = nil
end)
end
end
function tmCheckEnforce()
if tmCheckEnforce_mark ~=true then
tmCheckEnforce_mark = true
wait.make(function()
--复制一下好的
local all_xue_wei = {}
for k,v in ipairs(tm_good_all_xue_wei) do
all_xue_wei=v
end
--查看当前
tmDetail()
while tm_detail_mark == true do
wait.time(0.1)
end
local tm_now_xue_wei = tm_detail_all_ret
--测试随机删除一个
table.remove(tm_now_xue_wei,math.random(table.getn(tm_now_xue_wei)-1))
--正式用注销上面
for k,v in ipairs(tm_now_xue_wei) do
for kk,vv in ipairs(all_xue_wei) do
if vv == v then
table.remove(all_xue_wei,kk)
break
end
end
end
--
tprint(all_xue_wei)
--
if table.getn(all_xue_wei)==1 then
--正使用打开这个
--Execute("vein enforce "..all_xue_wei)
end
tmCheckEnforce_mark = nil
end)
end
end
--通脉
---------------------------------------------------
全放入游戏脚本里
使用时先用tmGoodInit()抓取一次正常穴位值,需要检查穴位时用tmCheckEnforce()
----------------------------------------------------------------------------------------------
上面的脚本已经失效仅供参考,通脉中实际提示enforce时仅仅会出现一次错误穴位图谱,而且gsub方式批量替换有的穴位名称会出现乱码
----------------------------------------------------------------------------------------------
参考:把gsub修正为gmatch方式
tm_detail_all_ret = {}
for tm_detail_one_xue_wei in string.gmatch(tm_detail_all,"[○◎⊕●]+([^%[]*)%[%d+%]") do
table.insert(tm_detail_all_ret,tm_detail_one_xue_wei)
end
print("穴位:"..#tm_detail_all_ret.."个") 这个好,学习了
页:
[1]