Openkore.com

OpenKore Forums
It is currently 22 Sep 2018, 07:59

All times are UTC - 5 hours [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: get value from hook network receive packet_vender_strore2
PostPosted: 26 Mar 2013, 00:52 
Offline
Human
Human

Joined: 03 Dec 2008, 15:46
Posts: 22
my plugin code like this

print function for hook packet_vender_store2 just return in address memory of array
how should the method of data collection from array memory?

print "@itemList\n"; // this print quene just return in address memory of ARRAY(0x.......)

@itemList is a member of \@venderItemList in hook plugin from network receive servertype0

and how to extract data from @itemList in my plugin code?

@itemList should be containing the data from vender item list
as contains args:
$item->{price},
$item->{amount},
$index,
$item->{type},
$item->{nameID},
$item->{identified}, # should never happen
$item->{broken}, # should never happen
$item->{upgrade},
$item->{cards}

it's should be print item name if i print : just return empty string
print ("$itemList[$index]->{name}");
$index same with index in item vender

print for array addres memory didn't work
print "@{@itemList}\n";

#########################
Code:
package vender;

use strict;
use Plugins;
use Globals;
use Utils;
use Misc;
use Log qw(message warning error debug);
use AI;
use Misc;
use Network;
use Network::Send;

# startup
Plugins::register('vender', 'automatically buy items from merchant vendors', \&Unload, \&Reload);

my $venderItemList = Plugins::addHook('packet_vender_store2', \&itemList);

sub Unload {
   message "vender plugin unloading, ";
   Plugins::delHook('packet_vender_store2', $venderItemList);
}

my $delay = 0.8;
my $time = time;

sub itemList {

   my ($packet, $args) = @_;
   my $venderID = $args->{venderID};
   my @itemList = $args->{itemList};

   print "@itemList\n"; // this print quene just return in address memory of ARRAY(0x.......)

}

# from src network receive servertype0
   Plugins::callHook('packet_vender_store2', {
      venderID => $venderID,
      itemList => \@venderItemList
   });


Top
 Profile  
 
 Post subject: Re: get value from hook network receive packet_vender_strore2
PostPosted: 26 Mar 2013, 14:05 
Offline
OpenKore Monk
OpenKore Monk

Joined: 08 Jun 2012, 15:42
Posts: 401
Location: Brazil
I do not know if I understand right what you want... Could you explain better?

Why not use the hook packet_vender_store?
It will fire every item analysis of the store. If the store has 5 items, will fire 5 times, once for each item.

_________________
Image


Top
 Profile  
 
 Post subject: Re: get value from hook network receive packet_vender_strore2
PostPosted: 29 Mar 2013, 02:47 
Offline
Human
Human

Joined: 03 Dec 2008, 15:46
Posts: 22
KeplerBR wrote:
I do not know if I understand right what you want... Could you explain better?

Why not use the hook packet_vender_store?
It will fire every item analysis of the store. If the store has 5 items, will fire 5 times, once for each item.


in my plugin sub :
Code:
sub itemList {

   my ($packet, $args) = @_;
   my $venderID = $args->{venderID};
   my @itemList = $args->{itemList};

   print "@itemList\n"; // this print quene just return in address memory of ARRAY(0x.......)

}


why my variable @itemList is filled with memory addres and it's not fill with vender itemList array data?

packet_vender_store next hook is too fast for my scanning item list for vender,
packet_vender_store2 just hooking after entering vender shop, it just hooking once, and hook time delay for next hooking can be setting with my timeout


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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