Quick question on Actor::Item

Wrote new code? Fixed a bug? Want to discuss technical stuff? Feel free to post it here.

Moderator: Moderators

Message
Author
Kjwan
Noob
Noob
Posts: 2
Joined: 14 Apr 2008, 11:18

Quick question on Actor::Item

#1 Post by Kjwan »

[EDIT: Sorry mods, wrong section I know :D, can a mod move this to Development Help Forum]

What I am trying to do is to de-equip and re-equip the weapon to remove the Enchant Poison status when kore is about to attack a certain monster. The code successfully unequiped the weapon but it just wouldnt equip it again.

Code: Select all

my $item = Actor::Item::get("item name", undef, 1);
$item->unequip();
# i even tried to put a delay here, wouldnt work.
$item->equip();
TIA
Last edited by Kjwan on 06 May 2008, 02:02, edited 1 time in total.

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

Re: Quick question on Actor::Item

#2 Post by sli »

I can't really help suffice to say try using tasks.
cs : ee : realist

Bibian
Perl Monk
Perl Monk
Posts: 416
Joined: 04 Apr 2008, 03:08

Re: Quick question on Actor::Item

#3 Post by Bibian »

you need to unequip the item first, then use a timeout of a few seconds (1 or more) and then you should be able to requip.

There is no useItem or equipItem task yet so, no use trying to use that yet.
Giving some more info on the behaviour of the bot when you use your code would be handy :P

Kjwan
Noob
Noob
Posts: 2
Joined: 14 Apr 2008, 11:18

Re: Quick question on Actor::Item

#4 Post by Kjwan »

I had it working! :D

What I did is to make kore wait for the weapon to unequip (hook on packet/unequip_item) then invoke equip on the callback :)

Post Reply