[Suggestion] Additional Method Hook
Posted: Sun Jul 21, 2013 7:29 pm
First, my English skill is poor. please try to understand what i mean. T^T
I just wanna suggest what i did to the scripts. ;D
Is it a good idea to add method hook for some action ? such as beforeBotFight and afterBotFight.
this is example for CPlayer:fight()
if i wanna use this method hook just add the function to userfunction, <onload> in waypoint.xml or <onload> in profile.xml
and the reason I added afterBotFight method because <onLeaveCombat> was hooked before looting. ;(
I just wanna suggest what i did to the scripts. ;D
Is it a good idea to add method hook for some action ? such as beforeBotFight and afterBotFight.
this is example for CPlayer:fight()
Code: Select all
function CPlayer:fight()
if( not self:haveTarget() ) then
return false;
end
pcall(beforeBotFight); -- i add beforeFight method hook here.
....
....
....
...
pcall(afterBotFight); -- and add afterFight method hook here.
end -- end of CPlayer:fight()
if i wanna use this method hook just add the function to userfunction, <onload> in waypoint.xml or <onload> in profile.xml
Code: Select all
<onload>
function afterBotFight()
cprintf(cli.yellow, "[INFO] this is afterBotFight() method.");
end
</onload>