WoWInterface (
-   Lua/XML Help (
-   -   Delete cursor item not working correctly (

Walkerbo 11-23-20 08:07 PM

Delete cursor item not working correctly
Hi all

I am the author of a small addon called Aardvark; the addon will auto destroy listed items when a vendor window is opened.

Since 90002 when I visit a vendor the destroy item messages print but the items themselves are not deleted; no matter how many times I close and reopen the vendor window the messages print about the items never leave my bags.
I can run the destroy function manually after I have already opened the vendor window and then the items are destroyed.

This is the error I get;
Lua Code:
  1. 1x [ADDON_ACTION_BLOCKED] AddOn 'Aardvark' tried to call the protected function 'UNKNOWN()'.
  2. [string "@!BugGrabber\BugGrabber.lua"]:519: in function <!BugGrabber\BugGrabber.lua:519>
  3. [string "=[C]"]: ?
  4. [string "=[C]"]: in function `DeleteCursorItem'
  5. [string "@Aardvark\Aardvark-AR"]:2112: in function <Aardvark\Aardvark.lua:2084>
  6. [string "@Aardvark\Aardvark-AR"]:2490: in function <Aardvark\Aardvark.lua:2482>

I cannot work out why I get the UNKNOWN() error, or why it works fine if the vendor window is already opened.

This is my destroy function which fires on the "MERCHANT_SHOW" event;
Lua Code:
  1. local function avkDestroy()
  2.     local destroyedItemCount = 0 -- Destroyed items counting variable
  3.     local destroyedSlotCount = 0
  4.     -- Destroyed slots counting variable
  5.     for destroyBag = 0, 4 do -- Check each bag
  6.         destroyBagSlot = GetContainerNumSlots(destroyBag)
  7.         for destroySlot = 0, destroyBagSlot do -- Check each bag slot
  8.             currentItemID = GetContainerItemID(destroyBag, destroySlot)
  9.             if currentItemID then -- If current bag slot has an item then get the item info
  10.                 local _, itemLink, _, _, _, _, _, _, _, _, itemValue = GetItemInfo(currentItemID)
  11.                 local _, itemCount, _, _, _, _, _, _ = GetContainerItemInfo(destroyBag, destroySlot)
  12.                 if
  13.                     checkItemOnGlobalProtectList(currentItemID) or
  14.                         checkItemOnCharacterProtectList(currentItemID) and itemValue == 0
  15.                  then
  16.                     if AVKGlobalSettings.Destroy.dddm and AVKGlobalSettings.Protect.pdpm then -- Print protected item
  17.                         if itemLink then
  18.                             print(" - Protected: " .. itemLink .. " not destroyed.")
  19.                         end
  20.                     end
  21.                 elseif checkItemOnGlobalDestroyList(currentItemID) or checkItemOnCharacterDestroyList(currentItemID) then
  22.                     destroyedItemCount = destroyedItemCount + itemCount
  23.                     destroyedSlotCount = destroyedSlotCount + 1
  24.                     -- If item Destroy messages are on print
  25.                     if AVKGlobalSettings.Destroy.dddm then -- Print each item destroyed
  26.                         print(" - Destroyed: " .. itemCount .. " " .. itemLink)
  27.                     end
  28.                     PickupContainerItem(destroyBag, destroySlot)
  29.                     DeleteCursorItem() -- Destroy current item
  30.                 end
  31.             end
  32.         end
  33.     end
  34.     if destroyedSlotCount ~= 0 then -- If items were destroyed print out total -- If no items destroyed print out bag space message
  35.         print(
  36.             ColourList.textBluePrefixSuffix ..
  37.                 ColourList.textRed ..
  38.                     "Items destroyed :-|r " ..
  39.                         destroyedItemCount .. ColourList.textRed .. "  ~  Bagslots cleared :-|r " .. destroyedSlotCount
  40.         )
  41.     elseif AVKGlobalSettings.Destroy.dntdm then
  42.         print(ColourList.textBluePrefixSuffix .. ColourList.textRed .. "Nothing destroyed. No bag space saved.")
  43.     end
  44. end

And here is my full code.

I am really stumped with this one, and I am looking for some help to get this going again.

Kanegasi 11-23-20 10:22 PM

9.0.2 has protected DeleteCursorItem(), it now requires a hardware event.

This is the error I get when Scrap tries to delete an item (reported by Swatter from the Auctioneer package):

"Warning: AddOn Scrap attempted to call a protected function (DeleteCursorItem()) which may require interaction."

BugGrabber is incorrectly reporting a hidden function within DeleteCursorItem. When you see UNKNOWN() in an error report, it's actually a function within the C code, which is not exposed ingame.

Walkerbo 11-24-20 03:59 AM

Thanks for making me aware of this change.

Has this change got anything to do the crackdown on multiboxing?

I have a slash command that does run the function but I suppose that there is no way to automate that slash command.

Where is the forum where we can raise issues or questions to the wow api team?

Ketho 11-24-20 06:40 PM

I actually reported it not being protected as a bug because it could delete literally everything

Kanegasi 11-25-20 04:42 AM

I don't mean to be rude, but at some point, the convenience of addons should win over the inconvenience of someone blindly running a random script or installing a random weakaura.

Walkerbo 11-25-20 10:53 PM

Hi Ketho

I agree with Kanegasi, making this a protected function exacerbates the painful manual typing of "delete" for each and every item that cannot be sold.

It gets a bit much that we have to take such nanny state actions to prevent others from running random scripts.

If we end up creating rules based on the lowest IQ we will end up all wrapped in cotton wool.

TheSpanishInquisition 04-05-21 03:08 PM

I know this is a bit old now, but I wrote an addon specifically to delete trash items (or items that I tag as trash) when I run out of bag space. I originally did it for levelling in Classic with small bags, but found it very useful when farming old content in retail.

Now that this function has been borked, is there any way to automatically delete a specific item, or the item in a given bag space? Previously I was using


PickupContainerItem(intBagID, intSlotID);

I mean, even if I have to bind it to a key, or select confirm or something. I just want it to allow me to delete the lowest value items in my bag without me having to go through them one by one to work out what to get rid of...

SDPhantom 04-06-21 01:01 AM

Not without a hardware event. It shouldn't be that hard to make a button to click somewhere or a slash command to run that would trigger a purge of unwanted items.

All times are GMT -6. The time now is 10:09 AM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI