找回密码
 点一下
查看: 1946|回复: 5

如何在T中使用Timer?

[复制链接]
发表于 2009-8-15 12:02:22 | 显示全部楼层 |阅读模式
勉強做了個刷兵的jass,但是不會在T中調用,
第1個CreateUints直接調用就行了,但是下面那段事件又如何調用?
我的本意是做一個刷兵模板,想刷什麽兵,什麽時候刷出來,直接在T中調用CreateUnits和ShuaBing
這兩個函數然後傳遞些值就可以用了.
[trigger]
function CreateUnits takes player P,integer Uid,location point,integer angel,location targetpoint,integer num returns nothing
    local unit u
    local integer i
    loop
        set i=i+1
        exitwhen i>num
        set u=CreateUnitAtLoc(P,Uid,point,angel)
        call IssuePointOrderLoc( GetLastCreatedUnit(), "patrol", targetpoint )
        set u=null
    endloop
    call RemoveLocation( point )
    call RemoveLocation( targetpoint )
endfunction
//===========================================================================
function ShuaBing takes integer Ctimes returns nothing
    local timer tm=CreateTimer()
    call TimerStart(tm,Ctimes,true,function CreateUnits)
    set tm=null
endfunction
[/trigger]

還是說,一定要是純文本格式才能使用下面這段?
发表于 2009-8-18 12:47:57 | 显示全部楼层
放到自定义函数里……
T中直接用自定义代码就O
CALL …………
回复

使用道具 举报

发表于 2010-1-10 00:33:24 | 显示全部楼层
code 必须是  Function XXX takes nothing returns nothing 这种函数
code cd
set cd=function xxx
timerstart(t,...,cd) 这样就行了
回复

使用道具 举报

发表于 2010-1-10 01:26:31 | 显示全部楼层
。。。。。实际上。。timer中的那个函数是不能有参数的。。。所以不会成功。。。要是让其能传递参数的话。。。老版本用retrun bug+GC。。。1.24以后就可以直接用
hash表了额。。。。
回复

使用道具 举报

发表于 2010-1-10 07:15:50 | 显示全部楼层
引用第2楼rook47于2010-01-10 00:33发表的  :

code 必须是  Function XXX takes nothing returns nothing 这种函数
code cd
set cd=function xxx
timerstart(t,...,cd) 这样就行了

………………
[jass]
timerstart(t,...,function XXXX)
[/jass]
应该是这样吧……
回复

使用道具 举报

发表于 2010-1-10 14:18:14 | 显示全部楼层
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-27 14:44 , Processed in 0.038294 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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