openkore icon indicating copy to clipboard operation
openkore copied to clipboard

eventMacro - Add hash variables support for SimpleHookEvent

Open Yakov-Chernogor opened this issue 7 years ago • 6 comments

https://github.com/OpenKore/openkore/issues/1256 This patch add possibility to get hash args from SimpleHookEvent call.

$.SimpleHookEventLast<capitalized hash name><capitalized hash key>

Macro example (to get sold item name):

automacro vend {
	SimpleHookEvent vending_item_sold
	call {
		log $.SimpleHookEventLastVendArticleName
	}
}

Yakov-Chernogor avatar Oct 11 '17 17:10 Yakov-Chernogor

need your review @Henrybk

alisonrag avatar Oct 11 '17 21:10 alisonrag

Seems good, I haven't tested it though. Maybe it could also support nested hashes and arrays using a while for the ref type instead of an if.

Henrybk avatar Oct 12 '17 01:10 Henrybk

looks good but can not test it now.... cause we need to check is there any nested hashes and arrays in there, if yes max nesting?

Mortimal avatar Oct 18 '17 23:10 Mortimal

Can smb give me alg to get all hooks in Kore?... i am so lost now

Mortimal avatar Oct 12 '19 09:10 Mortimal

@Mortimal https://openkore.com/wiki/hooks#Discovering_all_existing_hooks_Windows_Distro

alisonrag avatar Oct 12 '19 14:10 alisonrag

Found this already... only started: Plugins::callHook('checkPlayerCondition', %args); ACHTUNG! $player->{guild}{name} Plugins::callHook ('open_shop', {title => $shop{title}, items => @items}); ACHTUNG! @items - is array of hashes

Mortimal avatar Oct 16 '19 10:10 Mortimal

i think this is better: #3686

ya4ept avatar Dec 25 '22 23:12 ya4ept