|
本帖最后由 linjpen 于 2016-12-28 02:26 PM 编辑
直接进入正题:新手攻略看这里:http://pkuxkx.com/forum/viewthread.php?tid=18648&
技术指导1:http://pkuxkx.com/forum/viewthread.php?tid=38551&
技术指导2:http://pkuxkx.com/forum/viewthread.php?tid=37846&
技术指导3 http://pkuxkx.com/forum/viewthread.php?tid=39080&
一、挑水:没什么好说的,用SetSpeedWalkDelay,网速快用2000,保险用3000。
二、劈柴:借用cappuccino大大的基本能搞定了。
- map_wood = {
- ["小段"] = "small",
- ["弯曲"] = "bending",
- ["直"] = "straight",
- ["大段"] = "large",
- ["光滑"] = "smooth",
- ["粗糙"] = "rough",
- ["树枝"] = "branch",
- ["树杈"] = "crotch",
- ["树干"] = "trunk",
- ["树根"] = "root",
- }
- ^你从柴堆上拿走了一根(\S+)的(\S+)。$
- DoAfter(1, "put " .. map_wood["%1"] .. " " .. map_wood["%2"])
复制代码
三、诵经和超度
先把诵经地址,经书名字和经书章节抓下来
例:^[>]*\s*道果禅师说道:「今天的早课安排在(\S+),请某某诵唱(\S+)的(.*)
SetVariable ("sjdd", "%1")
SetVariable ("jsmz", "%2")
SetVariable ("jszj", "%3")
print(GetVariable("sjdd") , GetVariable("jsmz"))
因为诵经都在寺内,基本都在干路上,做一个遍历数组;比如sjbl={s;e;e;e;e;s;w;}--内容我是乱写的,具体自己遍历输入
然后进行遍历,路上抓取房间名:
匹配:^[> ]*.*\n(\S+)\s+\-\s+\Z
发送: SetVariable("roomid", "%1")
当房间名等于诵经地址一致时停下来开始找经书:if GetVariable("roomid") == GetVariable("roomid") then
EnableTrigger("walk", false)--停止走路
Execute("zhaojing") --开始找经书
end
之所以借用包裹来选经是因为后面超度回来借经书太坑了:
匹配:^[> ]*你从包袱中拿出一本(\S+)。$
- table.insert (shuming, "%1")--抓经书名到数组
- SetVariable ("shuming", "%1") --存取变量
- if GetVariable("shuming") == GetVariable("jsmz") then
- print(GetVariable("shuming"))
- for i,v in ipairs(shuming) do --遍历数组
- if v ~= GetVariable("jsmz") then Execute("put "..v.." in bao")-- 把其他经书放包裹
- end
- end
- DoAfter(2,"page 1")
- else Execute("get shu from bao")
- end
复制代码
然后翻经书,继续抓经书章节名字:
匹配:^[> ]*(.*)\n\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\n\=\=\s+\=\=\Z
发送:SetVariable("lsjszj","%1")
当这个临时章节名和诵经章节名市停止翻经书,准备诵经:if GetVariable("lsjszj") == GetVariable("jszj") then
Execute("ok")--做一个行为动作做触发.
匹配:^\=\=\s+(\S+)\s+\=\=$
记录经书内容:table.insert (jsnr, "%1")
匹配:^\S+经\s+第(\S+)页\/总\S+页.*
然后把它转成一个变量SetVariable ("nr",table.concat(jsnr))
然后可以用DoAfter(1,"chanting " .. GetVariable("jsys") .. " " .. GetVariable("nr") .. "") 诵经了,--哈哈,比起整本经书记录下做数据库是不是省力很多了。(不过我也不会做数据库,,,,,)
之后就是ljback(),路径反转,返回。- ljback=function()
- if lj == nil then
- lj=GetVariable("lj")
- lj = Split(lj,";") end
- lj = revlj(lj)
- SetVariable ("lj", table.concat(lj, ";"))
- --EnableTrigger("sj_walk", false)
- EnableTrigger("sj_back", ture)
- print(GetVariable("lj"))
- end
复制代码
五、敲钟(击鼓)
这个就是颜色触发了,没什么可说.
指导贴:http://pkuxkx.com/forum/viewthread.php?tid=8697&
最后放一些遍历必要代码,其实都是上面“”技术指导3“”里的内容:
- function Split(szFullString, szSeparator) --数组路径转换
- local nFindStartIndex = 1
- local nSplitIndex = 1
- local nSplitArray = {}
- while true do
- local nFindLastIndex = string.find(szFullString, szSeparator, nFindStartIndex)
- if not nFindLastIndex then
- nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, string.len(szFullString))
- break
- end
- nSplitArray[nSplitIndex] = string.sub(szFullString, nFindStartIndex, nFindLastIndex - 1)
- nFindStartIndex = nFindLastIndex + string.len(szSeparator)
- nSplitIndex = nSplitIndex + 1
- end
- return nSplitArray
- end
- function revlj(nowlj)--返回路径
- local lj=nowlj
- local i=table.getn(lj)
- local newlj={}
- for newi=1,i do
- newlj[newi]=revfx(lj[i+1-newi])
- end
- return newlj
- end
- function revfx(fx)--返回方向
- if fx=="enterbj" then return "outbj" end
- if fx=="outbj" then return "enterbj" end
- if fx=="swboxiaolu" then return "boxiaolune" end
- if fx==nil then return end
- if fx=="south" then return "north" end
- if fx=="east" then return "west" end
- if fx=="west" then return "east" end
- if fx=="north" then return "south" end
- if fx=="southup" then return "northdown" end
- if fx=="southdown" then return "northup" end
- if fx=="westup" then return "eastdown" end
- if fx=="westdown" then return "eastup" end
- if fx=="eastup" then return "westdown" end
- if fx=="eastdown" then return "westup" end
- if fx=="northup" then return "southdown" end
- if fx=="northdown" then return "southup" end
- if fx=="northwest" then return "southeast" end
- if fx=="northeast" then return "southwest" end
- if fx=="southwest" then return "northeast" end
- if fx=="southeast" then return "northwest" end
- if fx=="enter" then return "out" end
- if fx=="out" then return "enter" end
- if fx=="up" then return "down" end
- if fx=="down" then return "up" end
- if fx=="u" then return "d" end
- if fx=="d" then return "u" end
- if fx=="s" then return "n" end
- if fx=="e" then return "w" end
- if fx=="w" then return "e" end
- if fx=="n" then return "s" end
- if fx=="su" then return "nd" end
- if fx=="sd" then return "nu" end
- if fx=="wu" then return "ed" end
- if fx=="wd" then return "eu" end
- if fx=="eu" then return "wd" end
- if fx=="ed" then return "wu" end
- if fx=="nu" then return "sd" end
- if fx=="nd" then return "su" end
- if fx=="nw" then return "se" end
- if fx=="ne" then return "sw" end
- if fx=="sw" then return "ne" end
- if fx=="se" then return "nw" end
- if fx=="open gate" then return "knock gate" end
- if fx=="enter shudong" then return "out" end
- if fx=="kaimen" then return "qiaomen" end
- if fx=="qiaomen" then return "kaimen" end
- if fx=="yzshudong" then return "yzshudongb" end
- if fx=="yzshudongb" then return "yzshudong" end
- if fx=="enter dong" then return "outdong" end
- if fx=="outdong" then return "enter dong;sw" end
- return fx
- end
- function zhfx(fx)--赶车方向
- local fx=fx
- if fx=="u" then return "up" end
- if fx=="d" then return "down" end
- if fx=="s" then return "south" end
- if fx=="e" then return "east" end
- if fx=="w" then return "west" end
- if fx=="n" then return "north" end
- if fx=="su" then return "southup" end
- if fx=="sd" then return "southdown" end
- if fx=="wu" then return "westup" end
- if fx=="wd" then return "westdown" end
- if fx=="eu" then return "eastup" end
- if fx=="ed" then return "eastdown" end
- if fx=="nu" then return "northup" end
- if fx=="nd" then return "northdown" end
- if fx=="nw" then return "northwest" end
- if fx=="ne" then return "northeast" end
- if fx=="sw" then return "southwest" end
- if fx=="se" then return "southeast" end
- return fx
- end
- function transnumberc(str)--中文数字转阿拉伯数字
- if str=="" then return 0 end
- local a,b=string.find(str,"万")
- if a==nil then
- local strtemp=string.gsub(str,"零","")
- local res=0
- a,b=string.find(strtemp,"^.+千")
- if a~=nil then
- res=res+getnumberfromchinese(string.sub(strtemp,1,2))*1000
- strtemp=string.sub(strtemp,b+1)
- end
- a,b=string.find(strtemp,"^.+百")
- if a~=nil then
- res=res+getnumberfromchinese(string.sub(strtemp,1,2))*100
- strtemp=string.sub(strtemp,b+1)
- end
- a,b=string.find(strtemp,"^.*十")
- if a~=nil then
- if b~=2 then
- res=res+getnumberfromchinese(string.sub(strtemp,1,2))*10
- else
- res=res+10
- end
- strtemp=string.sub(strtemp,b+1)
- end
- if strtemp~=nil then
- res=res+getnumberfromchinese(strtemp)
- end
- return res
- else
- return transnumberc(string.sub(str,1,a-1))*10000+transnumberc(string.sub(str,b+1))
- end
- end
- function getnumberfromchinese(str)
- if str=="一" then return 1 end
- if str=="二" then return 2 end
- if str=="三" then return 3 end
- if str=="四" then return 4 end
- if str=="五" then return 5 end
- if str=="六" then return 6 end
- if str=="七" then return 7 end
- if str=="八" then return 8 end
- if str=="九" then return 9 end
- return 0
- end
- function zhfxlj(lj)--赶车用
- --local lj=lj
- local temi=1
- for i,v in ipairs(lj) do lj=zhfx(v) end
- return lj
- end
复制代码
走路的家伙:
- function bianli()
- if lj == nil then
- lj=GetVariable("lj")
- lj = Split(lj,";")
- end
- local i=tonumber(GetVariable("bianli_i"))-------bianli_i是个计数器,表明现在走到数组的哪一个元素了。
- local x=revfx(lj[i]) --返回方向,走过头用
- if tonumber(GetVariable("hubiao"))==1 then ------------hubiao个作为一个标志:如果为1就表明现在不带着镖车走,如果为0就得带着镖车走。
- if lj==nil or tostring(table.getn(lj))==GetVariable("bianli_i")
- then Note("已经走完了,还走个屁啊")
- Execute(lj[i])------这才是行走的命令
- EnableTrigger("sj_back", false)--结束走路
- DoAfterSpecial(1,"renwuqidian()",12)--判断是否来到原点
- else
- print("lj变量:",GetVariable("lj"))
- local s1="任务地点是: "..GetVariable("sjdd").." 当前行走段一共"..tostring(table.getn(lj)).."步,现在为 第"..GetVariable("bianli_i").."步"..",当前命令:"..lj[i]
- Note(s1)---------以上两行是用来提醒自己的。
- Execute(lj[i])------这才是行走的命令
- end
- if tonumber(GetVariable("sj_start"))==1 then sj() end--判断是否在诵经,
- elseif tonumber(GetVariable("hubiao"))==0 then
- if lj==nil then Note("已经走完了,还走个屁啊") return Note("到点了") end
- local s1="当前行走段一共"..tostring(table.getn(lj)).."步,现在为 第"..GetVariable("bianli_i").."步"..",当前命令:"..lj[i]
- Note(s1)
- end
-
- end
复制代码
ps:本人纯粹新手,以上全都是拿来主义,做好这个少林新手机器,感觉推车也不远了,然后胡一刀,萧峰还会远吗,,前面在等着我们!!自己动手征服才会带来快感~
以上,与众新手共勉,祝希望北侠人越来越多,越来越火,永立不到!!!
北大侠客行MUD,中国最好的MUD |
|