Hello. (I do not know if I'm right in the area, but...)
Today,i was reading " How to write a plugin ". And the ask appeared.
In example :
Plugins::register("example", "Example Plugin", \&on_unload, \&on_reload);
my $aiHook = Plugins::addHook("AI_pre", \&on_AI);
I Don't know if i will get express me...Where i found others Hooks ! ?
A example :
AI_pre,mainLoop_pre,npc_on_talk !
Hooks above , i found it in others plugins.Help me.I'am trying create a plugin that activates when i receive a message in private.I can create a macro for this.But i try in a plugin,understand me?
I'am very bad with english.Sorry.
How i create a plugin,that activates when a people talks on chat ? or a people send a pm for me?
Thanks !
Sorry if i created this topic in wrong area
[Help] Plugin Creation
Moderator: Moderators
-
- Developers
- Posts: 1798
- Joined: 05 Dec 2008, 05:42
- Noob?: Yes
Re: [Help] Plugin Creation
Skyzer wrote:Where i found others Hooks ! ?
For every packet, there's hook "packet/<handler_name>", use src/Network/Receive/ServerType0.pm for a reference on handler names. For private message, it would be "packet/private_message".Skyzer wrote:I'am trying create a plugin that activates when i receive a message in private.
For other hooks, look in http://forums.openkore.com/viewtopic.php?t=8648 or look in the source for callHook calls.
How to write plugins for OpenKore
Re: [Help] Plugin Creation
Ok.Thanks.That part i understand.
To remember : I Read manual,i read manual in others forums,i try,i RACKED my brains and i couldn't finish plugin.Look :
In this plugin,i tried response a pm.In the plugins Hooks,i was get confused.in subOnPrivate,i tried create,type,a comparator.Oh I can not explain, this is my question.
You understand me?
When a people talk with me : Hello World,the plugin is activated and response to the people.The plugin is very wrong,no ?
I start with the plugin today.Sorry
To remember : I Read manual,i read manual in others forums,i try,i RACKED my brains and i couldn't finish plugin.Look :
Code: Select all
Package RespOnPm ;
use strict ;
use plugins ;
use Log qw(message) ; # So far so good
Plugins::register("responds after ask", "Responds yours Private messages" , \&onPrivate) ; #Are correctly?
Plugins::addHook("packet/private_message" \&onResp) ;
#Below here i get confused
sub onPrivate {
my ($args, undef) = @_
if ($args->{msg} =~ /(.*) : Hello World,How are you?/) {
onResp();
}
sub onResp {
Commands::run("pm $1 i'am fine") ;
}
1;
You understand me?
When a people talk with me : Hello World,the plugin is activated and response to the people.The plugin is very wrong,no ?
I start with the plugin today.Sorry