December 9, 20178 yr 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
December 10, 20178 yr Hello, try to use runmacrotext: https://wrobot.eu/forums/topic/1688-lua-and-multi-language-support/?do=findComment&comment=11324
December 10, 20178 yr 4 hours ago, Droidz said: Hello, try to use runmacrotext: https://wrobot.eu/forums/topic/1688-lua-and-multi-language-support/?do=findComment&comment=11324 RunMacroText Was also first added in TBC ;)
December 10, 20178 yr Author 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?
December 10, 20178 yr 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 December 10, 20178 yr by Ordush
December 14, 20178 yr 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?
Create an account or sign in to comment