I'm sorry if this question was already asked but quick check of topics didn't show me similar issues (unless I overlooked it).
I'm trying to write an automacro which reacts on some events using hooks. For some unclear reason, I can't find a way to pass assigned values from hook to subroutine, openkore returns an error no matter what I try.
Some example:
Code: Select all
automacro PM {
hook packet_privMsg
save Msg
call {
$msg = $.hooksave0
$len = len($msg)
log He said $msg and it has $len characters
}
}
sub len {
my ($str) = @_;
return length($str)
}
But if you try to replace $.hooksave0 in $msg with "Test private message", it will work (so, there is no problem with the code itself).(From: Tester) : Test private message
[macro] automacro PM triggered.
[macro] PM.call error: error in 1: len($msg) failed
I'm completely lost at this point, I don't know how to make it possible to pass events values to subroutines.