找回密码
 点一下
查看: 3117|回复: 6

TimerStart and GetExpiredTimer

[复制链接]
发表于 2010-1-13 21:36:20 | 显示全部楼层 |阅读模式
一直用在,但是觉得很诡异.
GetExpiredTimer()只会获得通过使用TimerStart来调用当前函数的计时器.是这样么?
真的好神奇啊!居然没有冲突.
//====== codes ===============
function Action_A takes nothing returns nothing
    local timer t = GetExpiredTimer()
    //** Actions *****
   set t = null
endfunction

function Test_A takes nothing returns nothing
    local timer t = CreateTimer()
    //** Other codes ******
    call TimerStart(t, 2.0, true, function Action_A)
    set t = null
endfunction

function Action_B takes nothing returns nothing
    local timer t = GetExpiredTimer()
    //** Actions *****
   set t = null
endfunction

function Test_B takes nothing returns nothing
    local timer t = CreateTimer()
    //** Other codes ******
    call TimerStart(t, 3.0, true, function Action_B)
    set t = null
endfunction
//====== end codes ===============

第2,第3秒,第4秒,自然是不会冲突的,但是在第6秒也不会冲突.真是太神奇了.
GetExpiredTimer()不是叫"获得到期的计时器么",第6秒显然有2个计时器同时到期,竟然没有冲突.太太太太神奇了.

所以,说了这么多废话,水了这半天.我想说的其实是----BLZ当时给这些本地函数命名的时候脑残了,然后导致我们的汉化也跟着一起脑残了.

好吧,这是个水帖...
发表于 2010-1-13 21:39:46 | 显示全部楼层
GetExpiredTimer的确是指“到期的计时器”,不过你要理解GetExpiredTimer所获得的是当前进程所唯一对应的Timer........
回复

使用道具 举报

发表于 2010-1-14 09:28:35 | 显示全部楼层
进程啊进程。虽然是同一个函数动作,但是进程不一样
回复

使用道具 举报

发表于 2010-1-14 11:32:52 | 显示全部楼层
跟函数一样   想一想函数叠代就清楚了
回复

使用道具 举报

发表于 2010-1-14 13:14:44 | 显示全部楼层
废话。。。
回复

使用道具 举报

 楼主| 发表于 2010-1-19 16:17:31 | 显示全部楼层
为什么不说是"线程".
还有.GA的JASS highlighter 怎么用啊?
//其实这是个水贴
回复

使用道具 举报

发表于 2010-1-19 22:55:07 | 显示全部楼层
jass加方括号
/jass加方括号
这样就可以了
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-4-27 17:25 , Processed in 0.163370 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表