• 0

    posted a message on Check if item is soulbound
    Quote from Farmbuyer

    Also, you missed the

    and to check on more than just "line number 2"


    part of my post.


    I didn't miss it, I didn't need it. The purpose was to get SellJunk to ignore archeology grey items without adding them all to the exception list. In this case, the word "Soulbound" is always on the second line. It's a temp fix until the prices changes go live so it doesn't accidently sell an item that could be worth ALOT more than 10 silver in a few days/weeks time. That, and learn a bit more lua in the process.

    Thank you all for you help, I would offer the altered code to you all, but my guess is you guys know how to do it :D
    Posted in: Lua Code Discussion
  • 0

    posted a message on Check if item is soulbound
    Quote from Tyran37
    You need to use tooltip:SetBagItem(bag, slot) or else it will never show if the item is soulbound. I'm not sure why t is always nil for you though. Try
    CreateFrame("GameTooltip", "myTooltip", nil, "GameTooltipTemplate")
    instead of adding fontstrings manually.


    replaced

    tooltip:SetHyperlink(item)


    with your line

    tooltip:SetBagItem(bag, slot)


    and huzzah! it works.

    thanks very much people!
    Posted in: Lua Code Discussion
  • 0

    posted a message on Check if item is soulbound
    No luck, it seems to always be returning false.

    atm, the varible item = GetContainerItemLink(bag, slot)

    Am I meant to pass something else to is_heroic_item()?

    EDIT:
    local tooltip
    local function create()
        local tip, leftside = CreateFrame("GameTooltip"), {}
        for i = 1, 2 do
            local L,R = tip:CreateFontString(), tip:CreateFontString()
            L:SetFontObject(GameFontNormal)
            R:SetFontObject(GameFontNormal)
            tip:AddFontStrings(L,R)
            leftside[i] = L
        end
        tip.leftside = leftside
        return tip
    end
    local function is_soulbound_item(item)   -- returns boolean
        tooltip = tooltip or create()
        tooltip:SetOwner(UIParent,"ANCHOR_NONE")
        tooltip:ClearLines()
        tooltip:SetHyperlink(item)
        local t = tooltip.leftside[2]:GetText()
        tooltip:Hide()
        return (t == ITEM_SOULBOUND)
    end


    In this peice of code, t is nil no matter what happens, meaning it always returns false.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Check if item is soulbound
    Hey there, I've dabbled in lua coding for wow a while ago, but it's been some time.

    I'm trying to modify an existing addon (for my own use, not to steal and distribute as my own work) and I need to find a way of identifying if an item is soulbound or not.

    The code can already loop though every bag slot, and currently checks GetContainerItemLink() for data. But as far as I can see looking at the wiki, the ItemLink does not contain the data I require. I have found a few other mods that can identify if the item is soulbound, but I have little to no joy in cobbling together a working bit of code, I'm probably missing a lib or something, but preferably I want to do it without that so I can see the code and know how it works.

    Any suggestions?
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.