|
发表于 2012-10-22 15:33:33
|
显示全部楼层
本帖最后由 Asuna 于 2012-10-22 15:40 编辑
不是太明白你的意思
TriggerAddAction函数的第二个参数必须是triggeraction,不能是integer
call TriggerAddAction(gg_trg____________________002, 8)这样写是肯定会报错的
如果想要把随便写的一个数字转换为对象,你需要1.20之前的ReturnBug
[jass]
function I2CD takes integer i returns code
return i
return null
endfunction
[/jass]
比如你写了这个I2CD函数之后,就可以
call TriggerAddAction(CreateTrigger(),I2CD(8))
使用I2CD(8) 将integer“8”转换为一个code对象了
id.w3x
(11.33 KB, 下载次数: 23)
例如此演示
[jass]
function TA2I takes triggeraction ta returns integer
return ta
return 0
endfunction
function I2TA takes integer i returns triggeraction
return i
return null
endfunction
function CD2I takes code c returns integer
return c
return 0
endfunction
function I2CD takes integer i returns code
return i
return null
endfunction
function Trig________________u_Actions takes nothing returns nothing
endfunction
function InitTrig________________u takes nothing returns nothing
local code c = function Trig________________u_Actions
local integer id
local triggeraction ta
set id = CD2I(c)
call DisplayTextToPlayer(Player(0),0,0,"某函数的ID是"+I2S(id))
set gg_trg________________u = CreateTrigger( )
set ta = TriggerAddAction( gg_trg________________u, I2CD(id))
call DisplayTextToPlayer(Player(0),0,0,"添加的动作的ID是"+I2S(TA2I(ta)))
call DisplayTextToPlayer(Player(0),0,0,"你也可以随便I2CD一个数字")
call TriggerAddAction(CreateTrigger(),I2CD(8))
call DisplayTextToPlayer(Player(0),0,0,"但是否那个数字是否对应着一个函数就要看你的运气了")
endfunction
[/jass] |
|