sauce 0 Posted December 9, 2017 Share Posted December 9, 2017 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 Link to comment Share on other sites More sharing options...
Ordush 185 Posted December 10, 2017 Share Posted December 10, 2017 It's because UseItemByName function wasn't added till TBC. :) Link to comment Share on other sites More sharing options...
Droidz 2737 Posted December 10, 2017 Share Posted December 10, 2017 Hello, try to use runmacrotext: https://wrobot.eu/forums/topic/1688-lua-and-multi-language-support/?do=findComment&comment=11324 Link to comment Share on other sites More sharing options...
Ordush 185 Posted December 10, 2017 Share Posted December 10, 2017 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 ;) Link to comment Share on other sites More sharing options...
sauce 0 Posted December 10, 2017 Author Share Posted December 10, 2017 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 More sharing options...
Ordush 185 Posted December 10, 2017 Share Posted December 10, 2017 (edited) 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, 2017 by Ordush Matenia 1 Link to comment Share on other sites More sharing options...
sauce 0 Posted December 10, 2017 Author Share Posted December 10, 2017 Thank you Ordush. This works. Link to comment Share on other sites More sharing options...
Andreavnn 0 Posted December 14, 2017 Share Posted December 14, 2017 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 More sharing options...
Dakab 0 Posted January 6, 2019 Share Posted January 6, 2019 Is there a tutorial about this? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now