library PrintHandle initializer init
globals
private integer i
private trigger tr
endglobals
private function PrintHandleT takes nothing returns nothing
local location p=Location(0,0)
call DisplayTimedTextToPlayer(Player(0),0,0,60,"当前值:"+I2S(GetHandleId(p))+"——差值:"+I2S(GetHandleId(p)-i))
call RemoveLocation(p)
set p=null
endfunction
private function PrintHandleA takes nothing returns nothing
local location p
if IsTriggerEnabled(tr) then
call DisableTrigger(tr)
call ClearTextMessages()
else
set p=Location(0,0)
set i=GetHandleId(p)
call EnableTrigger(tr)
call RemoveLocation(p)
set p=null
endif
endfunction
private function init takes nothing returns nothing
local trigger t=CreateTrigger()
call TriggerRegisterPlayerChatEvent(t,Player(0),"-ph",true)
call TriggerAddCondition(t,Condition(function PrintHandleA))
set t=null
set tr=CreateTrigger()
call TriggerRegisterTimerEvent(tr,0.1,true)
call TriggerAddCondition(tr,Condition(function PrintHandleT))
call DisableTrigger(tr)
endfunction
endlibrary