文字MUD游戏论坛-天下泥潭群英会-水泊梁山  

返回   文字MUD游戏论坛-天下泥潭群英会-水泊梁山 > 西游之旅 > 『 机器人制作及下载 』

『 机器人制作及下载 』 如何从开始简单的数组、触发,到复杂的路径、地图、数据库等等。如何考虑周全的制作全自动的机器人让它能够24小时不停的帮你练功。

 
 
LinkBack 主题工具 主题评分 显示模式
旧 2011-09-12   #7
中级会员
级别:2 | 在线时长:29小时 | 升级还需:1小时级别:2 | 在线时长:29小时 | 升级还需:1小时
 
wormsking 的头像
 
注册: 08年07月03日
帖子: 139
声望力: 19
声望: 14 wormsking 闻道则喜
现金:104两梁山币
资产:304两梁山币
致谢数: 0
获感谢文章数:0
获会员感谢数:0
回复: MUSH417 xlqy各门派综合机器人

关键的xlqy.lua文件 配置所有任务的触发动作
包括li mp hb pj nt tf 任务
由于内容较多 估计要分N分了

require "global"
require "event_v2"

-- path
g_work_dir = "e:\\mushclient\\lua\\"

require "xlqy_map"

function on_linda_info(name, output, wildcards)
local answer = "江流儿"
cmdSender:Add("answer "..answer..";@10;i;kquest;@5;d;d;w;n;set no_teach dowhat")
end

function UpdateStatus()
local ntdo = ""
if g_renwu_nt then
ntdo = "yes"
else
ntdo = "no"
end

local ntfail = g_nt_errkill + g_nt_bekilled + g_nt_cancel

SetStatus(myid.." Hb:"..g_hb_success.."/"..g_hb_failure..",Li:"..g_li_success.."/"..g_li_failure..",Nt:"..g_nt_success.."/"..ntfail.."("..g_nt_cancel.."/"..g_nt_errkill.."/"..g_nt_bekilled..") NT:"..ntdo.." PJ:"..g_pj_killed.."/"..g_pj_cancel.." "..g_exp_gain.."/"..g_exp_permin..":"..g_exp.."/"..guai_place..":"..guai_name)
end


-- require "hb"
-- hb
filename = g_work_dir.."hb.txt"

zonepattern = ".*\/"
gfile = assert(io.open(filename,"r"));

function querydb(whowho)
who = GetTriggerInfo(whowho,101)
findpattern = GetTriggerInfo(whowho,102)
local find = false
Note(findpattern)
newpattern = string.gsub(findpattern,"■",".?.?")
Note(newpattern)
len = newpattern:len()
if len > 20 then
tmp = newpattern:sub(1,20)
newpattern = tmp
--Note("!!!too long!!!")
end

if gfile ~= nil then
Note("gfile\n")
gfile:seek("set")
repeat
t = gfile:read("*l")
if t ~= nil then
ft,ft2 = string.find(t,newpattern)
if ft ~= nil then
find = true

ft,ft2 = string.find(t,zonepattern)
if t:len() < 20 then
cmdSender:Add("tell "..who.." match="..t)
else
cmdSender:Add("tell "..who.." match="..t:sub(ft2+13,ft2+24))
end

if ft ~= nil then
cmdSender:Add("tell "..who.." where="..t:sub(ft,ft2))
else
cmdSender:Add("tell "..who.." where=unknow")
end
else
--Note(t)
end
else
end
until t == nil or find == true
end
end


-- look paper 看镖单的信息格式1
function OnHbInfo1(name, output, wildcards)
if wildcards[1] ~= "" then
HbProcess(wildcards[1])
end
end

function OnHbInfo11(name, output, wildcards)
local findpattern = wildcards[1]

if findpattern == "" then
return
end

Note(findpattern)
local find = false
local newpattern = string.gsub(findpattern,"■",".?.?")
local len = newpattern:len()
local t
if len > 20 then
local tmp = newpattern:sub(1,20)
newpattern = tmp
end

if gfile ~= nil then
gfile:seek("set")
repeat
t = gfile:read("*l")
if t ~= nil then
local ft,ft2 = string.find(t,newpattern)
if ft ~= nil then
find = true
end
else

end
until t == nil or find == true

if find == true then
cmdSender:Add("say hb "..t)
else
cmdSender:Add("@20;drop paper;set no_teach godz")
end
end
end

function OnHbInfo2(name, output, wildcards)
if wildcards[1] ~= "" then
HbProcess(wildcards[1])
end
end

-- look paper 看镖单的信息格式2
function OnHbInfo22(name, output, wildcards)
local findpattern = wildcards[1]

if findpattern == "" then
return
end
Note(findpattern)
local find = false
local newpattern = string.gsub(findpattern,"■",".?.?")
local len = newpattern:len()
local t
if len > 20 then
local tmp = newpattern:sub(1,20)
newpattern = tmp
end

if gfile ~= nil then
gfile:seek("set")
repeat
t = gfile:read("*l")
if t ~= nil then
local ft,ft2 = string.find(t,newpattern)
if ft ~= nil then
find = true
end
else
end
until t == nil or find == true

if find == true then
cmdSender:Add("say hb "..t)
else
cmdSender:Add("@20;drop paper;set no_teach godz")
end
end
end

function HbProcess(hbinfo)
g_hbpaper = hbinfo
local info1 = hbinfo
local info2 = string.gsub(info1, "■■", "■")
while info1 ~= info2 do
info1 = info2
info2 = string.gsub(info1, "■■", "■")
end
info2 = string.gsub(info2, "■", ";")
local hbinfolist = utils.split(info2, ";")

local hbinfo_counts = table.getn(hbinfolist)

local line
local finded = false
local tobreak = false

local i = hbinfo_counts
local patterns = hbinfo_counts
for i =1, hbinfo_counts do
Note(hbinfolist[i])
end
for i = 1, hbinfo_counts do
gfile:seek("set")
finded = false
repeat
local fail = false
line = gfile:read("*l")
if line then
for j = 1, patterns do
if string.find(line, hbinfolist[j]) then
--Note("find"..hbinfolist[j])
else
fail = true
break
end
end

if fail == false then
finded = true
end
end
until line == nil or finded

if finded == true then
break
end
patterns = patterns - 1
end

if finded == true then
g_hbline = line
Note("start find biao...")
Note(line)
local t1, t2 = string.find(line, "\/")

if t1 ~= nil then
Note("->"..string.sub(line, 1, t1 - 1))
g_hbmatch_times = 0

for i = 1, 10 do
DeleteTrigger("hbmatch"..i)
end

Note(line)
if patterns >= 10 then
patterns = 10
for i=1, patterns do
AddTriggerEx(
"hbmatch"..i,
".*"..string.sub(hbinfolist[i], 1, 2)..".*",
"",
trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating ,
0,
0,
"",
"OnHbMatched",
0,
90)
end
else
local n = 0
for i=1, patterns do
n = n + 1
AddTriggerEx(
"hbmatch"..n,
".*"..string.sub(hbinfolist[i], 1, 2)..".*",
"",
trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating ,
0,
0,
"",
"OnHbMatched",
0,
90)

end
for i=1, patterns do
if n >= 10 then
break
end

if hbinfolist[i]:len() >= 4 then
n = n + 1
AddTriggerEx(
"hbmatch"..n,
".*"..string.sub(hbinfolist[i], 3, 4)..".*",
"",
trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating ,
0,
0,
"",
"OnHbMatched",
0,
90)
end
end

for i=1, patterns do
if n >= 10 then
break
end

if hbinfolist[i]:len() >= 6 then
n = n + 1
AddTriggerEx(
"hbmatch"..n,
".*"..string.sub(hbinfolist[i], 5, 6)..".*",
"",
trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating ,
0,
0,
"",
"OnHbMatched",
0,
90)
end
end

for i=1, patterns do
if n >= 10 then
break
end

if hbinfolist[i]:len() >= 8 then
n = n + 1
AddTriggerEx(
"hbmatch"..n,
".*"..string.sub(hbinfolist[i], 6, 7)..".*",
"",
trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating ,
0,
0,
"",
"OnHbMatched",
0,
90)
end
end

for i=1, patterns do
if n >= 10 then
break
end

if hbinfolist[i]:len() >= 10 then
n = n + 1
AddTriggerEx(
"hbmatch"..n,
".*"..string.sub(hbinfolist[i], 9, 10)..".*",
"",
trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating ,
0,
0,
"",
"OnHbMatched",
0,
90)
end
end

for i=1, patterns do
if n >= 10 then
break
end

if hbinfolist[i]:len() >= 12 then
n = n + 1
AddTriggerEx(
"hbmatch"..n,
".*"..string.sub(hbinfolist[i], 11, 12)..".*",
"",
trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating ,
0,
0,
"",
"OnHbMatched",
0,
90)
end
end
for i=1, patterns do
if n >= 10 then
break
end

if hbinfolist[i]:len() >= 14 then
n = n + 1
AddTriggerEx(
"hbmatch"..n,
".*"..string.sub(hbinfolist[i], 13, 14)..".*",
"",
trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating ,
0,
0,
"",
"OnHbMatched",
0,
90)
end
end
for i=1, patterns do
if n >= 10 then
break
end

if hbinfolist[i]:len() >= 16 then
n = n + 1
AddTriggerEx(
"hbmatch"..n,
".*"..string.sub(hbinfolist[i], 15, 16)..".*",
"",
trigger_flag.Enabled + trigger_flag.RegularExpression + trigger_flag.Replace + trigger_flag.Temporary + trigger_flag.KeepEvaluating ,
0,
0,
"",
"OnHbMatched",
0,
90)
end
end
patterns = n
end
renwu = "护镖"
Note(g_hb_matchs)
g_hb_matchs = patterns
guai_place = string.sub(line, 1, t1 - 1)
--set_hbmatch(wildcards[2])
place_id()
go_place()
else
g_hb_matchs = 0
g_hbmatch_times = 0
Note(line)
cmdSender:Add("@20;drop paper;set no_teach godz")
end
else
g_hb_matchs = 0
Note(line)
cmdSender:Add("@20;drop paper;set no_teach godz")
end

end
wormsking 当前离线  
回复时引用此帖
 

添加到书签


发帖规则
不可以发表主师
不可以回复帖子
不可以上传附件
不可以编辑自己的帖子

论坛启用 vB 代码
论坛启用 表情图标
论坛启用 [IMG] 代码
论坛禁用 HTML 代码
Trackbacks are 启用
Pingbacks are 启用
Refbacks are 启用



所有时间均为格林尼治时间 +9, 现在的时间是 23:19.


Powered by SPLS
版权所有 2001-2023 水泊梁山
皖ICP备05012024号

站长 fengyue

Content Relevant URLs by vBSEO 3.6.1