• 0

    posted a message on GetItemInfo()
    Quote from Xinhuan
    if ((type(self.spell) ~= "string" and type(self.item) ~= "string") or (self.item and not GetItemInfo(self.item))) then

    The first bolded part is false. So Lua evaluates the second part.

    (self.item and not GetItemInfo(self.item))

    self.item is nil, so the whole part is false as well. Note that I am just guessing, because the code is referring to

    conf.rangeFinder.Main.item
    conf.rangeFinder.NameFrame.item
    conf.rangeFinder.StatsFrame.item

    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.

    PS: I did use print() to debug. ;)
    Posted in: Lua Code Discussion
  • 0

    posted a message on GetItemInfo()
    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.
    Posted in: Lua Code Discussion
  • 0

    posted a message on GetItemInfo()
    Xperl runs this piece of code:
     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 ?
    Posted in: Lua Code Discussion
  • 0

    posted a message on GetItemInfo()
    But I wrote if NOT. Won't this "if NOT" only work if nothing is returned by the function ?

    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.
    Posted in: Lua Code Discussion
  • 0

    posted a message on GetItemInfo()
    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 ?
    Posted in: Lua Code Discussion
  • 0

    posted a message on X-Perl Thread
    pixie91075: http://forums.wowace.com/showpost.php?p=264766&postcount=218

    Just a few posts before yours.
    Posted in: Unit Frames
  • 0

    posted a message on Gnomish Yellow Pages -- Official Thread
    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.
    Posted in: General AddOns
  • 0

    posted a message on Prat 3.0 Chat Mod Framework
    Any idea about this ? It's still happening.

    Quote from Shadoweric
    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.

    Hope that helps !
    Posted in: General AddOns
  • 0

    posted a message on X-Perl Thread
    World of Warcraft\Interface\AddOns\XPerl_Options\
    Posted in: Unit Frames
  • 0

    posted a message on ElkBuffBars v2 (finally Ace3 version)
    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.
    Posted in: General AddOns
  • 0

    posted a message on X-Perl Thread
    DividedSun, Toshikiku, Denstreifen:
    change the line
    local obj = getglobal(UIDROPDOWNMENU_OPEN_MENU)
    to
    local obj = UIDROPDOWNMENU_OPEN_MENU
    in the file XPerl_FrameOptions.lua (it's in the XPerl_Options subfolder).
    Posted in: Unit Frames
  • 0

    posted a message on Cooldown Frame frome blizzard
    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.
    Posted in: AddOn HELP!
  • 0

    posted a message on Altoholic - Official Thread
    Had another lua error:

    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.
    Posted in: General AddOns
  • 0

    posted a message on X-Perl Thread
    That's a Recipe Book error, not Recipe Radar.

    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.
    Posted in: Unit Frames
  • 0

    posted a message on X-Perl Thread
    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.
    Posted in: Unit Frames
  • To post a comment, please or register a new account.