|
本帖最后由 littleknife 于 2012-10-6 04:00 PM 编辑
- hubiao.robberIndex={"yellow","white","cyan","blue","red","lime","magenta","green",}
- ----丐帮white,武当white,桃花cyan,星宿blue,全真red,少林lime,
复制代码
- addtri("hubiao_rbinfo","^.*劫匪\\("..hubiao.Upper_playerid.."'s robber\\)\\w*","q_hubiao","hubiao.rbinfo")
复制代码- hubiao.rbinfo=function(name, line, wildcards, styles)
- col = string.find (line, "劫匪")
- if not col then
- print("::抓取失败::")
- return
- end
- style = GetStyle (styles, col)
- robberColor=RGBColourToName (style.textcolour)
- ----print ("劫匪的颜色:", robberColor)
- table.insert(hubiao.robberColor,robberColor)
- ------------------------------------------
- if simTableIndex(robberColor,hubiao.robberIndex)==-1 then
- table.insert(hubiao.robberIndex,robberColor)
- end
- ------------------------------------------
- end
复制代码
- function GetStyle (styleRuns, wantedColumn)
- local currentColumn = 1
- -- check arguments
- assert (type (styleRuns) == "table",
- "First argument to GetStyle must be table of style runs")
- assert (type (wantedColumn) == "number" and wantedColumn >= 1,
- "Second argument to GetStyle must be column number to find")
- -- go through each style
- for item, style in ipairs (styleRuns) do
- local position = wantedColumn - currentColumn + 1 -- where letter is in style
- currentColumn = currentColumn + style.length -- next style starts here
- if currentColumn > wantedColumn then -- if we are within this style
- return style, string.sub (style.text, position, position), item -- done
- end -- if found column
- end -- for each style
- -- if not found: result is nil
- end -- function GetStyle
复制代码
- addtri=function(triname,trimatch,trigroup,triscript,triflag,trisequence)
- if triflag==nil or triflag=="" then triflag=flag_base end
- if trisequence==nil then trisequence=10 end
- trireturnvalue=AddTriggerEx(triname, trimatch, "", triflag, -1, 0, "", triscript, 0, trisequence)
- SetTriggerOption(triname,"group",trigroup)
- return trireturnvalue
- end
复制代码
- function simTableIndex(str,list)
- for i,value in pairs(list) do
- if (value==str) then
- return i
- end
- end
- return -1
- end
复制代码
北大侠客行MUD,中国最好的MUD |
|