useGoodie

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.
Message
Author
harbifm
Posts: 135
Joined: Wed May 25, 2011 11:43 pm

Re: useGoodie

#41 Post by harbifm » Sun Jun 05, 2011 1:06 am

can you show me how you write in the code, do you need to put (;) after the code (useGoodie"luck")?

User avatar
Giram
Posts: 191
Joined: Thu Aug 26, 2010 3:34 pm
Location: Finland

Re: useGoodie

#42 Post by Giram » Sun Jun 05, 2011 6:50 am

harbifm wrote:can you show me how you write in the code, do you need to put (;) after the code (useGoodie"luck")?
In Lua code semicolons are optional i think. But you still need to form functions correctly. useGoodie("luck").

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

Re: useGoodie

#43 Post by rock5 » Thu Jun 09, 2011 9:04 pm

I've been having trouble using this file so I've done some work on it to make it more reliable.

Changes:
  • 1. Because it looks like GetIdName often doesn't work the first time you apply the buff, I've added a RoMScript command to get the name as a backup.
    2. I thought it was a bad idea to get all the buff names every time you use the function so I've changed it to only get the buff name when it's first needed. That means the buffnames are originally saved as ids only.
    3. I've added a check to make sure it has a buff name before trying to see if you have the buff so you shouldn't get anymore errors.
    4. I've updated all the buff ids for the 1-40 buffs. I'm not sure why some of the ones I changed said they were tested. Maybe older clients use different buff ids? That probably needs to be confirmed.
So far it seems to work really well. No problems so far.
Attachments
userfunction_useGoodie_universal.lua
(3.71 KiB) Downloaded 736 times
  • 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
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: useGoodie

#44 Post by rock5 » Tue Jul 05, 2011 7:11 am

I just thought users of this addon would be interested. There has been a lot a problems in the past with the buff ids used in this addon not being exactly the right one. Well as of rombot revision 613 these should be a thing of the past. The bots buff functions no longer directly compare ids anymore but instead compare the names gotten from the ids. That means as long as the id gives the right name then it will work. The id doesn't have to be exactly the right one. :)

Read more 613 changelog
  • 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

sdude13
Posts: 76
Joined: Thu Aug 19, 2010 9:36 am

Re: useGoodie

#45 Post by sdude13 » Fri Oct 07, 2011 7:43 am

UseGoodie not working anymore, Buff check works, it says casting but does not.
so i guess

Code: Select all

inventory:useItem(option.ID);
is disabled/broken in Patch

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

Re: useGoodie

#46 Post by rock5 » Fri Oct 07, 2011 9:40 am

I got a fix working that should solve all RoMScript problems. Just testing and cleaning up code.
  • 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
lisa
Posts: 8330
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: useGoodie

#47 Post by lisa » Fri Oct 07, 2011 9:44 am

rock5 wrote:I got a fix working that should solve all RoMScript problems. Just testing and cleaning up code.
you don't know how glad I am to hear that, I have been putting off changing all my profiles from MACRO to keys lol
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

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

Re: useGoodie

#48 Post by jduartedj » Tue May 22, 2012 6:09 am

I'd liek to personally Thank Giram for continuing the development of my original userfunction, useGoodie() :D keep it up and keep the credits, just mention me.
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

BillDoorNZ
Posts: 446
Joined: Wed Aug 03, 2011 7:37 pm

Re: useGoodie

#49 Post by BillDoorNZ » Wed Sep 19, 2012 2:53 pm

heyas,

I made some changes to rocks version of this a while back and have been meaning to post it in case anyone finds it useful. I'm inherently lazy so I tend to write more code to allow me to write less :).

The code below are the comments from the top of the file explaining its usage:

Code: Select all

-- All this does is allow you to use the 'standard' buffs a bit easier, and with less code :)
-- However, I've sacrificed readability a bit for this, as you will see in the example below:
--   buffUp(true, true, false, true, false, true, false, determineFoodTypeToBuff());
--
-- Pretty cryptic huh? Well, the function buffUp is defined like this:
--   buffUp(luck, speed, mountSpeed, casting, jump, defense, aggro, foodType)
--
-- So, the parameters it takes are:
--
-- ---------------------------------------------
-- Parameter    | Details
-- ---------------------------------------------
-- luck         | use luck pot? true/false
-- speed        | use running speed pot? true/false
-- mountSpeed   | use mount speed pot? true/false
-- casting      | use casting pot? true/false
-- jump         | use jump pot? true/false
-- defense      | use defense pot? true/false
-- aggro        | use aggro generation pot? true/false
-- foodType     | what type of food to use? * For this one I wrote a helper function to 
--                determine if you want Physical/Magic enhancing food - this is called 
--                determineFoodTypeToBuff() and will choose it based on your primary 
--                class only. Otherwise specify SPECIAL_TYPES_PHYSICAL for physical food
--                or SPECIAL_TYPES_SPELL for magical food.
-- ---------------------------------------------
--
-- so in my original example, if I am a scout/mage:
--   buffUp(true, true, false, true, false, true, false, determineFoodTypeToBuff());
--   will use luck pots, speed pots, casting pots, defense pots, and a physical food.
------------------------------------------------
Attachments
userfunction_useGoodie_universal.lua
(10.64 KiB) Downloaded 123 times

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

Re: useGoodie

#50 Post by rock5 » Wed Sep 19, 2012 3:03 pm

BillDoorNZ wrote:I made some changes to rocks version of this a while back
I wouldn't call it my function. Actually, I don't remember contributing anything except for maybe pointing out a few things.

Edit: Oh look, I did post a version. I forgot all about it. My memory is not what it used to be.
  • 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

BillDoorNZ
Posts: 446
Joined: Wed Aug 03, 2011 7:37 pm

Re: useGoodie

#51 Post by BillDoorNZ » Wed Sep 19, 2012 4:12 pm

lol...you must have been in the zone when you did that ;)

the gods only know how often I've written code I cant remember writing :)

or, I deny writing anyway ;)

User avatar
lisa
Posts: 8330
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: useGoodie

#52 Post by lisa » Wed Sep 19, 2012 7:17 pm

rock5 wrote:Edit: Oh look, I did post a version. I forgot all about it. My memory is not what it used to be.
yup your getting old, all down hill from here ;)
Remember no matter you do in life to always have a little fun while you are at it ;)

wiki here http://www.solarstrike.net/wiki/index.php?title=Manual

BillDoorNZ
Posts: 446
Joined: Wed Aug 03, 2011 7:37 pm

Re: useGoodie

#53 Post by BillDoorNZ » Wed Sep 19, 2012 8:13 pm

lisa wrote:
rock5 wrote:Edit: Oh look, I did post a version. I forgot all about it. My memory is not what it used to be.
yup your getting old, all down hill from here ;)
the plus side of that of course, is that its much easier going downhill ';)

883Dman
Posts: 90
Joined: Sat Dec 08, 2012 9:25 pm

Re: useGoodie

#54 Post by 883Dman » Tue Dec 18, 2012 1:12 pm

I got it working after i put the newest userfunction_usegoodie file in my interface/addons/userfunctions folder.

sparky
Posts: 8
Joined: Wed Apr 10, 2013 12:24 pm

Re: useGoodie

#55 Post by sparky » Fri May 10, 2013 7:05 pm

I added these to the table, and tested, work fine:

Code: Select all

		 --XP/TP buff items
		 xpcake =	{ID = 202895, buffName = 850473, castTime = 0}, -- wedding cake (+xp/tp)
		 xppot =	{ID = 201134, buffName = 201134, castTime = 0}, -- normal Experience Potion
		 tppot =	{ID = 201610, buffName = 201610, castTime = 0}, -- normal Skill Potion

I got the codes from the getbuffed site, ie: http://romdata.getbuffed.com/item/list/2.2

Cheers

Ironman
Posts: 5
Joined: Thu Feb 06, 2014 5:48 pm

Re: useGoodie

#56 Post by Ironman » Fri Jun 20, 2014 7:11 pm

Hi everyone,

Did the food part function works for you ?

everything works great except food for me.

I am currently using the "buffup" part from BillDoorNZ

I have try to verify and change IDs if needed for one food:
Housekeeper Special Unimaginable Salad
foodname:207215
Buffname: 506679
but nothing change


(sorry for my english, not native ;) )

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

Re: useGoodie

#57 Post by rock5 » Fri Jun 20, 2014 10:53 pm

How are you using the function? Are you using the determineFoodTypeToBuff() helper function or are you using the SPECIAL_TYPES_PHYSICAL variable?

I think this part of buffUp is wrong.

Code: Select all

	if (foodType) then 
		if (foodType == SPECIAL_TYPES_SPELL) then
			if (countGoodie(matt3) > 0) then
				useGoodie(matt3);
			elseif (countGoodie(mdmg2) > 0) then
				useGoodie(mdmg2);
			elseif (countGoodie(matt) > 0) then
				useGoodie(matt);
			elseif (countGoodie(mdmg) > 0) then
				useGoodie(mdmg);
			else
				printf("Count not apply spell food buff as you do not have any spell food!\n");
			end;
		elseif (foodType == SPECIAL_TYPES_PHYSICAL) then
			if (countGoodie(patt3) > 0) then
				useGoodie(patt3);
			elseif (countGoodie(patt2) > 0) then
				useGoodie(patt2);
			elseif (countGoodie(critp) > 0) then
				useGoodie(critp);
			elseif (countGoodie(pdmg) > 0) then
				useGoodie(pdmg);
			else
				printf("Count not apply physical food buff as you do not have any physical food!\n");
			end;
		else
			printf("An invalid food type was specified for the buffUp function, should be physical/spell (1 and 2 respectively)\n");
		end;
	end;
It should probably be

Code: Select all

	if (foodType) then 
		if (foodType == SPECIAL_TYPES_SPELL) then
			if (countGoodie("matt3") > 0) then
				useGoodie("matt3");
			elseif (countGoodie("mdmg2") > 0) then
				useGoodie("mdmg2");
			elseif (countGoodie("matt") > 0) then
				useGoodie("matt");
			elseif (countGoodie("mdmg") > 0) then
				useGoodie("mdmg");
			else
				printf("Count not apply spell food buff as you do not have any spell food!\n");
			end;
		elseif (foodType == SPECIAL_TYPES_PHYSICAL) then
			if (countGoodie("patt3") > 0) then
				useGoodie("patt3");
			elseif (countGoodie("patt2") > 0) then
				useGoodie("patt2");
			elseif (countGoodie("critp") > 0) then
				useGoodie("critp");
			elseif (countGoodie("pdmg") > 0) then
				useGoodie("pdmg");
			else
				printf("Count not apply physical food buff as you do not have any physical food!\n");
			end;
		else
			printf("An invalid food type was specified for the buffUp function, should be physical/spell (1 and 2 respectively)\n");
		end;
	end;
Notice the quotes arround the strings.
  • 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

Ironman
Posts: 5
Joined: Thu Feb 06, 2014 5:48 pm

Re: useGoodie

#58 Post by Ironman » Sat Jun 21, 2014 7:35 am

I am using the determineFoodTypeToBuff() by default for a physical
-> does not work

I tried determineFoodTypeToBuff(1) to force physical, as describe in the comment;
--helpers
SPECIAL_TYPES_PHYSICAL = 1;
SPECIAL_TYPES_SPELL = 2;
-> does not work

I haven't tried yet the SPECIAL_TYPES_PHYSICAL

I am going to modify the script as you preconized, and test it
will come back and tell you what

Ironman
Posts: 5
Joined: Thu Feb 06, 2014 5:48 pm

Re: useGoodie

#59 Post by Ironman » Sat Jun 21, 2014 2:30 pm

Test done

result: your modification helps a lot to find another problem in line 204: foodtype wasn't defined

I have modified

Code: Select all

if (foodType) then 
in

Code: Select all

if (foodType == SPECIAL_TYPES_SPELL) then 


and tested the buffup function with "SPECIAL_TYPES_PHYSICAL" and..
It's working !!!! :D
It use the Housekeeper Special Unimaginable Salad now.

thanks a lot for that.

Another question, in the game we can have both Patt3 and Critp but in the script it is not possible with the "elseif"
Is it possible to use an "and" (or something else ?) instead of the "elseif" regarding lines 216 to 222:

Code: Select all

elseif (foodType == SPECIAL_TYPES_PHYSICAL) then
         if (countGoodie("patt3") > 0) then
            useGoodie("patt3");
         elseif (countGoodie("patt2") > 0) then
            useGoodie("patt2");
        elseif (countGoodie("critp") > 0) then
            useGoodie("critp")
MOdified file working for food :)
Attachments
userfunction_useGoodie_universal.lua
Mdified file working for food :)
(10.8 KiB) Downloaded 50 times

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

Re: useGoodie

#60 Post by rock5 » Sat Jun 21, 2014 3:27 pm

I think you messed it up. It was like this. (pseudo code following)

Code: Select all

if foodtype then
    if foodtype == TYPE_SPELL then
        -- use spell type goodies.
    if foodtype == TYPE_PHYSICAL then
        -- use physical goodies.
    else
        -- must have used an invalid value for 'foodtype'
    end
end
What this means is, if a foodtype was specified then, if it was spell type then use spell stuff, else if physical was specified then use physical. If foodtype was specified but is neither spell nor physical then an incorrect value was specified, print an error message. The way you've written it it looks like it will print the error message even if the foodtype wasn't specified, which is wrong.

As to your other question, I think it should only use 'else' when you want it to use one or another item. If you want it to check all appropriate foods, it should only use 'if's, no 'else's. Eg.

Code: Select all

         if (countGoodie("patt3") > 0) then
            useGoodie("patt3");
         elseif (countGoodie("patt2") > 0) then
            useGoodie("patt2");
         end
         if (countGoodie("critp") > 0) then
            useGoodie("critp");
In this example it will use patt3 or patt2 then also check critp.
  • 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

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests