and I do not know if they are really nil. Your best way to find out, is to insert
print(self.item)
statements in the code. I always advertise print() as the best way to debug, I do not know why 9 out of 10 of the people I meet don't use it.
self.item is not nil, so the only way (self.item and not GetItemInfo(self.item)) can be true is if not GetItemInfo(self.item) is true as well, meaning GetItemInfo(self.item) is false. And it shouldn't be, yet it is. That's the issue.
And I guess cache availability is as good a reason as any. I don't see any other way to fix the whole script but by changing the default bandage to Heavy Frostweave instead of Heavy Netherweave in the localization file. But it's a poor fix. This code simply doesn't work at player login, and a good fix would be to make it work.
Ok, I figured GetItemCount was screwing up too. So it doesn't set the DefaultRangespell to the Frostweave bandage.
But can you explain how this if..then statement is run ? I can't figure out how its conditions are met unless GetItemInfo doesn't return anything. First part: spell isn't a string (non-existent for this toon in the savedvars) but item is, so that condition isn't verified. Second part: item exists and GetItemInfo is false ? I'm confused.
local b = FindABandage()
if (b) then
XPerl_DefaultRangeSpells.ANY.item = b
end
local rf = conf.rangeFinder
local function Setup1(self)
if ((type(self.spell) ~= "string" and type(self.item) ~= "string") or (self.item and not GetItemInfo(self.item))) then
self.spell = XPerl_DefaultRangeSpells[playerClass] and XPerl_DefaultRangeSpells[playerClass].spell
if (type(self.spell) ~= "string") then
self.item = (XPerl_DefaultRangeSpells.ANY and XPerl_DefaultRangeSpells.ANY.item) or ""
end
end
Setup1(rf.Main)
Setup1(rf.NameFrame)
Setup1(rf.StatsFrame)
FindABandage is
local function FindABandage()
local bandages = {
-- [34723] = true, -- Dense Frostweave Bandage ?????????? check ID
[34722] = true, -- Heavy Frostweave Bandage
[34721] = true, -- Frostweave Bandage
[21991] = true, -- Heavy Netherweave Bandage
[21990] = true, -- Netherweave Bandage
[14530] = true, -- Heavy Runecloth Bandage
[14529] = true, -- Runecloth Bandage
[8545] = true, -- Heavy Mageweave Bandage
[8544] = true, -- Mageweave Bandage
[6451] = true, -- Heavy Silk Bandage
[6450] = true, -- Silk Bandage
[3531] = true, -- Heavy Wool Bandage
[3530] = true, -- Wool Bandage
[2581] = true, -- Heavy Linen Bandage
[1251] = true, -- Linen Bandage
}
for k,v in pairs(bandages) do
if (GetItemCount(k) > 0) then
return GetItemInfo(k)
end
end
end
Bit convoluted without looking at the whole thing, but that's pretty much it.
The DefaultRangeSpell is Heavy Netherweave Bandage (in the localization file). I could change that and it would fix the problem, but I'd like to know why it's not working. So basically, FindABandage doesn't work, even though I have Heavy Frostweave Bandages in my bags. And this if:
if ((type(self.spell) ~= "string" and type(self.item) ~= "string") or (self.item and not GetItemInfo(self.item))) then
shouldn't have its conditions met. The spell and item refer to what I have set to default in my SavedVars. In my case, no spell (not a caster), but I do have Heavy Frostweave Bandage as default item to use for range check saved there. So I don't see how it's running what's in that if then statement, yet it does because GetItemInfo(self.item) is false (I added debug messages in there to check), which verifies the second condition of this if then.
Soooo... since I don't know what I'm doing, I'm asking here. This same piece of code works after a reloadui. So, is that it ? No access to cache yet, so it fails ?
I'm trying to fix a little bug in an addon and facing some strange difficulties.
GetItemInfo() simply doesn't work until I'm completely logged in, or so it seems.
In other words, something like this actually works:
if not GetItemInfo(<insert random item>) then
ChatFrame1:AddMessage("Getiteminfo failed")
end
I used Heavy Frostweave Bandage as the item.
I am not very experienced with lua, but I don't get it. Am I missing something ? If not, can someone with more experience than me run some tests and figure it out ?
For some reason, every time I log in, offline members are shown in my guild roster, regardless of whether the checkbox is checked or not. Not a huge deal, just curious. I uncheck/check it again every login.
During the course of the game, I do notice a delay when opeing the guild roster if I haven't done so recently. I see offline people and then they disappear (because I uncheck/check that box every login to make sure they're not shown - see above). In case the 2 are related.
Found a bug, sylvanaar. It's in the PopupMessage module. It's set to my nickname obviously, and also to Eric. I have it configured to output to PopupMessage if that matters.
If a message comes up containing a raid icon and my nickname (such as a raid warning from a boss mod which is capable of adding target icons to messages, like Big Wigs), it comes up correctly, but the raid icon stays in the middle of your screen until the next time a PopupMessage is triggered with my nickname. It should fade along with the message.
The bug has been around forever, but strangely enough, it never occured to me that is was Prat's fault. It's very easy to reproduce: send a whisper to yourself containing your own nickname and a raid icon. Observe the message as it fades, but not the icon. Then send yourself another whisper with your nickname, but no icon, and you'll see it disappear.
Well now that you've seen the bubble, AMS, hysteria... etc at least once, add them to your whitelist. And they're buffs, not debuffs. Make sure your EBB group is configured for that.
expirationTime is the time at which the buff will expire, as it clearly states, not the time left until it expires, so in your example, instead of 5-30 for your start time, you want GetTime() - (duration-timeleft) which is GetTime() - (30-5) which is GetTime() - 25
So: CooldownFrame_SetTimer(coolDown, GetTime()-25, 30, 1);
It will start a cooldown animation that started 25s ago and has 5s left.
I believe this is it, someone correct me if I'm wrong.
EDIT: Your number 5 (time left) should be obtained the difference between GetTime() (i.e. now) and expirationTime, as Dridzt explained.
Altoholic-3.0.006\Frames\TabCharacters.lua:155: attempt to get length of field 'MOUNT' (a nil value)
Altoholic-3.0.006\Altoholic.lua:187: in function `initFunction'
Interface\FrameXML\UIDropDownMenu.lua:69: in function `UIDropDownMenu_Initialize':
Interface\FrameXML\UIDropDownMenu.lua:713: in function `ToggleDropDownMenu':
<string>:"*:OnClick":1: in function <[string "*:OnClick"]:1>
I think I was looking at someone's toon who's below lvl 30 (no mount), but not quite sure.
BTW, if you look in the comments on the Curse website for Recipe Book, you'll see the fix listed. There's 2 lines to modify in RecipeBookShare.lua. The author doesn't seem to be updating his addon very often.
K, I'm neither the author, not a mod, but...
READ THE DAMN THREAD BEFORE POSTING !
How many times do we have to hear about Focus ?
There are other valid issues getting lost in the noise.
0
self.item is not nil, so the only way (self.item and not GetItemInfo(self.item)) can be true is if not GetItemInfo(self.item) is true as well, meaning GetItemInfo(self.item) is false. And it shouldn't be, yet it is. That's the issue.
And I guess cache availability is as good a reason as any. I don't see any other way to fix the whole script but by changing the default bandage to Heavy Frostweave instead of Heavy Netherweave in the localization file. But it's a poor fix. This code simply doesn't work at player login, and a good fix would be to make it work.
PS: I did use print() to debug. ;)
0
But can you explain how this if..then statement is run ? I can't figure out how its conditions are met unless GetItemInfo doesn't return anything. First part: spell isn't a string (non-existent for this toon in the savedvars) but item is, so that condition isn't verified. Second part: item exists and GetItemInfo is false ? I'm confused.
0
FindABandage is
Bit convoluted without looking at the whole thing, but that's pretty much it.
The DefaultRangeSpell is Heavy Netherweave Bandage (in the localization file). I could change that and it would fix the problem, but I'd like to know why it's not working. So basically, FindABandage doesn't work, even though I have Heavy Frostweave Bandages in my bags. And this if:
if ((type(self.spell) ~= "string" and type(self.item) ~= "string") or (self.item and not GetItemInfo(self.item))) then
shouldn't have its conditions met. The spell and item refer to what I have set to default in my SavedVars. In my case, no spell (not a caster), but I do have Heavy Frostweave Bandage as default item to use for range check saved there. So I don't see how it's running what's in that if then statement, yet it does because GetItemInfo(self.item) is false (I added debug messages in there to check), which verifies the second condition of this if then.
Soooo... since I don't know what I'm doing, I'm asking here. This same piece of code works after a reloadui. So, is that it ? No access to cache yet, so it fails ?
0
I'm trying to make xperl use my Heavy Frostweave Bandage as default item for range check and it doesn't because of this.
Sorry, I can provide more context in a bit, raiding right now.
0
GetItemInfo() simply doesn't work until I'm completely logged in, or so it seems.
In other words, something like this actually works:
I used Heavy Frostweave Bandage as the item.
I am not very experienced with lua, but I don't get it. Am I missing something ? If not, can someone with more experience than me run some tests and figure it out ?
0
Just a few posts before yours.
0
During the course of the game, I do notice a delay when opeing the guild roster if I haven't done so recently. I see offline people and then they disappear (because I uncheck/check that box every login to make sure they're not shown - see above). In case the 2 are related.
0
0
0
0
change the line to in the file XPerl_FrameOptions.lua (it's in the XPerl_Options subfolder).
0
GetTime() - (duration-timeleft) which is
GetTime() - (30-5) which is
GetTime() - 25
So: CooldownFrame_SetTimer(coolDown, GetTime()-25, 30, 1);
It will start a cooldown animation that started 25s ago and has 5s left.
I believe this is it, someone correct me if I'm wrong.
EDIT: Your number 5 (time left) should be obtained the difference between GetTime() (i.e. now) and expirationTime, as Dridzt explained.
0
I think I was looking at someone's toon who's below lvl 30 (no mount), but not quite sure.
0
BTW, if you look in the comments on the Curse website for Recipe Book, you'll see the fix listed. There's 2 lines to modify in RecipeBookShare.lua. The author doesn't seem to be updating his addon very often.
0
READ THE DAMN THREAD BEFORE POSTING !
How many times do we have to hear about Focus ?
There are other valid issues getting lost in the noise.