RagnaProject | r6451 | macro conditions produces error

This place is for Unresolvable bug reports only. NOT for asking help!

Moderators: Moderators, Developers

Message
Author
Mushroom
Perl Monk
Perl Monk
Posts: 427
Joined: 04 Apr 2008, 14:04
Noob?: No
Location: Brazil

RagnaProject | r6451 | macro conditions produces error

#1 Post by Mushroom »

Well, i'm trying to use a macro with the condition inventory but everytime I run the bot I get a error. Here the errors.txt.

Code: Select all

OpenKore version what-will-become-2.0.6 (SVN version)
Network state = 4
Network handler = Network::DirectConnection
SVN revision: 6451
Loaded plugins:
  plugins/alertSoundSVN.pl (alertsound)
  plugins/autotalk.pl (autotalk)
  plugins/botBebado.pl (botBebado)
  plugins/burlabr.pl (burlabr)
  plugins/comboSpam.pl (comboSpam)
  plugins/macro.pl (macro)
  plugins/playerRecorder.pl (prec)
  plugins/reactOnKillSteal.pl (reactOnKillSteal)
  plugins/reactOnNPC.pl (reactOnNPC)
  plugins/recorder.pl (recorder)
  plugins/tele-search-v2.pl (Tele-Search v2)
  plugins/waitForParty.pl (waitParty)
  plugins/snapshot/snapshot.pl (snapshot)

Error message:
Can't call method "inventory" on an undefined value at plugins/Macro/Utilities.pm line 248.

Stack trace:
Can't call method "inventory" on an undefined value at plugins/Macro/Utilities.pm line 248.
 at plugins/Macro/Utilities.pm line 248
	Macro::Utilities::getInventoryAmount('Great Nature') called at plugins/Macro/Automacro.pm line 146
	Macro::Automacro::checkItem('inv', '"Great Nature" >= 1') called at plugins/Macro/Automacro.pm line 513
	Macro::Automacro::automacroCheck('Network::serverConnect/mapserver', 'undef', 'undef') called at src/Plugins.pm line 440
	Plugins::callHook('Network::serverConnect/mapserver') called at src/Network/DirectConnection.pm line 558
	Network::DirectConnection::checkConnection('Network::DirectConnection=HASH(0x2e91808)') called at src/functions.pl line 535
	main::mainLoop_initialized() called at src/functions.pl line 70
	main::mainLoop() called at src/Interface.pm line 75
	Interface::mainLoop('Interface::Console::Win32=HASH(0x2282830)') called at openkore.pl line 96
	main::__start() called at start.pl line 119

Died at this line:
  	my $amount = 0;
* 	foreach my $item (@{$char->inventory->getItems}) {
  		if (lc($item->name) eq $arg) {$amount += $item->{amount}}

And here is the macro:

Code: Select all

automacro quebrar {
  delay 2
  inventory "Apple" >= 1
  call {
  log --- It worked ---
		}
}
Quit.

ezza
Developers
Developers
Posts: 109
Joined: 04 Apr 2008, 09:50

Re: RagnaProject | 2.0.6 | Inventory condition problem.

#2 Post by ezza »

I'm just a newbie in perl ... but what is the different between this 2 lines?

Code: Select all

foreach my $item (@{$char->inventory->getItems()}) { do something }
and ...

Code: Select all

foreach my $item (@{$char->inventory->getItems}) { do something }

Cozzie
Spam Generator
Spam Generator
Posts: 499
Joined: 04 Apr 2008, 09:30
Noob?: No
Location: Melbourne, City of beer and awful sushis

Re: RagnaProject | 2.0.6 | Inventory condition problem.

#3 Post by Cozzie »

Unhelpful comment: My god that is a LOT of plugins you have there.
Make Openkore Awesome. Join the team.

sli
Perl Monk
Perl Monk
Posts: 810
Joined: 04 Apr 2008, 17:26
Noob?: No

Re: RagnaProject | 2.0.6 | Inventory condition problem.

#4 Post by sli »

ezza wrote:I'm just a newbie in perl ... but what is the different between this 2 lines?

Code: Select all

foreach my $item (@{$char->inventory->getItems()}) { do something }
and ...

Code: Select all

foreach my $item (@{$char->inventory->getItems}) { do something }
Nothing.
cs : ee : realist

Mushroom
Perl Monk
Perl Monk
Posts: 427
Joined: 04 Apr 2008, 14:04
Noob?: No
Location: Brazil

Re: RagnaProject | 2.0.6 | Inventory condition problem.

#5 Post by Mushroom »

Got another problem '-'
Well, it's like the other problem, but it always happen when I use a macro with the conditions sp, hp, weight....
Here is the errors.txt

Code: Select all

OpenKore version what-will-become-2.0.6 (SVN version)
Network state = 4
Network handler = Network::DirectConnection
SVN revision: 6451
Loaded plugins:
  plugins/macro.pl (macro)

Error message:
Assertion ('HASH(0x2d2ea88)' must be of class 'Actor::You') failed!
 at C:/Documents and Settings/hp/Desktop/OiE/Ragnarok Programs/bot/Openkore SVN/src/deps/Carp/Assert.pm line 271
	Carp::Assert::assert('', '\'HASH(0x2d2ea88)\' must be of class \'Actor::You\'') called at src/Utils/Assert.pm line 31
	Utils::Assert::assertClass('HASH(0x2d2ea88)', 'Actor::You') called at src/Misc.pm line 228
	Misc::checkValidity('mainLoop_part2.1') called at src/functions.pl line 601
	main::mainLoop_initialized() called at src/functions.pl line 70
	main::mainLoop() called at src/Interface.pm line 75
	Interface::mainLoop('Interface::Console::Win32=HASH(0x228dee8)') called at openkore.pl line 96
	main::__start() called at start.pl line 119

Stack trace:
Assertion ('HASH(0x2d2ea88)' must be of class 'Actor::You') failed!
 at C:/Documents and Settings/hp/Desktop/OiE/Ragnarok Programs/bot/Openkore SVN/src/deps/Carp/Assert.pm line 271
	Carp::Assert::assert('', '\'HASH(0x2d2ea88)\' must be of class \'Actor::You\'') called at src/Utils/Assert.pm line 31
	Utils::Assert::assertClass('HASH(0x2d2ea88)', 'Actor::You') called at src/Misc.pm line 228
	Misc::checkValidity('mainLoop_part2.1') called at src/functions.pl line 601
	main::mainLoop_initialized() called at src/functions.pl line 70
	main::mainLoop() called at src/Interface.pm line 75
	Interface::mainLoop('Interface::Console::Win32=HASH(0x228dee8)') called at openkore.pl line 96
	main::__start() called at start.pl line 119
 at C:/Documents and Settings/hp/Desktop/OiE/Ragnarok Programs/bot/Openkore SVN/src/deps/Carp/Assert.pm line 271
	Carp::Assert::assert('', '\'HASH(0x2d2ea88)\' must be of class \'Actor::You\'') called at src/Utils/Assert.pm line 31
	Utils::Assert::assertClass('HASH(0x2d2ea88)', 'Actor::You') called at src/Misc.pm line 228
	Misc::checkValidity('mainLoop_part2.1') called at src/functions.pl line 601
	main::mainLoop_initialized() called at src/functions.pl line 70
	main::mainLoop() called at src/Interface.pm line 75
	Interface::mainLoop('Interface::Console::Win32=HASH(0x228dee8)') called at openkore.pl line 96
	main::__start() called at start.pl line 119
Oh, I already updated my recvpackets, tried using openkore version 2.0.6, 2.0.5.1, tried without tortoise and nothing worked. BUT, version 2.0.0 worked perfectly :O
Here is a example of the macro that doesn't work, and I only get this error when I have a macro with conditions hp, sp, weight and other conditions that use my stats...

Code: Select all

automacro sp {
  sp < 5%
  run-once 1
  call {
         log --- Nice, It didn't give me error! ---
         }
}
Why am I the only person who get this kind of errors?? T-T
Looks like nobody have this kind of errors.... so sad...
Quit.

Mushroom
Perl Monk
Perl Monk
Posts: 427
Joined: 04 Apr 2008, 14:04
Noob?: No
Location: Brazil

Re: RagnaProject | r6451 | macro conditions produces error

#6 Post by Mushroom »

Well, the error bellow I fixed changing my autoloot macro.
Now the problem is the inventory condition ''/
Quit.

Technology
Super Moderators
Super Moderators
Posts: 801
Joined: 06 May 2008, 12:47
Noob?: No

Re: RagnaProject | r6451 | macro conditions produces error

#7 Post by Technology »

Both bugs were caused because in global $char there was an undef stored instead of a defined Actor::You object.

It could have something to do with incorrect packet lengths in recvpackets.txt.
But it has nothing to do with the macro plugin.

Btw, i think harvest added a check earlier for this kind of bugs.
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...

Mount Doom awaits us, fellowship of OpenKore!

Post Reply