SVN 2.1 | plugin error

Forum closed. All further discussion to be discussed at https://github.com/OpenKore/

Moderator: Moderators

Message
Author
konkang
Noob
Noob
Posts: 3
Joined: 07 Apr 2010, 07:02
Noob?: No

SVN 2.1 | plugin error

#1 Post by konkang »

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: Select all

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

[The extension pl has been deactivated and can no longer be displayed.]


EternalHarvest
Developers
Developers
Posts: 1798
Joined: 05 Dec 2008, 05:42
Noob?: Yes

Re: SVN 2.1 | plugin error

#2 Post by EternalHarvest »

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.

konkang
Noob
Noob
Posts: 3
Joined: 07 Apr 2010, 07:02
Noob?: No

Re: SVN 2.1 | plugin error

#3 Post by konkang »

Code: Select all

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) {


Locked