• 0

    posted a message on Check if item is soulbound
    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.
    Also keep in mind for users with color blind mode enabled (ENABLE_COLORBLIND_MODE == "1") the line number changes.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Officially stumped
    1x LibGuildBankComm-1.0-90001 (LibGuildBankComm-1.0):24: attempt to call field '?' (a nil value)
    
    Locals:
      ---
    You're registering for an event but didn't define the function lib.eventFrame:EventName for it. If that is the full code it appears to be PLAYER_ENTERING_WORLD.
    Posted in: Lua Code Discussion
  • 0

    posted a message on How do I make the cooldown look round?
    The cooldown animation is a square and there's nothing you can change about that. The way addons with rounded buttons get around this is by making the Cooldown smaller than the actual button, and the border drawn on top of it thick enough to mask the fact it's a square.

    Take a look at Blizzard's RuneFrame.xml or try /run RuneButtonIndividual1:SetScale(10) in game (with the default rune frame shown), and you'll see it's doing this as well and it's far from perfect.
    Posted in: Lua Code Discussion
  • 0

    posted a message on Hooking the Complete Quest button
    Yea, the naming for those things is a bit confusing (CompleteQuest() doesn't complete the quest, go figure).
    The button is the one that finalizes quest completion and closes the gossip window. I need to check which reward was selected and run some other code before the choice is no longer reversible.
    I didn't know assigning scripts in XML makes local copies. Your solution works (I wasn't aware of the existence of GetScript).
    Thanks for the explanation ;)
    Posted in: Lua Code Discussion
  • 0

    posted a message on Hooking the Complete Quest button
    I'm trying to pre-hook the Complete Quest button on the quest frame.

    I found the button is called QuestFrameCompleteQuestButton and the function it calls when clicked is QuestRewardCompleteButton_OnClick.

    However, trying to replace QuestRewardCompleteButton_OnClick with my own function doesn't get the desired result. Clicking the button still calls the original function (I disabled all addons to make sure no other addon was interfering). Typing /run QuestRewardCompleteButton_OnClick() does call the hooked function though.

    So instead of that, I resorted to QuestFrameCompleteQuestButton:SetScript("OnClick", MyFunction), which seems to work. I'm afraid this will stop working when another addon is trying to do the same thing though (even though it's unlikely), and it just feels wrong doing things that way.
    Why won't the first method work?
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.