Openkore.com

OpenKore Forums
It is currently 20 Apr 2014, 22:06

All times are UTC - 5 hours [ DST ]





Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: SVN 2.1 | plugin error
PostPosted: 07 Apr 2010, 07:10 
Offline
Noob
Noob

Joined: 07 Apr 2010, 07:02
Posts: 3
I use Openkore What will become 2.1 SVN

I use a plugin avoidSkill.pl cause error, please tell me what to do.

I attach a file plugin already.

Code:
package avoidSkill;

use strict;

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

Plugins::register('avoidSkill', 'Avoid from skills', \&onUnload);

my $hooks = Plugins::addHooks(
        ['AI_pre', \&AI_hook],
        ['is_casting', \&hookAvoidSkill]
);

my $prefix = "avoidSkill_";
my $prefix2 = "_afterCast";

sub onUnload {
        Plugins::delHooks($hooks);
}

sub hookAvoidSkill {
        return if (!$config{autoAvoidSkill});

        my $hookName = shift;
        my $args = shift;
        my $sourceID = $args->{sourceID};
        my $targetID = $args->{targetID};
        my $source = $args->{source};
        my $skill = $args->{skill};
        my $skillID = $args->{skillID};
        my $x = $args->{x};
        my $y = $args->{y};
        my $i = 0;

        while (exists $config{$prefix.$i}) {
                my ($dist, %coords);
                if ($x != 0 || $y != 0) {
                        # If $dist is positive we are in range of the attack?
                        $coords{x} = $x;
                        $coords{y} = $y;
                        $dist = judgeSkillArea($skillID) - distance($char->{pos_to}, \%coords);
                }
                if (existsInList($config{$prefix.$i}, $skill->name) && $sourceID ne $accountID) {
                        if ($dist > 0 || $targetID eq $accountID) {
                                AI::queue("avoidskill");
                                AI::args->{timeout} = ($source->{casting}->{castTime} - $config{$prefix.$i."_delay"})/1000;
                                AI::args->{timeout} = 0 if (AI::args->{timeout}*1000 == $source->{casting}->{castTime} || AI::args->{timeout} < 0);
                                AI::args->{time} = time;
                                my $lvl;
                                my $skillUse = new Skills(name => $config{$prefix.$i."_use"});
                                if ($config{$prefix.$i."_lvl"}>$char->{skills}{$skillUse->handle}->{lv} || !$config{$prefix.$i."_lvl"}) {
                                        $lvl = $char->{skills}{$skillUse->handle}->{lv};
                                } else {
                                        $lvl = $config{$prefix.$i."_lvl"};
                                }
                                AI::args->{lvl} = $lvl;
                                AI::args->{skillID} = $skillUse->id if ($lvl > 0);
                                if (ai_getSkillUseType($skillUse->handle)) {
                                        AI::args->{char_state} = whenGroundStatus($char->{pos_to}, $skillUse->name);
                                } else {
                                        AI::args->{char_state} = existsInList(join(",", keys %{$char->{statuses}}), $skillUse->name);
                                }
                                AI::args->{i} = $i;
                                Commands::run($config{$prefix.$i."_doCommand"}) if ($config{$prefix.$i."_doCommand"} ne "");
                        }
                }
                $i++;
        }
}

sub AI_hook {
        AI::dequeue if (AI::action eq "avoidskill" && AI::args->{skillID} eq "");
        if (AI::action eq "avoidskill" && timeOut(AI::args)) {
                my $i = AI::args->{i};
                my $skillUse = new Skills(id => AI::args->{skillID});
                if (ai_getSkillUseType($skillUse->handle)) {
                        if (whenGroundStatus($char->{pos_to}, $skillUse->name) == AI::args->{char_state}) {
                                $messageSender->sendSkillUseLoc(AI::args->{skillID}, AI::args->{lvl}, $char->{pos_to}{x}, $char->{pos_to}{y});
                        } elsif (!AI::args->{dequeue} && $config{$prefix.$i.$prefix2}) {
                                AI::args->{timeout} = $config{$prefix.$i.$prefix2."_wait"};
                                AI::args->{time} = time;
                                my $lvl;
                                my $skillUseAfter = new Skills($config{$prefix.$i.$prefix2."_use"});
                                if ($config{$prefix.$i.$prefix2."_lvl"}>$char->{skills}{$skillUseAfter->handle}->{lv} || !$config{$prefix.$i.$prefix2."_lvl"}) {
                                        $lvl = $char->{skills}{$skillUseAfter->handle}->{lv};
                                } else {
                                        $lvl = $config{$prefix.$i.$prefix2."_lvl"};
                                }
                                AI::args->{lvl} = $lvl;
                                AI::args->{skillID} = $skillUseAfter->id if ($lvl > 0);
                                AI::args->{char_state} = whenGroundStatus($char->{pos_to}, $skillUseAfter->name);
                                AI::args->{dequeue} = 1;
                        } else {
                                Commands::run($config{$prefix.$i.$prefix2."_doCommand"}) if ($config{$prefix.$i.$prefix2."_doCommand"} ne "");
                                AI::dequeue;
                        }
                } else {
                        if (existsInList(join(",", keys %{$char->{statuses}}), $skillUse->name) == AI::args->{char_state}) {
                                $messageSender->sendSkillUse(AI::args->{skillID}, AI::args->{lvl}, $accountID);
                        } elsif (!AI::args->{dequeue} && $config{$prefix.$i.$prefix2}) {
                                AI::args->{timeout} = $config{$prefix.$i.$prefix2."_wait"};
                                AI::args->{time} = time;
                                my $lvl;
                                my $skillUseAfter = new Skills($config{$prefix.$i.$prefix2."_use"});
                                if ($config{$prefix.$i.$prefix2."_lvl"}>$char->{skills}{$skillUseAfter->handle}->{lv} || !$config{$prefix.$i.$prefix2."_lvl"}) {
                                        $lvl = $char->{skills}{$skillUseAfter->handle}->{lv};
                                } else {
                                        $lvl = $config{$prefix.$i.$prefix2."_lvl"};
                                }
                                AI::args->{lvl} = $lvl;
                                AI::args->{skillID} = $skillUseAfter->id if ($lvl > 0);
                                AI::args->{char_state} = existsInList(join(",", keys %{$char->{statuses}}), $skillUseAfter->name);
                                AI::args->{dequeue} = 1;
                        } else {
                                Commands::run($config{$prefix.$i.$prefix2."_doCommand"}) if ($config{$prefix.$i.$prefix2."_doCommand"} ne "");
                                AI::dequeue;
                        }
                }
        }
}

return 1;


Attachments:
avoidSkill.pl [6.69 KiB]
Downloaded 169 times
Top
 Profile  
 
 Post subject: Re: SVN 2.1 | plugin error
PostPosted: 07 Apr 2010, 14:56 
Offline
Developers
Developers

Joined: 05 Dec 2008, 05:42
Posts: 1874
konkang wrote:
I use a plugin avoidSkill.pl cause error, please tell me what to do.

You can enjoy your error message and other valuable information in solitude.


Top
 Profile  
 
 Post subject: Re: SVN 2.1 | plugin error
PostPosted: 13 Apr 2010, 12:00 
Offline
Noob
Noob

Joined: 07 Apr 2010, 07:02
Posts: 3
Code:
OpenKore version what-will-become-2.1 (SVN Version)
@ai_seq =
Network state = 5
Network handler = Network::XKore
SVN revision: 7230
Loaded plugins:
  plugins/avoidSkill.pl (avoidSkill)

Error message:
Can't locate object method "name" via package "Skill" at C:/Documents and Settings/xcool/Desktop/opl svn/openkore_ready/home/openkore/svnsnapshots/openkore_ready/plugins/avoidSkill.pl line 50.

Stack trace:
Can't locate object method "name" via package "Skill" at C:/Documents and Settings/xcool/Desktop/opl svn/openkore_ready/home/openkore/svnsnapshots/openkore_ready/plugins/avoidSkill.pl line 50.
at C:/Documents and Settings/xcool/Desktop/opl svn/openkore_ready/home/openkore/svnsnapshots/openkore_ready/plugins/avoidSkill.pl line 50
   avoidSkill::hookAvoidSkill('is_casting', 'HASH(0x3d8be64)', undef) called at src/Plugins.pm line 431
   Plugins::callHook('is_casting', 'HASH(0x3d8be64)') called at src/Network/Receive/ServerType0.pm line 5396
   Network::Receive::ServerType0::skill_cast('Network::Receive::ServerType8_4=HASH(0x3854374)', 'HASH(0x3e16f4c)') called at src/Network/Receive.pm line 193
   Network::Receive::parse('Network::Receive::ServerType8_4=HASH(0x3854374)', '>\x{1}\x{f9}\x{9e}\x{1e}\x{0}\x{f9}\x{9e}\x{1e}\x{0}\x{0}\x{0}\x{0}\x{0}\x{91}\x{1}\x{0}\x{0}\x{0}\x{0}\x{13}\x{1}\x{0}\x{0}') called at src/functions.pl line 1294
   main::parseIncomingMessage('>\x{1}\x{f9}\x{9e}\x{1e}\x{0}\x{f9}\x{9e}\x{1e}\x{0}\x{0}\x{0}\x{0}\x{0}\x{91}\x{1}\x{0}\x{0}\x{0}\x{0}\x{13}\x{1}\x{0}\x{0}') called at src/functions.pl line 682
   main::mainLoop_initialized() called at src/functions.pl line 69
   main::mainLoop() called at src/Interface.pm line 75
   Interface::mainLoop('Interface::Console::Win32=HASH(0x29d4544)') called at openkore.pl line 96
   main::__start() called at start.pl line 125

stophere:
                  }
*                 if (existsInList($config{$prefix.$i}, $skill->name) && $sourceID ne $accountID) {
                          if ($dist > 0 || $targetID eq $accountID) {



Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 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
[ Time : 0.049s | 17 Queries | GZIP : On ]