Openkore.com

OpenKore Forums
It is currently 21 Sep 2018, 11:33

All times are UTC - 5 hours [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Plugin/Hook Question
PostPosted: 16 Apr 2008, 15:32 
Offline
Noob
Noob

Joined: 16 Apr 2008, 11:36
Posts: 1
Code from Receive.pm:
Code:
if ($actor->isa('Actor::Player')) {
         my $domain = existsInList($config{friendlyAID}, unpack("V1", $actor->{ID})) ? 'parseMsg_presence' : 'parseMsg_presence/player';
         debug "Player Exists: " . $actor->name . " ($actor->{binID}) Level $actor->{lv} $sex_lut{$actor->{sex}} $jobs_lut{$actor->{jobID}} ($coordsFrom{x}, $coordsFrom{y})\n", $domain;
         
         Plugins::callHook('player', {player => $actor});  #backwards compatibailty
         Plugins::callHook('player_exist', {player => $actor});



Im already done with initialization..

now my question is how to get the value of $actor->name in my subroutine.

this code doesn't return the right value:
sub player_disp {
..
..
my $charname= Actor::get($newactor->{player});
$ownername = $charname->name;
..
..
}


Top
 Profile  
 
 Post subject: Re: Plugin/Hook Question
PostPosted: 16 Apr 2008, 19:40 
Offline
Developers
Developers

Joined: 04 Apr 2008, 13:33
Posts: 157
Code:
sub player_disp {
   my $args = @_; #Declare the variable for arguments passed to the function
   
   my $actor = $args{player}; #Declare local variable for the actor object

   my $charname = $actor->name; #Access the actor object's name
}

_________________
Oh no.


Top
 Profile  
 
 Post subject: Re: Plugin/Hook Question
PostPosted: 22 Apr 2008, 02:00 
Offline
Perl Monk
Perl Monk

Joined: 04 Apr 2008, 17:26
Posts: 811
That +
Code:
use Globals;

_________________
cs : ee : realist


Top
 Profile  
 
 Post subject: Re: Plugin/Hook Question
PostPosted: 22 Apr 2008, 07:59 
Offline
Perl Monk
Perl Monk

Joined: 04 Apr 2008, 03:08
Posts: 416
or if the hook passes it to your plugin:

Code:
my ($self, $args) = @_;
my $myArg = $args->{myArgument};


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group