找回密码
 点一下
查看: 747|回复: 3

为何找不到函数

[复制链接]
发表于 2011-11-13 15:14:02 | 显示全部楼层 |阅读模式
[jass]
globals
udg_Hash = InitHashtable()
endglobals

function RectilinearMotion takes unit mover, real v,real s returns nothing
    local timer t = CreateTimer()
    call SaveUnitHandle(udg_Hash, GetHandleId(t), 0, mover)
    call SaveReal(udg_Hash, GetHandleId(t), 1, v/100)
    call SaveInteger(udg_Hash, GetHandleId(t), 2, R2I(s/v*100))
    call SaveInteger(udg_Hash, GetHandleId(t), 3, 0)
    call TimerStart(t, 0.01, true, function RectilinearMotionTimer)
endfunction

function RectilinearMotionTimer takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit mover = LoadUnitHandle(udg_Hash, GetHandleId(t), 0)
    local real v = LoadReal(udg_Hash, GetHandleId(t), 1)
    if LoadInteger(udg_Hash, GetHandleId(t), 3)<LoadInteger(udg_Hash, GetHandleId(t), 2) then
        call SetUnitX(mover, GetUnitX(mover)+ v*Cos(GetUnitFacing(mover)*bj_DEGTORAD))
        call SetUnitY(mover, GetUnitY(mover)+ v*Sin(GetUnitFacing(mover)*bj_DEGTORAD))
    else
        call FlushChildHashtable(udg_Hash, GetHandleId(t))
        call DestroyTimer(t)
    endif
endfunction
[/jass]
JassHelper报错“Undefined function RectilinearMotionTimer”,求解为何
发表于 2011-11-13 15:26:17 | 显示全部楼层
大哥。。麻烦下次截error的全图……


在RectilinearMotion里调用了下面的RectilinearMotionTimer,于是JassHelper在RectilinearMotion上面找不到RectilinearMotionTimer。。。。
回复

使用道具 举报

 楼主| 发表于 2011-11-13 15:32:08 | 显示全部楼层
多谢
至于截图问题我会注意的~
回复

使用道具 举报

发表于 2011-11-14 09:02:12 | 显示全部楼层
函数申明要放在调用之前.
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-10-5 22:17 , Processed in 0.035169 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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