UseFood addon script

Additional botting resources. Addons may be either for the game itself or for the RoM bot.
Forum rules
Only post additional bot resources here. Please do not ask unrelated questions.
Post Reply
Message
Author
User avatar
jduartedj
Posts: 599
Joined: Sat Dec 19, 2009 12:18 am
Location: Lisbon
Contact:

UseFood addon script

#1 Post by jduartedj » Fri Dec 31, 2010 7:58 am

USAGE: UseFood(_foodname[,_buffname]) _foodname is the name of the food and _buffname is meant to use when the buff hasn't got the same name as the food (e.g. house maid foods), note that this works for anything else you need to use and produces a buff.

Simple, easy, useful, Yummy!
addon_food.lua
(589 Bytes) Downloaded 356 times
Thanks for reading! :D

Some of you might find this useful: RoM-bot Wiki
User Functions Repository (and other useful files): Addon Repo
Latest SVN updates: SVN updates

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: UseFood addon script

#2 Post by rock5 » Fri Dec 31, 2010 8:38 am

I like it.

I think it could be added to the bot. It can probably be added to the inventory class.

Maybe change the name to something more generic seeing as it can work with anything that applies a buff. Maybe something that implies that it gives a buff. Something like GetBuffFromItem or UseItemForBuff?

What else? ...

We could check player.Casting in case using the item takes time and wait until it's false.

If the user misspells the buff it could waste items. There's not much we can do to check it but we could check to see if the buff was applied after we used the item. If the buff wasn't applied we could print a warning message.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

User avatar
jduartedj
Posts: 599
Joined: Sat Dec 19, 2009 12:18 am
Location: Lisbon
Contact:

Re: UseFood addon script

#3 Post by jduartedj » Fri Dec 31, 2010 9:14 am

All valid good great points! Agree totally, and I am flattered you considered this bot material :oops:
The not so great news is that I'll be out maybe for a while so won't be able to work on it, If you want to, you may start working on it and apply whatever changes you think are needed like the ones you posted, my cooperation in rom-bot will have to be delayed until next year probably in 1 week time.

Oh yeah and the name , I used "UseFood" because it want meant for foods only, which is the majority use for this, but found it applies to all item/buffs pairs.
My suggestion is to keep the name as simple as possible and it would be: "UseBuffItem" or "UseItemBuff". But even using this name I think there should be an alias to UseFood like:

Code: Select all

function UseFood(food,buff)
    UseBuffItem(food,buff);
end
this could give users some ease of use, since the name is easier to memorize.

Also my script should change variables with names like "food" to "item".
Thanks for reading! :D

Some of you might find this useful: RoM-bot Wiki
User Functions Repository (and other useful files): Addon Repo
Latest SVN updates: SVN updates

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: UseFood addon script

#4 Post by rock5 » Fri Dec 31, 2010 9:20 am

Ok I'll look into it.
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

_hirondelle
Posts: 72
Joined: Thu Mar 08, 2012 7:22 am

Re: UseFood addon script

#5 Post by _hirondelle » Thu May 10, 2012 1:09 am

Is this function in the bot now ?

User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: UseFood addon script

#6 Post by rock5 » Thu May 10, 2012 2:23 am

No, probably because the code to do what this function does is so simple. I, and probably many others, just do

Code: Select all

if not player:hasBuff("buffname") then
    inventory:useItem("itemname")
end
or use "UseGoodie" userfunction for the convenience of the code words for the item/buff pairs.

Are you finding some need for a destinct function?
  • Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
  • I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
  • How to: copy and paste in micromacro
    ________________________
    Quote:
    • “They say hard work never hurt anybody, but I figure, why take the chance.”
          • Ronald Reagan

_hirondelle
Posts: 72
Joined: Thu Mar 08, 2012 7:22 am

Re: UseFood addon script

#7 Post by _hirondelle » Fri May 11, 2012 5:01 am

Well, I am farming dog meat (a nice event will coming this week and dog meat will be sell with expensive prices) but I was unable to find who making the bot use house maid potion (lucky powder in fact but also unbridled enthusiasm).

I'll try to add your code on the onLeaveCombat tag.

Ty Rocks :)

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests