-
kkulesza
- Posts: 150
- Joined: Fri May 27, 2011 9:00 pm
- Location: Poland
#1
Post
by kkulesza » Sat Feb 25, 2012 8:41 am
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
-
Administrator
- Site Admin
- Posts: 5307
- Joined: Sat Jan 05, 2008 4:21 pm
#2
Post
by Administrator » Sat Feb 25, 2012 9:05 am
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'.
-
lisa
- Posts: 8332
- Joined: Tue Nov 09, 2010 11:46 pm
- Location: Australia
#3
Post
by lisa » Sat Feb 25, 2012 9:05 am
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.
-
kkulesza
- Posts: 150
- Joined: Fri May 27, 2011 9:00 pm
- Location: Poland
#4
Post
by kkulesza » Sat Feb 25, 2012 9:56 am
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.
-
rock5
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
#5
Post
by rock5 » Sat Feb 25, 2012 10:00 am
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.”
-
kkulesza
- Posts: 150
- Joined: Fri May 27, 2011 9:00 pm
- Location: Poland
#6
Post
by kkulesza » Sat Feb 25, 2012 10:04 am
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
-
rock5
- Posts: 12173
- Joined: Tue Jan 05, 2010 3:30 am
- Location: Australia
#7
Post
by rock5 » Sat Feb 25, 2012 10:15 am
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.”
-
kkulesza
- Posts: 150
- Joined: Fri May 27, 2011 9:00 pm
- Location: Poland
#8
Post
by kkulesza » Sat Feb 25, 2012 10:23 am
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
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 3 guests