Use Goodies

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
Sabrinajewel
Posts: 7
Joined: Sun Jul 17, 2011 5:56 pm

Use Goodies

#1 Post by Sabrinajewel »

I have been playing sucessfully with the use goodies until i put in the "superior collection potions I, II, and III". it uses them everytime i leave combat, for what ever reason it doesn't recgonize them in my buff bar.

Any ideas???
User avatar
MiesterMan
Posts: 543
Joined: Tue Jul 06, 2010 9:15 pm
Location: Between the Second and Third Circles of Hell

Re: Use Goodies

#2 Post by MiesterMan »

The buffs probably have a different name. Have a look at the instructions again:
http://www.solarstrike.net/phpBB3/viewt ... =27&t=2406
Sabrinajewel
Posts: 7
Joined: Sun Jul 17, 2011 5:56 pm

Re: Use Goodies

#3 Post by Sabrinajewel »

Thank you for your link. It did help some when you mentioned the name might be wrong a double checked the spelling and the item numbers and everything was correct. My thought was about the I, II, III's so i took them out completely and it is using the # 1 potion and not reusing it after each fight but the 2nd and 3rd are not working. I used the capital i for the roman numbers any other ideas for these symbols...II...and III?
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Use Goodies

#4 Post by lisa »

I'd suguest using the Id as opposed to the name, should be some code posted a few times already about getting Id for items and also buffs.
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
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Use Goodies

#5 Post by rock5 »

lisa wrote:I'd suguest using the Id as opposed to the name, should be some code posted a few times already about getting Id for items and also buffs.
With the latest changes, using ids wont make any difference because it doesn't compare ids but gets the name for the id and compares the name. This was to stop problems with having the wrong id. Now, if the id you are using gives you the right name it will work even if it's the wrong id.

The problem is the buffs extract the numbers so if you need to use 2 or more different items that have the same name but different numbers then it's a problem. Usually for skills it's not a problem. If useGoodies could be made to check the "count" number then it could work (maybe an extra argument?).

Or just use the manual method.

Code: Select all

if not player:hasBuff("Superior Collection Potion",1) then
    inventory:useItem("Superior Collection Potion I")
end
if not player:hasBuff("Superior Collection Potion",2) then
    inventory:useItem("Superior Collection Potion II")
end
if not player:hasBuff("Superior Collection Potion",3) then
    inventory:useItem("Superior Collection Potion III")
end
Wait, that's not going to work. getBuff returns true if it's equal or higher than the "count". You may need to use your own hasbuff function. Here, I just copied it over and made a small adjustment.

Code: Select all

function HasBuffCount(buffnamesorids, count)
self:updateBuffs()

	-- for each buff the pawn has
	for i, buff in pairs(self.Buffs) do
		-- compare against each 'buffname'
		for buffname in string.gmatch(buffnamesorids,"[^,]+") do
			if type(tonumber(buffname)) == "number" then
				-- Get name from id
				buffname = GetIdName(tonumber(buffname))
				-- Take of end numbers
				buffname = parseBuffName(buffname)
			end
			if buffname == buff.Name and ( count == nil or buff.Count == count ) then
				return buff
			end
		end
	end

	return false
end
You could probably put this in a userfunction file then this should work.

Code: Select all

if not HasBuffCount("Superior Collection Potion",1) then
    inventory:useItem("Superior Collection Potion I")
end
if not HasBuffCount("Superior Collection Potion",2) then
    inventory:useItem("Superior Collection Potion II")
end
if not HasBuffCount("Superior Collection Potion",3) then
    inventory:useItem("Superior Collection Potion III")
end
  • 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
Sabrinajewel
Posts: 7
Joined: Sun Jul 17, 2011 5:56 pm

Re: Use Goodies

#6 Post by Sabrinajewel »

First off thank you for your quick response time. you guys are on top of things thats for sure.

Ok what i did was put the function block in a new file called addon_Has_Buff_Count in my userfunctions folder and the code block in my on leave combat in my profile. I had a error pop up...micromacro/scripts/rom/classes/player.lua:1254: Error in your profile: onLeaveCombat error: ...o/scripts/rom/userfunctions/addon_Has_Buff_Count.lua:2: attempt to index global 'self' <a nil value>

Did i put these in the wrong place or name the file wrong.

Thanks
Sabrinajewel
Posts: 7
Joined: Sun Jul 17, 2011 5:56 pm

Re: Use Goodies

#7 Post by Sabrinajewel »

Correction File Name addon_HasBuffCount.lua
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Use Goodies

#8 Post by lisa »

self:updateBuffs() needs to be player:updateBuffs()

Code: Select all

function HasBuffCount(buffnamesorids, count)
player:updateBuffs()

self.Buffs needs to be player.Buffs

Code: Select all

for i, buff in pairs(player.Buffs) do
Even though addon_HasBuffCount.lua will work it is better to use
userfunction_HasBuffCount.lua as the usage of addon_ is being phased out as it confused people, they thought it was an ingame addon.
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
Sabrinajewel
Posts: 7
Joined: Sun Jul 17, 2011 5:56 pm

Re: Use Goodies

#9 Post by Sabrinajewel »

YAY YAY YAY YAY You guys are Awwwwsome. Thank you again for your speedy responses.
Post Reply