关于wait.regexp使得匹配后该行保持有效的问题。
我在看http://blog.csdn.net/suxiaojack/archive/2008/10/10/3042706.aspx文章的时候,里面提到了1、修改wait.regexp使得匹配后该行保持有效,触发器仍旧为临时触发(一劳永逸。)
我想问问这个如何修改呢? function regexp (regexp, timeout)
local id = "wait_trigger_" .. GetUniqueNumber ()
threads = assert (coroutine.running (), "Must be in coroutine")
check (AddTriggerEx (id, regexp,
"-- added by wait.regexp",
trigger_flag.Enabled + trigger_flag.RegularExpression +
trigger_flag.Temporary + trigger_flag.Replace, -- + 注意这个
--trigger_flag.OneShot, -- 把此处注释就可以了,使得匹配后该行保持有效,触发器仍旧为临时触发
custom_colour.NoChange,
0, "",-- wildcard number, sound file name
"wait.trigger_resume",
12, 100))-- send to script (in case we have to delete the timer)
-- if timeout specified, also add a timer
if timeout and timeout > 0 then
local hours, minutes, seconds = convert_seconds (timeout)
-- if timer fires, it deletes this trigger
check (AddTimer (id, hours, minutes, seconds,
"DeleteTrigger ('" .. id .. "')",
timer_flag.Enabled + timer_flag.OneShot +
timer_flag.Temporary + timer_flag.Replace,
"wait.timer_resume"))
check (SetTimerOption (id, "send_to", "12"))-- send to script
-- if trigger fires, it should delete the timer we just added
check (SetTriggerOption (id, "send", "DeleteTimer ('" .. id .. "')"))
end -- if having a timeout
return coroutine.yield ()-- return line, wildcards
end -- function regexp
[ 本帖最后由 tianheng 于 2010-9-4 09:57 AM 编辑 ]
页:
[1]