Jump to content

Feeding Pet


Recommended Posts

I've been trying for a while now on how to get the bot to feed my hunters pet. I've tried the following spell and keep getting an error. 

if GetPetHappiness() < 3 then
  CastSpellByName("Feed Pet")
  UseItemByName("FoodName")
end  

image.thumb.png.730ee7ec49b7b0cdeeb3f6700fb43047.png

 

Link to comment
Share on other sites

Ok. Well I've also made a macro in the game: feedpet

/run local c=CastSpellByName;if GetPetHappiness()~=nil and GetPetHappiness()~=3 then c("Feed Pet");PickupContainerItem(0,1) end
 

Clicking this macro works and feeds the pet.

When I use 

RunMacroText("/cast feedpet");

 

This also doesn't work. Am I doing something wrong or does this method also not work in Vanilla? 

Link to comment
Share on other sites

Your in-game macro is not using UseItemByName, it's taking what you have in container slot 0,1. This means it will only try to feed your pet with whatever is in that slot.

You can do the same with your bot with the following Code:

if GetPetHappiness() < 3 then
  CastSpellByName("Feed Pet")
  PickupContainerItem(0,1)
end  

This will make the bot feed the pet with whatever you have in slot 0,1 in your bags (like your macro) if the pet is not happy. :)

Edit: For the first code snippet to work, you could make a foreach loop and check every slot in your bag for itemname. :)

Edited by Ordush
Link to comment
Share on other sites

On 12/10/2017 at 11:54 AM, Ordush said:

Your in-game macro is not using UseItemByName, it's taking what you have in container slot 0,1. This means it will only try to feed your pet with whatever is in that slot.

You can do the same with your bot with the following Code:


if GetPetHappiness() < 3 then
  CastSpellByName("Feed Pet")
  PickupContainerItem(0,1)
end  

This will make the bot feed the pet with whatever you have in slot 0,1 in your bags (like your macro) if the pet is not happy. :)

Edit: For the first code snippet to work, you could make a foreach loop and check every slot in your bag for itemname. :)

Where you put this at? As a spell with a lua code or what? 

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...