SimpleHookEvent

From OpenKore Wiki
Jump to navigation Jump to search
SimpleHookEvent
  • Description: Is checked every time the hook you set, is triggered.
Syntax:
SimpleHookEvent <hook name>
Example:
SimpleHookEvent target_died
Set all variables the hook have as:
$.SimpleHookEventLast <Capitalized variable name>


Example 1:
Plugins::callHook("target_died", {monster => $monsters_old{$ID}});

SimpleHookEvent target_died
$.SimpleHookEventLastMonster => monster ID in target_died hook
Example 2:
Plugins::callHook ('open_shop', {title => $shop{title}, items => \@items});

SimpleHookEvent open_shop
$.SimpleHookEventLastTitle
@.SimpleHookEventLastItems
$.SimpleHookEventLastItems[0]
Example 3:
my %hook_args = (
 serverIndex => $index,
 itemID => $itemID,
);
Plugins::callHook('packet_useitem', \%hook_args);

SimpleHookEvent packet_useitem
%.SimpleHookEventLastHook_args
$.SimpleHookEventLastHook_args{serverIndex}