Q: How to check target's (de)buff name?

Runes of Magic/Radiant Arcana (http://www.runesofmagic.com)
Post Reply
Message
Author
kkulesza
Posts: 150
Joined: Fri May 27, 2011 9:00 pm
Location: Poland

Q: How to check target's (de)buff name?

#1 Post by kkulesza »

This code works:

Code: Select all

player:target(obj.Address);
player:update();
target = player:getTarget();
if target:hasBuff("xxx") then
...
but this does not:

Code: Select all

player:target(obj.Address);
player:update();
target = player:getTarget();
target:updateBuffs();
debuffName=target.Buffs[1].Name
if debuffName=="xxx" then
...
I want to get the name of target's first debuff
User avatar
Administrator
Site Admin
Posts: 5344
Joined: Sat Jan 05, 2008 4:21 pm

Re: Q: How to check target's (de)buff name?

#2 Post by Administrator »

As far as I can tell, that should work. hasBuff() and the buffs array may contain slightly different information for the name. Try printing the name out and see how it matches up against what you are comparing it to. It could be something as simple as 'Seal of Light' verse 'Seal of Light III'.
User avatar
lisa
Posts: 8332
Joined: Tue Nov 09, 2010 11:46 pm
Location: Australia

Re: Q: How to check target's (de)buff name?

#3 Post by lisa »

you probably arn't doing it right, try this

Code: Select all

player:update() target = player:getTarget() print(target.Buffs[1].Name)

Lizard Blood
Or like admin said you just have the name wrong.
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
kkulesza
Posts: 150
Joined: Fri May 27, 2011 9:00 pm
Location: Poland

Re: Q: How to check target's (de)buff name?

#4 Post by kkulesza »

It's not about mismatched string. It's about an error.
Example A. working code:

Code: Select all

player:target(obj.Address);
		player:update();
		target = player:getTarget();
		target:updateBuffs();
		--print(target.Buffs[1].Name)
		if target:hasBuff("Lizard Blood") then
Examplel B. works until "target.Buffs[1].Name" line:

Code: Select all

player:target(obj.Address);
		player:update();
		target = player:getTarget();
		target:updateBuffs();
		print(target.Buffs[1].Name)
		if target:hasBuff("Lizard Blood") then
Error code from mm window:

Code: Select all

Lizard Blood
Did not find any crashed game clients.
3:48pm - [string "..."]:76: attempt to index field '?' (a nil value)
I don't know what it means.
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Q: How to check target's (de)buff name?

#5 Post by rock5 »

Means there is no first buff so no Name. Try

Code: Select all

if target.Buffs[1] then
print(target.Buffs[1].Name)
else
print("No Buffs")
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
kkulesza
Posts: 150
Joined: Fri May 27, 2011 9:00 pm
Location: Poland

Re: Q: How to check target's (de)buff name?

#6 Post by kkulesza »

rock5 wrote:Means there is no first buff so no Name. Try

Code: Select all

if target.Buffs[1] then
print(target.Buffs[1].Name)
else
print("No Buffs")
end
hmmm
but it did print the buff name
it's in the first line in code from mm window
User avatar
rock5
Posts: 12173
Joined: Tue Jan 05, 2010 3:30 am
Location: Australia

Re: Q: How to check target's (de)buff name?

#7 Post by rock5 »

I can't understand how it errored on that line but still managed to print the name. Maybe the error was from something else.
  • 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
kkulesza
Posts: 150
Joined: Fri May 27, 2011 9:00 pm
Location: Poland

Re: Q: How to check target's (de)buff name?

#8 Post by kkulesza »

rock5 wrote:

Code: Select all

if target.Buffs[1] then
print(target.Buffs[1].Name)
else
print("No Buffs")
end
ok i did try this code and it works. Now i see where i was wrong. :)

My code was in a loop. So First time there was a buff and it did print it, but next time there was no buff and there was error.

Thx for help
Post Reply