Openkore.com

OpenKore Forums
It is currently 01 Apr 2020, 13:05

All times are UTC - 5 hours [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Plugin help
PostPosted: 11 Jun 2011, 10:20 
Offline
Human
Human

Joined: 17 May 2011, 07:09
Posts: 38
I am having error with this plugin I made. I have read the wiki and some src files of Kore.
Loading the plugin, kore goes...
Code:
Loading all plugins...
Loading plugin plugins/cartsell.pl...
This plugin cannot be loaded because of a problem in the plugin. Please notify
the plugin's author about this problem, or remove the plugin so OpenKore can
start.

The error message is:

Press ENTER to exit this program.

A blank error message, after removing common errors, left me clueless.
Here's my source code:
Code:
package CartSell;

use strict;
use Globals;
use Log qw(message error);
use Utils;
use Network::Send;
use Misc;
use AI;
use AI::Corelogic;
use Translation;

Plugins::register('autocartsell', 'Sell items from cart', \&unload);
#my $hooks = Plugins::addHooks(['AI_pre', \&AI_hook]);
my $commandsID = Commands::register(["autocartsell", "Sell items from cart", \&cmdCartSell]);

my $cartSearch;

sub unload {
   #Plugins::delHooks($hooks);
   Commands::unregister($commandsID);
}

sub cmdCartSell {
   my @getItems;
   my @sellItems;
   my $args = AI::args;
   
      $args->{cartNextItem} = 0 unless $args->{cartNextItem};
      for (my $i = $args->{cartNextItem}; $i < @{$cart{inventory}}; $i++) {
         my $item = $cart{inventory}[$i];
         next unless ($item && %{$item});
         my $control = items_control($item->{name});
         if ($control->{'sell'} && $item->{'amount'} > $control->{keep}) {
         
            if ($args->{cartLastIndex} == $item->{index} &&
                timeOut($timeout{'ai_sellAuto_giveup'})) {
               return;
            } elsif ($args->{cartLastIndex} != $item->{index}) {
               $timeout{ai_sellAuto_giveup}{time} = time;
            }
            
         undef $args->{done};
         $args->{cartLastIndex} = $item->{index};
         my %cartObj;
         $cartObj{index} = $i;
         my $amount = $item->{amount} - $control->{keep};
         $cartObj{amount} = $amount;
         push @getItems, \%cartObj;
         cartGet(\@getItems);
         $timeout{ai_sellAuto}{time} = time;
         $args->{cartNextItem} = $i + 1;
         
            if ($char->{weight} > 89) {
               processAutoSell();
               $i = $i - 1;
            }
         }
      }
}

   


Did I use any unnecessary packages?
Idea is that Kore should get items from cart until he goes overweight 90%, then Kore would do go autosell.
What's wrong with it or is it wrong as a whole. I removed $hooks though.

_________________
オペンコレ!


Top
 Profile  
 
 Post subject: Re: Plugin help
PostPosted: 11 Jun 2011, 10:30 
Offline
Developers
Developers

Joined: 05 Dec 2008, 05:42
Posts: 1811
Quote:
Can't locate AI/Corelogic.pm in @INC

It's CoreLogic, and you don't need to include it.


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